Skip to content

Commit

Permalink
add timestamps to pipeline run result
Browse files Browse the repository at this point in the history
  • Loading branch information
mmorgantaylor committed Nov 21, 2024
1 parent 332e62b commit 10079ca
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion common/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -733,14 +733,18 @@ components:
description: |
Object containing the job id, status, and user-provided description of a Pipeline Run.
type: object
required: [ jobId, status ]
required: [ jobId, status, timeSubmitted ]
properties:
jobId:
$ref: '#/components/schemas/Id'
status:
$ref: "#/components/schemas/PipelineRunStatus"
description:
$ref: "#/components/schemas/PipelineRunDescription"
timeSubmitted:
$ref: "#/components/schemas/JobTimeSubmitted"
timeCompleted:
$ref: "#/components/schemas/JobTimeCompleted"

PipelineRunDescription:
description: |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,12 @@ public ResponseEntity<ApiGetPipelineRunsResponse> getAllPipelineRuns(
new ApiPipelineRun()
.jobId(pipelineRun.getJobId())
.status(pipelineRun.getStatus().name())
.description(pipelineRun.getDescription()))
.description(pipelineRun.getDescription())
.timeSubmitted(pipelineRun.getCreated().toString())
.timeCompleted(
pipelineRun.getStatus().isCompleted()
? pipelineRun.getUpdated().toString()
: null))
.toList();

ApiGetPipelineRunsResponse apiGetPipelineRunsResponse =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ public enum CommonPipelineRunStatusEnum {
public boolean isSuccess() {
return this == SUCCEEDED;
}

public boolean isCompleted() {
return this == SUCCEEDED || this == FAILED;
}
}

0 comments on commit 10079ca

Please sign in to comment.