|
| 1 | +trigger: none |
| 2 | +pr: none |
| 3 | + |
| 4 | +parameters: |
| 5 | +- name: ghRepo |
| 6 | + displayName: GitHub repository name |
| 7 | + type: string |
| 8 | + default: maui |
| 9 | + |
| 10 | +- name: ghOwner |
| 11 | + displayName: GitHub repository owner |
| 12 | + type: string |
| 13 | + default: dotnet |
| 14 | + |
| 15 | +- name: commitHash |
| 16 | + displayName: Commit hash to download nupkgs from |
| 17 | + type: string |
| 18 | + default: skip |
| 19 | + |
| 20 | +- name: VM_IMAGE_HOST |
| 21 | + type: object |
| 22 | + default: |
| 23 | + name: NetCore1ESPool-Internal |
| 24 | + image: 1es-windows-2022 |
| 25 | + os: windows |
| 26 | + |
| 27 | +variables: |
| 28 | +- template: /eng/common/templates/variables/pool-providers.yml@self |
| 29 | +- group: DotNetBuilds storage account read tokens |
| 30 | +- group: AzureDevOps-Artifact-Feeds-Pats |
| 31 | + |
| 32 | +resources: |
| 33 | + repositories: |
| 34 | + - repository: 1ESPipelineTemplates |
| 35 | + type: git |
| 36 | + name: 1ESPipelineTemplates/1ESPipelineTemplates |
| 37 | + ref: refs/tags/release |
| 38 | + |
| 39 | +extends: |
| 40 | + ${{ if ne(variables['Build.Reason'], 'PullRequest') }}: |
| 41 | + template: v1/1ES.Official.PipelineTemplate.yml@1ESPipelineTemplates |
| 42 | + ${{ else }}: |
| 43 | + template: v1/1ES.Unofficial.PipelineTemplate.yml@1ESPipelineTemplates |
| 44 | + parameters: |
| 45 | + pool: ${{ parameters.VM_IMAGE_HOST }} |
| 46 | + sdl: |
| 47 | + binskim: |
| 48 | + scanOutputDirectoryOnly: true |
| 49 | + codeql: |
| 50 | + runSourceLanguagesInSourceAnalysis: true |
| 51 | + policheck: |
| 52 | + enabled: true |
| 53 | + spotBugs: |
| 54 | + enabled: false |
| 55 | + justification: 'Failing with "Could not successfully find the java tool launcher"' |
| 56 | + sourceRepositoriesToScan: |
| 57 | + exclude: |
| 58 | + - repository: yaml-templates |
| 59 | + suppression: |
| 60 | + suppressionFile: $(Build.SourcesDirectory)\eng\automation\guardian\source.gdnsuppress |
| 61 | + stages: |
| 62 | + - stage: publish_maestro |
| 63 | + displayName: Publish to Workload Set channel |
| 64 | + dependsOn: [] |
| 65 | + jobs: |
| 66 | + - job: publish_maestro |
| 67 | + displayName: Publish to Workload Set channel |
| 68 | + pool: ${{ parameters.VM_IMAGE_HOST }} |
| 69 | + timeoutInMinutes: 240 |
| 70 | + workspace: |
| 71 | + clean: all |
| 72 | + steps: |
| 73 | + - ${{ if eq(parameters.commitHash, 'skip') }}: |
| 74 | + - script: echo parameters.commitHash was not set, skipping... |
| 75 | + displayName: Skip push |
| 76 | + - ${{ else }}: |
| 77 | + - script: | |
| 78 | + echo ##vso[task.setvariable variable=COMMIT]${{ parameters.commitHash }} |
| 79 | + displayName: Set COMMIT |
| 80 | +
|
| 81 | + - task: AzureCLI@2 |
| 82 | + displayName: Add build to workload set channel |
| 83 | + inputs: |
| 84 | + azureSubscription: "Darc: Maestro Production" |
| 85 | + scriptType: pscore |
| 86 | + scriptLocation: inlineScript |
| 87 | + inlineScript: | |
| 88 | + Write-Host "Getting BAR ID for commit: $(COMMIT)" |
| 89 | + . $(Build.SourcesDirectory)\eng\common\tools.ps1 |
| 90 | + $darc = Get-Darc |
| 91 | + $buildJson = & $darc get-build --ci --repo "${{ parameters.ghRepo }}" --commit "$(COMMIT)" --output-format json --azdev-pat $(System.AccessToken) |
| 92 | + Write-Host "`n$buildJson`n" |
| 93 | + $barId = $buildJson | ConvertFrom-Json | Select-Object -ExpandProperty "id" -First 1 |
| 94 | + Write-Host "Got the Bar ID: $barId for commit $(COMMIT) on repo ${{ parameters.ghRepo }}" |
| 95 | + if ($barId -eq $null) { |
| 96 | + Write-Error "Could not find a build for commit $(COMMIT) on repo ${{ parameters.ghRepo }}" |
| 97 | + exit 1 |
| 98 | + } |
| 99 | + Write-Host "Getting drop for Bar ID: $barId" |
| 100 | + & $darc gather-drop --ci --id $barId -o "$(Build.StagingDirectory)\nupkgs" --azdev-pat $(System.AccessToken) --verbose |
| 101 | + Write-Host "List downloaded artifacts" |
| 102 | + Get-ChildItem -Name -Recurse -Path $(Build.StagingDirectory) |
| 103 | + $manifestPack = Get-ChildItem -Path "$(Build.StagingDirectory)\nupkgs\shipping\packages\" -Filter "*.Manifest-*.nupkg" | Select-Object -First 1 |
| 104 | + $workloadSetsChannel = "" |
| 105 | + $workloadSetsFeed = "" |
| 106 | + if ($manifestPack -like "*.Manifest-8.0*") { |
| 107 | + $workloadSetsChannel = ".NET 8 Workload Release" |
| 108 | + $workloadSetsFeed = "dotnet8-workloads" |
| 109 | + } |
| 110 | + if ($manifestPack -like "*.Manifest-9.0*") { |
| 111 | + $workloadSetsChannel = ".NET 9 Workload Release" |
| 112 | + $workloadSetsFeed = "dotnet9-workloads" |
| 113 | + } |
| 114 | + if ($manifestPack -like "*.Manifest-10.0*") { |
| 115 | + $workloadSetsChannel = ".NET 10 Workload Release" |
| 116 | + $workloadSetsFeed = "dotnet10-workloads" |
| 117 | + } |
| 118 | + if (!$workloadSetsChannel -or !$workloadSetsFeed) { |
| 119 | + Write-Error "Could not determine the workload sets channel or feed for the manifest pack '$manifestPack'" |
| 120 | + exit 1 |
| 121 | + } |
| 122 | + Write-Host "##vso[task.setvariable variable=WorkloadSetsFeedName;]$workloadSetsFeed" |
| 123 | + Write-Host "Adding build ID '$barId' to channel '$workloadSetsChannel' and feed '$workloadSetsFeed'" |
| 124 | + & $darc add-build-to-channel --ci --channel "$workloadSetsChannel" --id "$barId" --skip-assets-publishing --azdev-pat $(System.AccessToken) --verbose |
| 125 | + |
0 commit comments