Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// 'system.debug': true,
// 'agent.diagnostic': true,
}
)
}, config.azureDevops.project);
for (let i = 0; i < config.azureDevops.retries; i++) {
await sleep(config.azureDevops.retryIntervalStep * (i + 1));
build = await buildApi.getBuild(config.azureDevops.project, build.id);
let statusName = BuildStatusEnum.getKeyOrThrow(build.status);
let resultName = typeof build.result === 'undefined'
? 'undefined'
: BuildResultEnum.getKeyOrThrow(build.result);
console.log(`status: ${statusName}, result: ${resultName}`);
switch (build.status) {
case BuildStatus.Completed:
case BuildStatus.Cancelling:
case BuildStatus.Postponed:
return build;
case BuildStatus.None:
case BuildStatus.InProgress:
case BuildStatus.NotStarted:
break;
default:
throw new Error(`Unknown build status ${build.status}`);
}
}
};
async checkBuildPipelines() {
logger.info(`[id=${this.release.id}] [build_id=${this.release.build_id}] check build pipelines`);
for (let i = 0; i < config.azureDevops.check.retries; i++) {
let build = await this.buildApi.getBuild(config.azureDevops.project, this.release.build_id);
let statusName = BuildStatusEnum.getKeyOrThrow(build.status);
let resultName = typeof build.result === 'undefined'
? 'undefined'
: BuildResultEnum.getKeyOrThrow(build.result);
logger.info(`[id=${this.release.id}] [build_id=${this.release.build_id}] status ${statusName}, result ${resultName}, retries ${i}`);
if (build.status == BuildStatus.Completed || build.status == BuildStatus.Cancelling)
return build;
await sleep(config.azureDevops.check.retryIntervalStep * (i + 1));
}
return null;
}