Skip to content

Commit

Permalink
feat: Add some logging to periodic builds (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
pritamstyz4ever authored Jan 31, 2020
1 parent f8799e7 commit a2d8148
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down Expand Up @@ -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: '>' });
Expand All @@ -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}`);
}
}

Expand Down Expand Up @@ -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();
});
Expand Down

0 comments on commit a2d8148

Please sign in to comment.