Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
cm.banner("Build Artifact Samples");
const project = cm.getProject();
console.log("project", project);
// get the latest successful build.
cm.heading(`Get latest successful build for ${project} project`);
const builds: bi.Build[] = await vstsBuild.getBuilds(
project,
null, // definitions: number[]
null, // queues: number[]
null, // buildNumber
null, //new Date(2016, 1, 1), // minFinishTime
null, // maxFinishTime
null, // requestedFor: string
bi.BuildReason.All, // reason
bi.BuildStatus.Completed,
bi.BuildResult.Succeeded,
null, // tagFilters: string[]
null, // properties: string[]
//bi.DefinitionType.Build,
1 // top: number
);
if (builds.length > 0) {
const latestBuild: bi.Build = builds[0];
console.log(`build ${latestBuild.id}`);
// Retrieve the list of artifacts for the latest build.
cm.heading(`Artifacts for build ${latestBuild.id}, ${project} project`);
const artifacts: bi.BuildArtifact[] = await vstsBuild.getArtifacts(project, latestBuild.id);