Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/build/azure-pipelines/common/checkForArtifact.js
3520 views
1
"use strict";
2
Object.defineProperty(exports, "__esModule", { value: true });
3
/*---------------------------------------------------------------------------------------------
4
* Copyright (c) Microsoft Corporation. All rights reserved.
5
* Licensed under the MIT License. See License.txt in the project root for license information.
6
*--------------------------------------------------------------------------------------------*/
7
const publish_1 = require("./publish");
8
const retry_1 = require("./retry");
9
async function getPipelineArtifacts() {
10
const result = await (0, publish_1.requestAZDOAPI)('artifacts');
11
return result.value.filter(a => !/sbom$/.test(a.name));
12
}
13
async function main([variableName, artifactName]) {
14
if (!variableName || !artifactName) {
15
throw new Error(`Usage: node checkForArtifact.js <variableName> <artifactName>`);
16
}
17
try {
18
const artifacts = await (0, retry_1.retry)(() => getPipelineArtifacts());
19
const artifact = artifacts.find(a => a.name === artifactName);
20
console.log(`##vso[task.setvariable variable=${variableName}]${artifact ? 'true' : 'false'}`);
21
}
22
catch (err) {
23
console.error(`ERROR: Failed to get pipeline artifacts: ${err}`);
24
console.log(`##vso[task.setvariable variable=${variableName}]false`);
25
}
26
}
27
main(process.argv.slice(2))
28
.then(() => {
29
process.exit(0);
30
}, err => {
31
console.error(err);
32
process.exit(1);
33
});
34
//# sourceMappingURL=checkForArtifact.js.map
35