From 3e465f9c014937e67997a82ec270d403b821b82d Mon Sep 17 00:00:00 2001 From: ryfu-msft Date: Tue, 12 Nov 2024 12:22:10 -0800 Subject: [PATCH] add files --- pipelines/azure-pipelines.publish.yml | 55 +++++++++++++ pipelines/azure-pipelines.yml | 105 +++++++------------------ pipelines/templates/manual-trigger.yml | 15 ++++ 3 files changed, 98 insertions(+), 77 deletions(-) create mode 100644 pipelines/azure-pipelines.publish.yml create mode 100644 pipelines/templates/manual-trigger.yml diff --git a/pipelines/azure-pipelines.publish.yml b/pipelines/azure-pipelines.publish.yml new file mode 100644 index 0000000..c68badf --- /dev/null +++ b/pipelines/azure-pipelines.publish.yml @@ -0,0 +1,55 @@ +# winget-dsc pipeline to publish module artifacts +name: '$(Build.DefinitionName)-$(Build.DefinitionVersion)-$(Date:yyyyMMdd)-$(Rev:r)' + +trigger: none + +parameters: # parameters are shown up in ADO UI in a build queue time + +- name: 'Microsoft.Windows.Developer' + displayName: 'Publish Microsoft.Windows.Developer to PSGallery' + type: boolean + default: false + +resources: + repositories: + - repository: self + type: git + ref: refs/heads/main + - 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 + image: windows-2022 + os: windows + customBuildTags: + - ES365AIMigrationTooling + settings: + skipBuildTagsForGitHubPullRequests: true + + stages: + - stage: Manual Approval + displayName: Manual Approval + dependsOn: [] + jobs: + - ${{ if eq(parameters.Microsoft.Windows.Developer, false) }}: + - template: /azure-pipelines/templates/manual-trigger.yml@self + parameters: + publishTarget: Microsoft.Windows.Developer PSGallery + - template: /azure-pipelines/templates/jobs/publish/store.yml@self + parameters: + runImmediately: ${{ parameters.msstore }} + - stage: Publish pipeline artifact + jobs: + - job: Publish pipeline artifact + displayName: 'Publish Microsoft.Windows.Developer' + templateContext: + outputs: + - output: pipelineArtifact + displayName: Publish ${{ parameters.buildName }} + targetPath: $(Build.SourcesDirectory)\resources\Microsoft.Windows.Developer\ + artifactName: Microsoft.Windows.Developer diff --git a/pipelines/azure-pipelines.yml b/pipelines/azure-pipelines.yml index e68067e..5009ae7 100644 --- a/pipelines/azure-pipelines.yml +++ b/pipelines/azure-pipelines.yml @@ -1,20 +1,14 @@ -# winget-dsc pipeline to publish artifacts +# winget-dsc pipeline to publish module artifacts name: '$(Build.DefinitionName)-$(Build.DefinitionVersion)-$(Date:yyyyMMdd)-$(Rev:r)' -# Commit triggers -trigger: - - main +trigger: none -# PR triggers -pr: - branches: - include: - - main - paths: - include: - - pipelines/azure-pipelines.yml - - resources/* - - tests/* +parameters: # parameters are shown up in ADO UI in a build queue time + +- name: 'Microsoft.Windows.Developer' + displayName: 'Publish Microsoft.Windows.Developer to PSGallery' + type: boolean + default: false resources: repositories: @@ -38,67 +32,24 @@ extends: skipBuildTagsForGitHubPullRequests: true stages: - - stage: WinGet_DSC_Artifacts_Publish + - stage: Manual Approval + displayName: Manual Approval + dependsOn: [] jobs: - - job: Publish_WinGet_DSC_Resources - displayName: 'Publish WinGet DSC Resources' - templateContext: - outputs: - - output: pipelineArtifact - displayName: 'Publish Pipeline Microsoft.Windows.Developer' - targetPath: $(Build.SourcesDirectory)\resources\Microsoft.Windows.Developer\ - artifactName: Microsoft.Windows.Developer - - output: pipelineArtifact - displayName: 'Publish Pipeline Microsoft.Windows.Setting.Accessibility' - targetPath: $(Build.SourcesDirectory)\resources\Microsoft.Windows.Setting.Accessibility\ - artifactName: Microsoft.Windows.Setting.Accessibility - - output: pipelineArtifact - displayName: 'Publish Pipeline PythonPip3Dsc' - targetPath: $(Build.SourcesDirectory)\resources\PythonPip3Dsc\ - artifactName: PythonPip3Dsc - - output: pipelineArtifact - displayName: 'Publish Pipeline YarnDsc' - targetPath: $(Build.SourcesDirectory)\resources\YarnDsc\ - artifactName: YarnDsc - - output: pipelineArtifact - displayName: 'Publish Pipeline NpmDsc' - targetPath: $(Build.SourcesDirectory)\resources\NpmDsc\ - artifactName: NpmDsc - - output: pipelineArtifact - displayName: 'Publish Pipeline Microsoft.WindowsSandbox.DSC' - targetPath: $(Build.SourcesDirectory)\resources\Microsoft.WindowsSandbox.DSC\ - artifactName: Microsoft.WindowsSandbox.DSC - - output: pipelineArtifact - displayName: 'Publish Pipeline GitDsc' - targetPath: $(Build.SourcesDirectory)\resources\GitDsc\ - artifactName: GitDsc - - output: pipelineArtifact - displayName: 'Publish Pipeline Microsoft.VSCode.Dsc' - targetPath: $(Build.SourcesDirectory)\resources\Microsoft.VSCode.Dsc\ - artifactName: Microsoft.VSCode.Dsc - - output: pipelineArtifact - displayName: 'Publish Pipeline Microsoft.DotNet.Dsc' - targetPath: $(Build.SourcesDirectory)\resources\Microsoft.DotNet.Dsc\ - artifactName: Microsoft.DotNet.Dsc - - steps: - - checkout: self - clean: true - fetchTags: false - - - task: PowerShell@2 - displayName: 'Run Pester tests for DSC modules' - inputs: - pwsh: true - targetType: 'inline' - script: | - $env:PSModulePath += ";$(Build.SourcesDirectory)\resources" - Invoke-Pester -CI - workingDirectory: $(Build.SourcesDirectory)\tests\ - ignoreLASTEXITCODE: true - - - task: PublishTestResults@2 - inputs: - testResultsFormat: 'NUnit' - testResultsFiles: '**/Test*.xml' - failTaskOnFailedTests: true + - ${{ if eq(parameters.Microsoft.Windows.Developer, false) }}: + - template: /azure-pipelines/templates/manual-trigger.yml@self + parameters: + publishTarget: Microsoft.Windows.Developer PSGallery + - template: /azure-pipelines/templates/jobs/publish/store.yml@self + parameters: + runImmediately: ${{ parameters.msstore }} + - stage: Publish pipeline artifact + jobs: + - job: Publish pipeline artifact + displayName: 'Publish Microsoft.Windows.Developer' + templateContext: + outputs: + - output: pipelineArtifact + displayName: Publish ${{ parameters.buildName }} + targetPath: $(Build.SourcesDirectory)\resources\Microsoft.Windows.Developer\ + artifactName: Microsoft.Windows.Developer diff --git a/pipelines/templates/manual-trigger.yml b/pipelines/templates/manual-trigger.yml new file mode 100644 index 0000000..6e9c5e0 --- /dev/null +++ b/pipelines/templates/manual-trigger.yml @@ -0,0 +1,15 @@ +parameters: +- name: publishTarget + type: string + +jobs: +- job: ManualTrigger + displayName: Manual trigger for ${{ parameters.publishTarget }} + pool: server + timeoutInMinutes: 86400 # job times out in 60 days + steps: + - task: ManualValidation@0 + timeoutInMinutes: 86400 # task times out in 60 days + inputs: + notifyUsers: '' + instructions: Approve this step to proceed with publishing for ${{ parameters.publishTarget }}