Skip to content

Commit ba0db82

Browse files
committed
Use artifact ordering from artifacts
1 parent 9caec0d commit ba0db82

File tree

2 files changed

+37
-17
lines changed

2 files changed

+37
-17
lines changed

eng/pipelines/templates/stages/archetype-rust-release.yml

Lines changed: 35 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -85,21 +85,36 @@ stages:
8585
runOnce:
8686
deploy:
8787
steps:
88+
- pwsh: |
89+
Write-Host "##vso[task.setvariable variable=ArtifactIndex]0"
90+
displayName: Set ArtifactIndex to 0
91+
8892
- ${{ each artifact in parameters.Artifacts }}:
8993
- pwsh: |
90-
$ArtifactName = '${{artifact.name}}'
91-
$ArtifactRootPath = '$(Pipeline.Workspace)/drop'
92-
$OutDir = '$(Pipeline.Workspace)/esrp-release'
94+
# Read artifact release order from release-order.json
95+
# and use ArtifactIndex to select the right one
96+
$index = [int]'$(ArtifactIndex)'
97+
$artifacts = Get-Content '$(Pipeline.Workspace)/drop/release-order.json' | ConvertFrom-Json
98+
if ($index -ge $artifacts.Count) {
99+
Write-Error "ArtifactIndex $index is out of range (0..$($artifacts.Count - 1))"
100+
exit 1
101+
}
102+
103+
$artifactName = $artifacts[$index]
104+
Write-Host "Releasing artifact $artifactName (index $index)"
93105
94-
if (Test-Path $OutDir) {
95-
Write-Host "Cleaning output directory: $OutDir"
96-
Remove-Item -Path $OutDir -Recurse -Force
106+
$artifactRootPath = '$(Pipeline.Workspace)/drop'
107+
$outDir = '$(Pipeline.Workspace)/esrp-release'
108+
109+
if (Test-Path $outDir) {
110+
Write-Host "Cleaning output directory: $outDir"
111+
Remove-Item -Path $outDir -Recurse -Force
97112
}
98-
New-Item -ItemType Directory -Path $OutDir -Force | Out-Null
113+
New-Item -ItemType Directory -Path $outDir -Force | Out-Null
99114
100-
Write-Host "Artifact name: $ArtifactName"
115+
Write-Host "Artifact name: $artifactName"
101116
102-
$packageMetadataPath = "$ArtifactRootPath/PackageInfo/$ArtifactName.json"
117+
$packageMetadataPath = "$artifactRootPath/PackageInfo/$artifactName.json"
103118
if (!(Test-Path $packageMetadataPath)) {
104119
Write-Error "Package metadata file not found: $packageMetadataPath"
105120
exit 1
@@ -109,16 +124,16 @@ stages:
109124
$packageVersion = $packageMetadata.version
110125
Write-Host "Package version: $packageVersion"
111126
112-
$cratePath = "$ArtifactRootPath/$ArtifactName/$ArtifactName-$packageVersion.crate"
127+
$cratePath = "$artifactRootPath/$artifactName/$artifactName-$packageVersion.crate"
113128
Copy-Item `
114129
-Path $cratePath `
115-
-Destination $OutDir
116-
Write-Host "Contents of $OutDir"
117-
Get-ChildItem -Path $OutDir | ForEach-Object { Write-Host $_.FullName }
118-
displayName: 'Copy crate for ESRP: ${{artifact.name}}'
130+
-Destination $outDir
131+
Write-Host "Contents of $outDir"
132+
Get-ChildItem -Path $outDir | ForEach-Object { Write-Host $_.FullName }
133+
displayName: 'Copy crate for ESRP'
119134
120135
- task: EsrpRelease@10
121-
displayName: 'ESRP Release: ${{artifact.name}}'
136+
displayName: 'ESRP Release'
122137
inputs:
123138
connectedservicename: 'Azure SDK PME Managed Identity'
124139
ClientId: '5f81938c-2544-4f1f-9251-dd9de5b8a81b'
@@ -136,6 +151,11 @@ stages:
136151
serviceendpointurl: 'https://api.esrp.microsoft.com/'
137152
mainpublisher: 'ESRPRELPACMANTEST'
138153

154+
- pwsh: |
155+
$index = [int]'$(ArtifactIndex)' + 1
156+
Write-Host "##vso[task.setvariable variable=ArtifactIndex]$index"
157+
displayName: Increment ArtifactIndex
158+
139159
- job: UpdatePackageVersion
140160
displayName: "API Review and Package Version Update"
141161
condition: and(succeeded(), ne(variables['Skip.UpdatePackageVersion'], 'true'))

sdk/canary/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ extends:
2525
parameters:
2626
ServiceDirectory: canary
2727
Artifacts:
28-
- name: azure_canary_core
29-
releaseInBatch: ${{ parameters.release_azure_canary_core }}
3028
- name: azure_canary
3129
releaseInBatch: ${{ parameters.release_azure_canary }}
30+
- name: azure_canary_core
31+
releaseInBatch: ${{ parameters.release_azure_canary_core }}

0 commit comments

Comments
 (0)