Skip to content

Commit

Permalink
JENKINS-49019 Properly handle not executed pipeline status
Browse files Browse the repository at this point in the history
  • Loading branch information
tommysdk committed Jan 18, 2018
1 parent 97cac1c commit 2f1d244
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ static StatusType statusType(Stage currentStage) {
statusType = StatusType.RUNNING;
} else if (currentStage.status.equals("ABORTED")) {
statusType = StatusType.CANCELLED;
} else if (currentStage.status.equals("NOT_EXECUTED")) {
statusType = StatusType.NOT_BUILT;
} else {
statusType = StatusType.valueOf(currentStage.status);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import org.joda.time.DateTime;
import org.junit.Test;
import org.jvnet.hudson.test.Issue;
import se.diabol.jenkins.pipeline.domain.status.StatusType;
import se.diabol.jenkins.workflow.api.Stage;

Expand Down Expand Up @@ -57,6 +58,13 @@ public void stageWithAbortedStatusShouldYieldCancelledStatusType() throws Except
assertThat(WorkflowStatus.statusType(stageInProgress), is(StatusType.CANCELLED));
}

@Test
@Issue("JENKINS-49019")
public void stageWithNotExecutedStatusShouldYieldNotBuiltStatusType() throws Exception {
Stage stageInProgress = getStageWithStatus("NOT_EXECUTED");
assertThat(WorkflowStatus.statusType(stageInProgress), is(StatusType.NOT_BUILT));
}

@Test
public void stageWithFailedStatusShouldYieldFailedStatusType() throws Exception {
Stage failedStage = getStageWithStatus("FAILED");
Expand Down

0 comments on commit 2f1d244

Please sign in to comment.