Skip to content

Commit

Permalink
azure-pipelines.nuget.yml Pipeline migration to 1ES
Browse files Browse the repository at this point in the history
This commit migrates azure-pipelines.nuget.yml to 1ES template

**[How Tested:]**
TODOs:
 - Trigger the pipeline from the topic branch and ensure pipeline
   succeed and ensure pipeline artifacts matches before and after the migration
  • Loading branch information
Madhusudhan-MSFT committed Jan 5, 2024
1 parent da64cce commit df2043e
Showing 1 changed file with 189 additions and 177 deletions.
366 changes: 189 additions & 177 deletions azure-pipelines.nuget.yml
Original file line number Diff line number Diff line change
@@ -1,195 +1,207 @@
trigger: none

parameters:
- name: version
displayName: Version to stamp on binaries and nuget package. Should be in form of "major.minor", for example "1.0"
type: string

pool:
vmImage: "windows-latest"
- name: version
displayName: Version to stamp on binaries and nuget package. Should be in form of "major.minor", for example "1.0"
type: string

variables:
solution: "src/AppInstallerCLI.sln"
packageName: Microsoft.WindowsPackageManager.Utils
buildVer: $[counter(${{ parameters.version }}, 1)]
version: ${{ parameters.version }}.$(buildVer)

jobs:
- job: "Build"
timeoutInMinutes: 120
strategy:
matrix:
x86_release:
buildConfiguration: 'Release'
buildPlatform: 'x86'
x64_release:
buildConfiguration: 'Release'
buildPlatform: 'x64'
variables:
artifactsDir: $(Build.ArtifactStagingDirectory)\$(buildPlatform)
steps:
- script: echo $(version)

- task: NuGetToolInstaller@1
displayName: Install Nuget

# Restores all projects, including native (vcxproj) projects
- task: NuGetCommand@2
displayName: Restore Solution
inputs:
restoreSolution: "$(solution)"

# Restore these UAP packages as https://github.com/NuGet/Home/issues/7796 leads to all UAP packages being skipped for restore.
# Even though they don't need any actual restore action, they need the project.assets.json file to be created and a direct restore does that.
- task: NuGetCommand@2
displayName: Restore AppInstallerCLIPackage
inputs:
restoreSolution: 'src\AppInstallerCLIPackage\AppInstallerCLIPackage.wapproj'
resources:
repositories:
- repository: 1ESPipelineTemplates
type: git
name: 1ESPipelineTemplates/1ESPipelineTemplates
ref: refs/tags/release
extends:
template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates
parameters:
pool:
name: Azure-Pipelines-1ESPT-ExDShared

Check failure on line 24 in azure-pipelines.nuget.yml

View workflow job for this annotation

GitHub Actions / Check Spelling

`DShared` is not a recognized word. (unrecognized-spelling)

Check failure on line 24 in azure-pipelines.nuget.yml

View workflow job for this annotation

GitHub Actions / Check Spelling

`ESPT` is not a recognized word. (unrecognized-spelling)

Check failure on line 24 in azure-pipelines.nuget.yml

View workflow job for this annotation

GitHub Actions / Check Spelling

`DShared` is not a recognized word. (unrecognized-spelling)

Check failure on line 24 in azure-pipelines.nuget.yml

View workflow job for this annotation

GitHub Actions / Check Spelling

`ESPT` is not a recognized word. (unrecognized-spelling)
image: windows-2022
os: windows
customBuildTags:
- ES365AIMigrationTooling

stages:
- stage: stage
jobs:
- job: "Build"
timeoutInMinutes: 120
strategy:
matrix:
x86_release:
buildConfiguration: 'Release'
buildPlatform: 'x86'
x64_release:
buildConfiguration: 'Release'
buildPlatform: 'x64'
variables:
artifactsDir: $(Build.ArtifactStagingDirectory)\$(buildPlatform)
templateContext:
outputs:
- output: buildArtifact
displayName: 'Publish Pipeline Artifacts'
PathtoPublish: '$(artifactsDir)'
steps:
- script: echo $(version)

- task: NuGetToolInstaller@1
displayName: Install Nuget

# Restores all projects, including native (vcxproj) projects
- task: NuGetCommand@2
displayName: Restore Solution
inputs:
restoreSolution: "$(solution)"

# Restore these UAP packages as https://github.com/NuGet/Home/issues/7796 leads to all UAP packages being skipped for restore.
# Even though they don't need any actual restore action, they need the project.assets.json file to be created and a direct restore does that.
- task: NuGetCommand@2
displayName: Restore AppInstallerCLIPackage
inputs:
restoreSolution: 'src\AppInstallerCLIPackage\AppInstallerCLIPackage.wapproj'

- task: NuGetCommand@2
displayName: Restore AppInstallerTestMsixInstaller
inputs:
restoreSolution: 'src\AppInstallerTestMsixInstaller\AppInstallerTestMsixInstaller.wapproj'

# Restores only .NET core projects, but is still necessary, as without this the IndexCreationTool and LocalhostWebServer projects fail to build
- task: DotNetCoreCLI@2
displayName: DotNet Restore
inputs:
command: "restore"
projects: "**/*.csproj"

- task: PowerShell@2
displayName: Update Binary Version
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
inputs:
filePath: 'src\binver\Update-BinVer.ps1'
arguments: '-TargetFile binver\binver\version.h -BuildVersion $(buildVer) -MajorMinorOverride ${{ parameters.version }}'
workingDirectory: "src"

- task: VSBuild@1
displayName: Build Solution
inputs:
platform: "$(buildPlatform)"
solution: "$(solution)"
configuration: "$(buildConfiguration)"

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@2
displayName: "ESRP CodeSigning - Package contents"
inputs:
ConnectedServiceName: "WindowsPackageManager ESRP CodeSigning"
FolderPath: src
Pattern: |
*\$(buildConfiguration)\WinGetUtil\WinGetUtil.dll
WinGetUtilInterop\bin\$(buildConfiguration)\netstandard2.0\WinGetUtilInterop.dll
UseMinimatch: true
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode" : "CP-230012",
"OperationCode" : "SigntoolSign",
"Parameters" : {
"OpusName" : "Microsoft",
"OpusInfo" : "http://www.microsoft.com",
"FileDigest" : "/fd \"SHA256\"",
"PageHash" : "/NPH",
"TimeStamp" : "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
},
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "CP-230012",
"OperationCode" : "SigntoolVerify",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
- task: CopyFiles@2
displayName: 'Copy nuget pack files to artifacts folder'
inputs:
Contents: |
- task: NuGetCommand@2
displayName: Restore AppInstallerTestMsixInstaller
inputs:
restoreSolution: 'src\AppInstallerTestMsixInstaller\AppInstallerTestMsixInstaller.wapproj'

# Restores only .NET core projects, but is still necessary, as without this the IndexCreationTool and LocalhostWebServer projects fail to build
- task: DotNetCoreCLI@2
displayName: DotNet Restore
inputs:
command: "restore"
projects: "**/*.csproj"

- task: PowerShell@2
displayName: Update Binary Version
condition: not(eq(variables['Build.Reason'], 'PullRequest'))
inputs:
filePath: 'src\binver\Update-BinVer.ps1'
arguments: '-TargetFile binver\binver\version.h -BuildVersion $(buildVer) -MajorMinorOverride ${{ parameters.version }}'
workingDirectory: "src"

- task: VSBuild@1
displayName: Build Solution
inputs:
platform: "$(buildPlatform)"
solution: "$(solution)"
configuration: "$(buildConfiguration)"

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@2
displayName: "ESRP CodeSigning - Package contents"
inputs:
ConnectedServiceName: "WindowsPackageManager ESRP CodeSigning"
FolderPath: src
Pattern: |
*\$(buildConfiguration)\WinGetUtil\WinGetUtil.dll
WinGetUtilInterop\bin\$(buildConfiguration)\netstandard2.0\WinGetUtilInterop.dll
UseMinimatch: true
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode" : "CP-230012",
"OperationCode" : "SigntoolSign",
"Parameters" : {
"OpusName" : "Microsoft",
"OpusInfo" : "http://www.microsoft.com",
"FileDigest" : "/fd \"SHA256\"",
"PageHash" : "/NPH",
"TimeStamp" : "/tr \"http://rfc3161.gtm.corp.microsoft.com/TSS/HttpTspServer\" /td sha256"
},
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "CP-230012",
"OperationCode" : "SigntoolVerify",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
- task: CopyFiles@2
displayName: 'Copy nuget pack files to artifacts folder'
inputs:
Contents: |
WinGetUtil.nuspec
src\$(buildPlatform)\$(buildConfiguration)\WinGetUtil\WinGetUtil.dll
src\$(buildPlatform)\$(buildConfiguration)\WinGetUtil\WinGetUtil.pdb
src\WinGetUtilInterop\bin\$(buildConfiguration)\netstandard2.0\WinGetUtilInterop.dll
src\WinGetUtilInterop\bin\$(buildConfiguration)\netstandard2.0\WinGetUtilInterop.pdb
src\WinGetUtilInterop\build\Microsoft.WindowsPackageManager.Utils.targets
schemas\JSON\manifests\**
TargetFolder: '$(artifactsDir)'

- task: PublishPipelineArtifact@1
displayName: Publish Pipeline Artifacts
inputs:
targetPath: '$(artifactsDir)'

- job: "Nuget"
timeoutInMinutes: 60
dependsOn: 'Build'
steps:
- checkout: none

- task: DownloadPipelineArtifact@2
displayName: 'Download Build.x64release artifacts'
inputs:
artifactName: Build.x64release
targetPath: '$(Pipeline.Workspace)\Build.x64release'

- task: DownloadPipelineArtifact@2
displayName: 'Download Build.x86release artifacts'
inputs:
artifactName: Build.x86release
targetPath: '$(Pipeline.Workspace)\Build.x86release'

- task: NuGetCommand@2
displayName: Pack WingetUtil nuget package
inputs:
command: pack
packagesToPack: '$(Pipeline.Workspace)\Build.x64release\WinGetUtil.nuspec'
versioningScheme: byEnvVar
versionEnvVar: version
packDestination: '$(Build.ArtifactStagingDirectory)'
basePath: $(Pipeline.Workspace)

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@2
displayName: "ESRP CodeSigning - NuGet package"
inputs:
ConnectedServiceName: "WindowsPackageManager ESRP CodeSigning"
FolderPath: "$(Build.ArtifactStagingDirectory)"
Pattern: "$(packageName).$(version).nupkg"
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode" : "CP-401405",
"OperationCode" : "NuGetSign",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "CP-401405",
"OperationCode" : "NuGetVerify",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]
- task: PublishBuildArtifacts@1
displayName: Publish nuget package to artifacts
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\$(packageName).$(version).nupkg'
ArtifactName: $(packageName)
publishLocation: Container

- task: NuGetCommand@2
displayName: Push WingetUtil nuget package to nuget.org
inputs:
command: push
nuGetFeedType: external
includeNugetOrg: true
packagesToPush: '$(Build.ArtifactStagingDirectory)\$(packageName).$(version).nupkg'
publishFeedCredentials: "WindowsPackageManagerAzurePipelineNuget - NuGet.org"
TargetFolder: '$(artifactsDir)'
- job: "Nuget"
timeoutInMinutes: 60
dependsOn: 'Build'
templateContext:
outputs:
- output: pipelineArtifact
displayName: 'Publish nuget package to artifacts'
targetPath: '$(Build.ArtifactStagingDirectory)\$(packageName).$(version).nupkg'
artifactName: $(packageName)
publishLocation: Container
- output: nuget
displayName: 'Push WingetUtil nuget package to nuget.org'
packageParentPath: '$(Build.ArtifactStagingDirectory)'
nuGetFeedType: external
includeNugetOrg: true
packagesToPush: '$(Build.ArtifactStagingDirectory)\$(packageName).$(version).nupkg'
publishFeedCredentials: "WindowsPackageManagerAzurePipelineNuget - NuGet.org"
steps:
- checkout: none

- task: DownloadPipelineArtifact@2
displayName: 'Download Build.x64release artifacts'
inputs:
artifactName: Build.x64release
targetPath: '$(Pipeline.Workspace)\Build.x64release'

- task: DownloadPipelineArtifact@2
displayName: 'Download Build.x86release artifacts'
inputs:
artifactName: Build.x86release
targetPath: '$(Pipeline.Workspace)\Build.x86release'

- task: NuGetCommand@2
displayName: Pack WingetUtil nuget package
inputs:
command: pack
packagesToPack: '$(Pipeline.Workspace)\Build.x64release\WinGetUtil.nuspec'
versioningScheme: byEnvVar
versionEnvVar: version
packDestination: '$(Build.ArtifactStagingDirectory)'
basePath: $(Pipeline.Workspace)

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@2
displayName: "ESRP CodeSigning - NuGet package"
inputs:
ConnectedServiceName: "WindowsPackageManager ESRP CodeSigning"
FolderPath: "$(Build.ArtifactStagingDirectory)"
Pattern: "$(packageName).$(version).nupkg"
signConfigType: inlineSignParams
inlineOperation: |
[
{
"KeyCode" : "CP-401405",
"OperationCode" : "NuGetSign",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
},
{
"KeyCode" : "CP-401405",
"OperationCode" : "NuGetVerify",
"Parameters" : {},
"ToolName" : "sign",
"ToolVersion" : "1.0"
}
]

1 comment on commit df2043e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@check-spelling-bot Report

🔴 Please review

See the 📜action log for details.

Unrecognized words (2)

DShared
ESPT

Previously acknowledged words that are now absent bitspace Mta PFM testdata :arrow_right:
To accept ✔️ these unrecognized words as correct and remove the previously acknowledged and now absent words, run the following commands

... in a clone of the [email protected]:microsoft/winget-cli.git repository
on the user/masudars/Azure_Pipelines_Nuget_To_1ES_Migration branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.21/apply.pl' |
perl - 'https://github.com/microsoft/winget-cli/actions/runs/7426680659/attempts/1'
Available 📚 dictionaries could cover words not in the 📘 dictionary

This includes both expected items (506) from .github/actions/spelling/expect.txt and unrecognized words (2)

Dictionary Entries Covers
cspell:win32/src/win32.txt 53509 20
cspell:python/src/python/python-lib.txt 3873 3
cspell:python/src/python/python.txt 453 2
cspell:python/src/common/extra.txt 741 2
cspell:php/php.txt 2597 2
cspell:npm/npm.txt 288 2
cspell:java/java.txt 7642 2
cspell:django/django.txt 859 2
cspell:csharp/csharp.txt 19 2
cspell:sql/src/tsql.txt 455 1

Consider adding them using (in .github/workflows/spelling3.yml):

      with:
        extra_dictionaries:
          cspell:win32/src/win32.txt
          cspell:python/src/python/python-lib.txt
          cspell:python/src/python/python.txt
          cspell:python/src/common/extra.txt
          cspell:php/php.txt
          cspell:npm/npm.txt
          cspell:java/java.txt
          cspell:django/django.txt
          cspell:csharp/csharp.txt
          cspell:sql/src/tsql.txt

To stop checking additional dictionaries, add:

      with:
        check_extra_dictionaries: ''
If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

Please sign in to comment.