Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async tailBuildLog(appflowId: string, buildId: number, token: string): Promise {
let build;
let start = 0;
const ws = this.env.log.createWriteStream(LOGGER_LEVELS.INFO, false);
let isCreatedMessage = false;
while (!(build && (build.state === 'success' || build.state === 'failed'))) {
await sleep(5000);
build = await this.getPackageBuild(appflowId, buildId, token);
if (build && build.state === 'created' && !isCreatedMessage) {
ws.write(chalk.yellow('Concurrency limit reached: build will start as soon as other builds finish.'));
isCreatedMessage = true;
}
const trace = build.job.trace;
if (trace.length > start) {
ws.write(trace.substring(start));
start = trace.length;
}
}
ws.end();
return build;
}
async tailBuildLog(appflowId: string, buildId: number, token: string): Promise {
let build;
let start = 0;
const ws = this.env.log.createWriteStream(LOGGER_LEVELS.INFO, false);
let isCreatedMessage = false;
while (!(build && (build.state === 'success' || build.state === 'failed'))) {
await sleep(5000);
build = await this.getDeployBuild(appflowId, buildId, token);
if (build && build.state === 'created' && !isCreatedMessage) {
ws.write(chalk.yellow('Concurrency limit reached: build will start as soon as other builds finish.'));
isCreatedMessage = true;
}
const trace = build.job.trace;
if (trace.length > start) {
ws.write(trace.substring(start));
start = trace.length;
}
}
ws.end();
return build;
}