Skip to content

Commit 62b4c4e

Browse files
bryanchen-dCopilot
andauthored
build: let retried jobs skip artifacts an earlier attempt published (#346478)
build: let retried compile, CLI, Alpine, Web and Universal jobs skip artifacts an earlier attempt published Pipeline artifacts can't be overwritten. When an attempt fails after its 1ES outputs were uploaded (for example when an injected Defender scan hangs), every retry fails with 'artifact already exists'. These jobs now check for their artifacts first, the same way the package and sign jobs do since #342967, and checkForArtifact.ts no longer depends on the build packages so the CLI jobs can run it. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent b4d438f commit 62b4c4e

11 files changed

Lines changed: 205 additions & 10 deletions

‎build/azure-pipelines/alpine/product-build-alpine-cli.yml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
targetPath: $(Build.ArtifactStagingDirectory)/vscode_cli_alpine_$(VSCODE_ARCH)_cli.tar.gz
3535
artifactName: vscode_cli_alpine_$(VSCODE_ARCH)_cli
3636
displayName: Publish vscode_cli_alpine_$(VSCODE_ARCH)_cli artifact
37+
condition: and(succeeded(), ne(variables['CLI_PUBLISHED'], 'true'))
3738
sbomBuildDropPath: $(Build.ArtifactStagingDirectory)/cli
3839
sbomPackageName: "VS Code Alpine $(VSCODE_ARCH) CLI"
3940
sbomPackageVersion: $(Build.SourceVersion)
@@ -42,6 +43,7 @@ jobs:
4243
targetPath: $(Build.ArtifactStagingDirectory)/unsigned_copilot_shim_alpine_$(VSCODE_ARCH).tar.gz
4344
artifactName: unsigned_copilot_shim_alpine_$(VSCODE_ARCH)
4445
displayName: Publish unsigned Copilot shim
46+
condition: and(succeeded(), ne(variables['COPILOT_SHIM_PUBLISHED'], 'true'))
4547
sbomEnabled: false
4648
steps:
4749
- template: ../common/checkout.yml@self
@@ -167,3 +169,16 @@ jobs:
167169
GITHUB_TOKEN: "$(github-token-code-oss)"
168170
SYSROOT_ARCH: arm64
169171
IS_MUSL: "1"
172+
173+
- ${{ if not(parameters.VSCODE_CHECK_ONLY) }}:
174+
# Pipeline artifacts can't be overwritten, so a retry of this job must skip
175+
# the artifacts that an earlier attempt already published, for example
176+
# before an injected SDL step hung (see ../common/checkForArtifact.ts)
177+
- script: >-
178+
node build/azure-pipelines/common/checkForArtifact.ts
179+
CLI_PUBLISHED vscode_cli_alpine_$(VSCODE_ARCH)_cli
180+
COPILOT_SHIM_PUBLISHED unsigned_copilot_shim_alpine_$(VSCODE_ARCH)
181+
env:
182+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
183+
continueOnError: true
184+
displayName: Check for artifacts published by an earlier attempt

‎build/azure-pipelines/alpine/product-build-alpine.yml‎

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ jobs:
2626
targetPath: $(Build.ArtifactStagingDirectory)/out/server/vscode-server-linux-alpine.tar.gz
2727
artifactName: vscode_server_linux_alpine_archive-unsigned
2828
displayName: Publish x64 server archive
29+
condition: and(succeeded(), ne(variables['SERVER_ARCHIVE_PUBLISHED'], 'true'))
2930
sbomBuildDropPath: $(SERVER_DIR_PATH)
3031
sbomPackageName: "VS Code Alpine x64 Server"
3132
sbomPackageVersion: $(Build.SourceVersion)
@@ -34,6 +35,7 @@ jobs:
3435
targetPath: $(Build.ArtifactStagingDirectory)/out/web/vscode-server-linux-alpine-web.tar.gz
3536
artifactName: vscode_web_linux_alpine_archive-unsigned
3637
displayName: Publish x64 web server archive
38+
condition: and(succeeded(), ne(variables['WEB_ARCHIVE_PUBLISHED'], 'true'))
3739
sbomBuildDropPath: $(WEB_DIR_PATH)
3840
sbomPackageName: "VS Code Alpine x64 Web"
3941
sbomPackageVersion: $(Build.SourceVersion)
@@ -42,13 +44,15 @@ jobs:
4244
targetPath: $(Build.ArtifactStagingDirectory)/out/server/vscode-server-alpine-$(VSCODE_ARCH).tar.gz
4345
artifactName: vscode_server_alpine_$(VSCODE_ARCH)_archive-unsigned
4446
displayName: Publish server archive
47+
condition: and(succeeded(), ne(variables['SERVER_ARCHIVE_PUBLISHED'], 'true'))
4548
sbomBuildDropPath: $(SERVER_DIR_PATH)
4649
sbomPackageName: "VS Code Alpine $(VSCODE_ARCH) Server"
4750
sbomPackageVersion: $(Build.SourceVersion)
4851
- output: pipelineArtifact
4952
targetPath: $(Build.ArtifactStagingDirectory)/out/web/vscode-server-alpine-$(VSCODE_ARCH)-web.tar.gz
5053
artifactName: vscode_web_alpine_$(VSCODE_ARCH)_archive-unsigned
5154
displayName: Publish web server archive
55+
condition: and(succeeded(), ne(variables['WEB_ARCHIVE_PUBLISHED'], 'true'))
5256
sbomBuildDropPath: $(WEB_DIR_PATH)
5357
sbomPackageName: "VS Code Alpine $(VSCODE_ARCH) Web"
5458
sbomPackageVersion: $(Build.SourceVersion)
@@ -57,7 +61,7 @@ jobs:
5761
artifactName: agent_sdk_alpine_$(VSCODE_ARCH)_tarballs
5862
displayName: Publish agent SDK tarballs
5963
sbomEnabled: false
60-
condition: and(succeededOrFailed(), eq(variables['AGENT_SDK_TARBALLS_PRODUCED'], 'true'))
64+
condition: and(succeededOrFailed(), eq(variables['AGENT_SDK_TARBALLS_PRODUCED'], 'true'), ne(variables['AGENT_SDK_TARBALLS_PUBLISHED'], 'true'))
6165
steps:
6266
- template: ../common/checkout.yml@self
6367

@@ -288,3 +292,29 @@ jobs:
288292
GITHUB_TOKEN: "$(github-token-code-oss)"
289293
AZURE_DEVOPS_EXT_PAT: $(System.AccessToken)
290294
displayName: Build server (web)
295+
296+
# Pipeline artifacts can't be overwritten, so a retry of this job must skip
297+
# the artifacts that an earlier attempt already published, for example
298+
# before an injected SDL step hung (see ../common/checkForArtifact.ts)
299+
- ${{ if eq(parameters.VSCODE_ARCH, 'x64') }}:
300+
- script: >-
301+
node build/azure-pipelines/common/checkForArtifact.ts
302+
SERVER_ARCHIVE_PUBLISHED vscode_server_linux_alpine_archive-unsigned
303+
WEB_ARCHIVE_PUBLISHED vscode_web_linux_alpine_archive-unsigned
304+
AGENT_SDK_TARBALLS_PUBLISHED agent_sdk_alpine_$(VSCODE_ARCH)_tarballs
305+
env:
306+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
307+
condition: succeededOrFailed()
308+
continueOnError: true
309+
displayName: Check for artifacts published by an earlier attempt
310+
- ${{ else }}:
311+
- script: >-
312+
node build/azure-pipelines/common/checkForArtifact.ts
313+
SERVER_ARCHIVE_PUBLISHED vscode_server_alpine_$(VSCODE_ARCH)_archive-unsigned
314+
WEB_ARCHIVE_PUBLISHED vscode_web_alpine_$(VSCODE_ARCH)_archive-unsigned
315+
AGENT_SDK_TARBALLS_PUBLISHED agent_sdk_alpine_$(VSCODE_ARCH)_tarballs
316+
env:
317+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
318+
condition: succeededOrFailed()
319+
continueOnError: true
320+
displayName: Check for artifacts published by an earlier attempt

‎build/azure-pipelines/common/checkForArtifact.ts‎

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,41 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { type Artifact, requestAZDOAPI } from './publish.ts';
76
import { retry } from './retry.ts';
87

9-
async function getPipelineArtifacts(): Promise<Artifact[]> {
10-
const result = await requestAZDOAPI<{ readonly value: Artifact[] }>('artifacts');
8+
// Uses only Node built-ins, so jobs that don't install the build dependencies
9+
// (such as the CLI jobs) can run it too
10+
function getBuildsApiUrl(): string {
11+
const { BUILDS_API_URL, SYSTEM_COLLECTIONURI, SYSTEM_TEAMPROJECT, BUILD_BUILDID } = process.env;
12+
13+
if (BUILDS_API_URL) {
14+
return BUILDS_API_URL;
15+
}
16+
17+
if (!SYSTEM_COLLECTIONURI || !SYSTEM_TEAMPROJECT || !BUILD_BUILDID) {
18+
throw new Error('Missing BUILDS_API_URL, or SYSTEM_COLLECTIONURI, SYSTEM_TEAMPROJECT and BUILD_BUILDID');
19+
}
20+
21+
return `${SYSTEM_COLLECTIONURI.replace(/\/?$/, '/')}${encodeURIComponent(SYSTEM_TEAMPROJECT)}/_apis/build/builds/${BUILD_BUILDID}/`;
22+
}
23+
24+
async function getPipelineArtifacts(): Promise<{ readonly name: string }[]> {
25+
const token = process.env.SYSTEM_ACCESSTOKEN;
26+
27+
if (!token) {
28+
throw new Error('Missing SYSTEM_ACCESSTOKEN');
29+
}
30+
31+
const res = await fetch(`${getBuildsApiUrl()}artifacts?api-version=6.0`, {
32+
headers: { Authorization: `Bearer ${token}` },
33+
signal: AbortSignal.timeout(2 * 60 * 1000),
34+
});
35+
36+
if (!res.ok) {
37+
throw new Error(`Unexpected status code: ${res.status}`);
38+
}
39+
40+
const result = await res.json() as { readonly value: { readonly name: string }[] };
1141
return result.value.filter(a => !/sbom$/.test(a.name));
1242
}
1343

‎build/azure-pipelines/darwin/product-build-darwin-cli.yml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ jobs:
3333
targetPath: $(Build.ArtifactStagingDirectory)/out/vscode_cli_darwin_$(VSCODE_ARCH)_cli/vscode_cli_darwin_$(VSCODE_ARCH)_cli.zip
3434
artifactName: vscode_cli_darwin_$(VSCODE_ARCH)_cli
3535
displayName: Publish vscode_cli_darwin_$(VSCODE_ARCH)_cli artifact
36+
condition: and(succeeded(), ne(variables['CLI_PUBLISHED'], 'true'))
3637
sbomBuildDropPath: $(Build.ArtifactStagingDirectory)/sign/unsigned_vscode_cli_darwin_$(VSCODE_ARCH)_cli
3738
sbomPackageName: "VS Code macOS $(VSCODE_ARCH) CLI"
3839
sbomPackageVersion: $(Build.SourceVersion)
@@ -171,3 +172,15 @@ jobs:
171172
172173
- ${{ if eq(parameters.VSCODE_ARCH, 'x64') }}:
173174
- template: ../copilot-shim/copilot-shim-quality.yml@self
175+
176+
- ${{ if and(not(parameters.VSCODE_CHECK_ONLY), eq(parameters.VSCODE_PRIVILEGED_CONNECTIONS, true)) }}:
177+
# Pipeline artifacts can't be overwritten, so a retry of this job must skip
178+
# the artifacts that an earlier attempt already published, for example
179+
# before an injected SDL step hung (see ../common/checkForArtifact.ts)
180+
- script: >-
181+
node build/azure-pipelines/common/checkForArtifact.ts
182+
CLI_PUBLISHED vscode_cli_darwin_$(VSCODE_ARCH)_cli
183+
env:
184+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
185+
continueOnError: true
186+
displayName: Check for artifacts published by an earlier attempt

‎build/azure-pipelines/darwin/product-build-darwin-universal.yml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@ jobs:
1111
targetPath: $(Build.ArtifactStagingDirectory)/out/vscode_client_darwin_$(VSCODE_ARCH)_archive/VSCode-darwin-universal.zip
1212
artifactName: vscode_client_darwin_$(VSCODE_ARCH)_archive
1313
displayName: Publish client archive
14+
condition: and(succeeded(), ne(variables['CLIENT_ARCHIVE_PUBLISHED'], 'true'))
1415
sbomBuildDropPath: $(Build.ArtifactStagingDirectory)/VSCode-darwin-$(VSCODE_ARCH)
1516
sbomPackageName: "VS Code macOS $(VSCODE_ARCH)"
1617
sbomPackageVersion: $(Build.SourceVersion)
1718
- output: pipelineArtifact
1819
targetPath: $(Build.ArtifactStagingDirectory)/out/vscode_client_darwin_$(VSCODE_ARCH)_dmg/VSCode-darwin-$(VSCODE_ARCH).dmg
1920
artifactName: vscode_client_darwin_$(VSCODE_ARCH)_dmg
2021
displayName: Publish client DMG
22+
condition: and(succeeded(), ne(variables['CLIENT_DMG_PUBLISHED'], 'true'))
2123
sbomBuildDropPath: $(Build.ArtifactStagingDirectory)/VSCode-darwin-$(VSCODE_ARCH)
2224
sbomPackageName: "VS Code macOS $(VSCODE_ARCH)"
2325
sbomPackageVersion: $(Build.SourceVersion)
@@ -211,3 +213,15 @@ jobs:
211213
mkdir -p $(Build.ArtifactStagingDirectory)/out/vscode_client_darwin_$(VSCODE_ARCH)_dmg
212214
mv $(DMG_PATH) $(Build.ArtifactStagingDirectory)/out/vscode_client_darwin_$(VSCODE_ARCH)_dmg/VSCode-darwin-$(VSCODE_ARCH).dmg
213215
displayName: Move artifact to out directory
216+
217+
# Pipeline artifacts can't be overwritten, so a retry of this job must skip
218+
# the artifacts that an earlier attempt already published, for example
219+
# before an injected SDL step hung (see ../common/checkForArtifact.ts)
220+
- script: >-
221+
node build/azure-pipelines/common/checkForArtifact.ts
222+
CLIENT_ARCHIVE_PUBLISHED vscode_client_darwin_$(VSCODE_ARCH)_archive
223+
CLIENT_DMG_PUBLISHED vscode_client_darwin_$(VSCODE_ARCH)_dmg
224+
env:
225+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
226+
continueOnError: true
227+
displayName: Check for artifacts published by an earlier attempt

‎build/azure-pipelines/darwin/product-build-darwin.yml‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ jobs:
3636
displayName: Publish compilation artifact
3737
sbomEnabled: false
3838
isProduction: false
39+
condition: and(succeeded(), ne(variables['COMPILATION_PUBLISHED'], 'true'))
3940
- output: pipelineArtifact
4041
targetPath: $(Build.SourcesDirectory)/.build/agent-sdk/tarballs
4142
artifactName: agent_sdk_darwin_$(VSCODE_ARCH)_tarballs
4243
displayName: Publish agent SDK tarballs
4344
sbomEnabled: false
44-
condition: and(succeededOrFailed(), eq(variables['AGENT_SDK_TARBALLS_PRODUCED'], 'true'))
45+
condition: and(succeededOrFailed(), eq(variables['AGENT_SDK_TARBALLS_PRODUCED'], 'true'), ne(variables['AGENT_SDK_TARBALLS_PUBLISHED'], 'true'))
4546
steps:
4647
- template: ./steps/product-build-darwin-compile.yml@self
4748
parameters:
@@ -68,6 +69,19 @@ jobs:
6869
out-build
6970
displayName: Archive out-build
7071
72+
# Pipeline artifacts can't be overwritten, so a retry of this job must skip
73+
# the artifacts that an earlier attempt already published, for example
74+
# before an injected SDL step hung (see ../common/checkForArtifact.ts)
75+
- script: >-
76+
node build/azure-pipelines/common/checkForArtifact.ts
77+
COMPILATION_PUBLISHED compilation_darwin_$(VSCODE_ARCH)
78+
AGENT_SDK_TARBALLS_PUBLISHED agent_sdk_darwin_$(VSCODE_ARCH)_tarballs
79+
env:
80+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
81+
condition: succeededOrFailed()
82+
continueOnError: true
83+
displayName: Check for artifacts published by an earlier attempt
84+
7185
# Signing needs the ESRP connection, which the SDK validation pipeline
7286
# (sdk-validation-build.yml) must not reference.
7387
- ${{ if eq(parameters.VSCODE_PRIVILEGED_CONNECTIONS, true) }}:

‎build/azure-pipelines/linux/product-build-linux-cli.yml‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ jobs:
3434
targetPath: $(Build.ArtifactStagingDirectory)/vscode_cli_linux_$(VSCODE_ARCH)_cli.tar.gz
3535
artifactName: vscode_cli_linux_$(VSCODE_ARCH)_cli
3636
displayName: Publish vscode_cli_linux_$(VSCODE_ARCH)_cli artifact
37+
condition: and(succeeded(), ne(variables['CLI_PUBLISHED'], 'true'))
3738
sbomBuildDropPath: $(Build.ArtifactStagingDirectory)/cli
3839
sbomPackageName: "VS Code Linux $(VSCODE_ARCH) CLI"
3940
sbomPackageVersion: $(Build.SourceVersion)
@@ -42,6 +43,7 @@ jobs:
4243
targetPath: $(Build.ArtifactStagingDirectory)/unsigned_copilot_shim_linux_$(VSCODE_ARCH).tar.gz
4344
artifactName: unsigned_copilot_shim_linux_$(VSCODE_ARCH)
4445
displayName: Publish unsigned Copilot shim
46+
condition: and(succeeded(), ne(variables['COPILOT_SHIM_PUBLISHED'], 'true'))
4547
sbomEnabled: false
4648
steps:
4749
- template: ../common/checkout.yml@self
@@ -185,3 +187,16 @@ jobs:
185187

186188
- ${{ if eq(parameters.VSCODE_ARCH, 'x64') }}:
187189
- template: ../copilot-shim/copilot-shim-quality.yml@self
190+
191+
- ${{ if not(parameters.VSCODE_CHECK_ONLY) }}:
192+
# Pipeline artifacts can't be overwritten, so a retry of this job must skip
193+
# the artifacts that an earlier attempt already published, for example
194+
# before an injected SDL step hung (see ../common/checkForArtifact.ts)
195+
- script: >-
196+
node build/azure-pipelines/common/checkForArtifact.ts
197+
CLI_PUBLISHED vscode_cli_linux_$(VSCODE_ARCH)_cli
198+
COPILOT_SHIM_PUBLISHED unsigned_copilot_shim_linux_$(VSCODE_ARCH)
199+
env:
200+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
201+
continueOnError: true
202+
displayName: Check for artifacts published by an earlier attempt

‎build/azure-pipelines/linux/product-build-linux.yml‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,13 @@ jobs:
5353
displayName: Publish compilation artifact
5454
sbomEnabled: false
5555
isProduction: false
56+
condition: and(succeeded(), ne(variables['COMPILATION_PUBLISHED'], 'true'))
5657
- output: pipelineArtifact
5758
targetPath: $(Build.SourcesDirectory)/.build/agent-sdk/tarballs
5859
artifactName: agent_sdk_linux_$(VSCODE_ARCH)_tarballs
5960
displayName: Publish agent SDK tarballs
6061
sbomEnabled: false
61-
condition: and(succeededOrFailed(), eq(variables['AGENT_SDK_TARBALLS_PRODUCED'], 'true'))
62+
condition: and(succeededOrFailed(), eq(variables['AGENT_SDK_TARBALLS_PRODUCED'], 'true'), ne(variables['AGENT_SDK_TARBALLS_PUBLISHED'], 'true'))
6263
steps:
6364
- template: ./steps/product-build-linux-compile.yml@self
6465
parameters:
@@ -95,6 +96,19 @@ jobs:
9596
out-build
9697
displayName: Archive out-build
9798
99+
# Pipeline artifacts can't be overwritten, so a retry of this job must skip
100+
# the artifacts that an earlier attempt already published, for example
101+
# before an injected SDL step hung (see ../common/checkForArtifact.ts)
102+
- script: >-
103+
node build/azure-pipelines/common/checkForArtifact.ts
104+
COMPILATION_PUBLISHED compilation_linux_$(VSCODE_ARCH)
105+
AGENT_SDK_TARBALLS_PUBLISHED agent_sdk_linux_$(VSCODE_ARCH)_tarballs
106+
env:
107+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
108+
condition: succeededOrFailed()
109+
continueOnError: true
110+
displayName: Check for artifacts published by an earlier attempt
111+
98112
# Signing needs the ESRP connection, which the SDK validation pipeline
99113
# (sdk-validation-build.yml) must not reference.
100114
- ${{ if eq(parameters.VSCODE_PRIVILEGED_CONNECTIONS, true) }}:

‎build/azure-pipelines/web/product-build-web.yml‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
targetPath: $(Build.ArtifactStagingDirectory)/out/web/vscode-web.tar.gz
2020
artifactName: vscode_web_linux_standalone_archive-unsigned
2121
displayName: Publish web archive
22+
condition: and(succeeded(), ne(variables['WEB_ARCHIVE_PUBLISHED'], 'true'))
2223
sbomBuildDropPath: $(Agent.BuildDirectory)/vscode-web
2324
sbomPackageName: "VS Code Linux x64 Web (Standalone)"
2425
sbomPackageVersion: $(Build.SourceVersion)
@@ -205,3 +206,14 @@ jobs:
205206
AZURE_ID_TOKEN="$(AZURE_ID_TOKEN)" \
206207
node build/azure-pipelines/upload-nlsmetadata.ts
207208
displayName: Upload NLS Metadata
209+
210+
# Pipeline artifacts can't be overwritten, so a retry of this job must skip
211+
# the artifacts that an earlier attempt already published, for example
212+
# before an injected SDL step hung (see ../common/checkForArtifact.ts)
213+
- script: >-
214+
node build/azure-pipelines/common/checkForArtifact.ts
215+
WEB_ARCHIVE_PUBLISHED vscode_web_linux_standalone_archive-unsigned
216+
env:
217+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
218+
continueOnError: true
219+
displayName: Check for artifacts published by an earlier attempt

‎build/azure-pipelines/win32/product-build-win32.yml‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,13 @@ jobs:
4848
displayName: Publish compilation artifact
4949
sbomEnabled: false
5050
isProduction: false
51+
condition: and(succeeded(), ne(variables['COMPILATION_PUBLISHED'], 'true'))
5152
- output: pipelineArtifact
5253
targetPath: $(Build.SourcesDirectory)/.build/agent-sdk/tarballs
5354
artifactName: agent_sdk_win32_$(VSCODE_ARCH)_tarballs
5455
displayName: Publish agent SDK tarballs
5556
sbomEnabled: false
56-
condition: and(succeededOrFailed(), eq(variables['AGENT_SDK_TARBALLS_PRODUCED'], 'true'))
57+
condition: and(succeededOrFailed(), eq(variables['AGENT_SDK_TARBALLS_PRODUCED'], 'true'), ne(variables['AGENT_SDK_TARBALLS_PUBLISHED'], 'true'))
5758
sdl:
5859
suppression:
5960
suppressionFile: $(Build.SourcesDirectory)\.config\guardian\.gdnsuppress
@@ -87,6 +88,19 @@ jobs:
8788
exec { 7z.exe a -mx1 "$(Build.ArtifactStagingDirectory)\compilation\out-build.7z" "out-build" }
8889
displayName: Archive out-build
8990
91+
# Pipeline artifacts can't be overwritten, so a retry of this job must skip
92+
# the artifacts that an earlier attempt already published, for example
93+
# before an injected SDL step hung (see ../common/checkForArtifact.ts)
94+
- script: >-
95+
node build/azure-pipelines/common/checkForArtifact.ts
96+
COMPILATION_PUBLISHED compilation_win32_$(VSCODE_ARCH)
97+
AGENT_SDK_TARBALLS_PUBLISHED agent_sdk_win32_$(VSCODE_ARCH)_tarballs
98+
env:
99+
SYSTEM_ACCESSTOKEN: $(System.AccessToken)
100+
condition: succeededOrFailed()
101+
continueOnError: true
102+
displayName: Check for artifacts published by an earlier attempt
103+
90104
# Signing needs the ESRP connection, which the SDK validation pipeline
91105
# (sdk-validation-build.yml) must not reference.
92106
- ${{ if eq(parameters.VSCODE_PRIVILEGED_CONNECTIONS, true) }}:

0 commit comments

Comments
 (0)