Skip to content

Commit 08abce5

Browse files
committed
Review feedback
1 parent 53b122c commit 08abce5

File tree

1 file changed

+17
-23
lines changed

1 file changed

+17
-23
lines changed

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

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ stages:
7272
${{if parameters.TestPipeline}}:
7373
environment: none
7474
${{else}}:
75-
environment: cratesio
75+
environment: package-publish
7676
# This timeout shouldn't be necessary once we're able to parallelize better. Right now,
7777
# this is here to ensure larger areas (30+) libraries don't time out.
7878
timeoutInMinutes: 120
@@ -85,29 +85,25 @@ 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-
88+
# This loop over the artifacts never uses `artifact` directly.
89+
# It is instead used to generate the correct number of tasks
90+
# for publishing each artifact in an order specified in the
91+
# release-order.json file.
9292
- ${{ each artifact in parameters.Artifacts }}:
9393
- pwsh: |
94-
# Read artifact release order from release-order.json
95-
# and use ArtifactIndex to select the right one
96-
$index = [int]'$(ArtifactIndex)'
9794
$artifacts = Get-Content '$(Pipeline.Workspace)/drop/release-order.json' | ConvertFrom-Json
98-
95+
9996
# Force $artifacts to be an array (PowerShell unrolls single-item arrays)
10097
if ($artifacts -isnot [Array]) {
10198
$artifacts = @($artifacts)
10299
}
103100
104-
if ($index -ge $artifacts.Count) {
105-
Write-Error "ArtifactIndex $index is out of range (0..$($artifacts.Count - 1))"
106-
exit 1
101+
$artifactName = '$(ArtifactName)'
102+
if (!$artifactName) {
103+
$artifactName = $artifacts[0]
107104
}
108105
109-
$artifactName = $artifacts[$index]
110-
Write-Host "Releasing artifact $artifactName (index $index)"
106+
Write-Host "Releasing artifact: $artifactName"
111107
112108
$artifactRootPath = '$(Pipeline.Workspace)/drop'
113109
$outDir = '$(Pipeline.Workspace)/esrp-release'
@@ -118,8 +114,6 @@ stages:
118114
}
119115
New-Item -ItemType Directory -Path $outDir -Force | Out-Null
120116
121-
Write-Host "Artifact name: $artifactName"
122-
123117
$packageMetadataPath = "$artifactRootPath/PackageInfo/$artifactName.json"
124118
if (!(Test-Path $packageMetadataPath)) {
125119
Write-Error "Package metadata file not found: $packageMetadataPath"
@@ -136,6 +130,12 @@ stages:
136130
-Destination $outDir
137131
Write-Host "Contents of $outDir"
138132
Get-ChildItem -Path $outDir | ForEach-Object { Write-Host $_.FullName }
133+
134+
# Set next artifact to release by
135+
$artifactIndex = $artifacts.IndexOf($artifactName)
136+
$nextArtifactName = $artifacts[$artifactIndex + 1]
137+
Write-Host "Next artifact to release: $nextArtifactName"
138+
Write-Host "##vso[task.setvariable variable=ArtifactName]$nextArtifactName"
139139
displayName: 'Copy crate for ESRP'
140140
141141
- task: EsrpRelease@10
@@ -157,12 +157,6 @@ stages:
157157
serviceendpointurl: 'https://api.esrp.microsoft.com/'
158158
mainpublisher: 'ESRPRELPACMANTEST'
159159

160-
- pwsh: |
161-
$index = [int]'$(ArtifactIndex)' + 1
162-
Write-Host "Setting ArtifactIndex to $index"
163-
Write-Host "##vso[task.setvariable variable=ArtifactIndex]$index"
164-
displayName: Increment ArtifactIndex
165-
166160
- job: UpdatePackageVersion
167161
displayName: "API Review and Package Version Update"
168162
condition: and(succeeded(), ne(variables['Skip.UpdatePackageVersion'], 'true'))
@@ -181,7 +175,7 @@ stages:
181175
displayName: Download ${{parameters.PipelineArtifactName}} artifact
182176
artifact: ${{parameters.PipelineArtifactName}}
183177

184-
- ${{each artifact in parameters.Artifacts }}:
178+
- ${{ each artifact in parameters.Artifacts }}:
185179
- template: /eng/common/pipelines/templates/steps/create-apireview.yml
186180
parameters:
187181
ArtifactPath: $(Pipeline.Workspace)/${{parameters.PipelineArtifactName}}

0 commit comments

Comments
 (0)