Skip to content

Commit 5001297

Browse files
update wait workflows
1 parent 688516e commit 5001297

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

lib/logic/api/workflow.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ const CFError = require('cf-errors'); // eslint-disable-line
44
const { sendHttpRequest } = require('./helper');
55
const Workflow = require('../entities/Workflow');
66
const moment = require('moment');
7+
const endStatuses = ['error' , 'success' , 'terminated'];
78

89

910
const _extractFieldsForWorkflowEntity = (workflow) => {
@@ -72,6 +73,10 @@ const waitForStatus = async (workflowId, desiredStatus, timeoutDate, descriptive
7273
const workflow = await getWorkflowById(workflowId);
7374
const currentStatus = workflow.getStatus();
7475
if (currentStatus !== desiredStatus) {
76+
if (endStatuses.indexOf(currentStatus) !== -1) {
77+
console.log(`Build: ${workflowId} finished with status: ${currentStatus}`);
78+
process.exit(1);
79+
}
7580
if (descriptive) {
7681
console.log(`Workflow: ${workflowId} current status: ${currentStatus}`);
7782
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "codefresh",
3-
"version": "0.8.38",
3+
"version": "0.8.39",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)