From a2d81482f5acf72d726b1c360c447bd163508625 Mon Sep 17 00:00:00 2001 From: Pritam Paul Date: Fri, 31 Jan 2020 15:59:57 -0500 Subject: [PATCH] feat: Add some logging to periodic builds (#80) --- index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index edbbd76..595972a 100644 --- a/index.js +++ b/index.js @@ -234,7 +234,6 @@ class ExecutorQueue extends Executor { if (!err && response.statusCode === 201) { return resolve(response); } - if (response.statusCode !== 201) { return reject(JSON.stringify(response.body)); } @@ -290,7 +289,7 @@ class ExecutorQueue extends Executor { * @return {Promise} */ async _startPeriodic(config) { - const { job, tokenGen, isUpdate, triggerBuild } = config; + const { pipeline, job, tokenGen, isUpdate, triggerBuild } = config; // eslint-disable-next-line max-len const buildCron = hoek.reach(job, 'permutations>0>annotations>screwdriver.cd/buildPeriodically', { separator: '>' }); @@ -312,7 +311,8 @@ class ExecutorQueue extends Executor { try { await this.postBuildEvent(config); } catch (err) { - logger.error(`failed to post build event for job ${job.id}: ${err}`); + logger.error('periodic builds: failed to post build event for job' + + `${job.id} in pipeline ${pipeline.id}: ${err}`); } } @@ -396,7 +396,8 @@ class ExecutorQueue extends Executor { return this.postBuildEvent(newConfig) .catch((err) => { - logger.error(`failed to post build event for job ${config.jobId}: ${err}`); + logger.error('frozen builds: failed to post build event for job' + + `${config.jobId}:${config.pipeline.id} ${err}`); return Promise.resolve(); });