Skip to content

Commit 53a467e

Browse files
build time added to workflows (#289)
* build time added to workflows * update version
1 parent ddc2f52 commit 53a467e

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

lib/logic/api/workflow.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,18 @@ const endStatuses = ['error' , 'success' , 'terminated'];
99

1010
const _extractFieldsForWorkflowEntity = (workflow) => {
1111
const created = moment(workflow.created);
12+
const started = moment(workflow.started);
1213
const finished = moment(workflow.finished);
13-
const totalTime = moment.utc(finished.diff(created))
14-
.format('HH:mm:ss');
14+
const totalTime = moment.utc(finished.diff(created)).format('HH:mm:ss');
15+
const buildTime = workflow.started ? moment.utc(finished.diff(started)).format('HH:mm:ss') : undefined;
1516

1617
return {
1718
id: workflow.id,
1819
created: workflow.created ? new Date(workflow.created) : undefined,
1920
started: workflow.started ? new Date(workflow.started) : undefined,
2021
finished: workflow.finished ? new Date(workflow.finished) : undefined,
2122
totalTime,
23+
buildTime,
2224
status: workflow.status,
2325
'pipeline-name': workflow.serviceName,
2426
repository: `${workflow.repoOwner}/${workflow.repoName}`,

lib/logic/entities/Workflow.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ class Workflow extends Entity {
1616
'created',
1717
'started',
1818
'finished',
19+
'buildTime',
1920
'totalTime',
2021
'trigger',
2122
'repository',

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.14.0",
3+
"version": "0.14.1",
44
"description": "Codefresh command line utility",
55
"main": "index.js",
66
"preferGlobal": true,

0 commit comments

Comments
 (0)