Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class EtagBuilder {

public EtagBuilder add(PipelineRun run) {
checkAlreadyComputed();
if (run.result.isInProgress()) {
if (run.isBuilding()) {
producer = NOOP; // If we have an in-progress run, we cannot produce a valid ETag
} else {
producer.consume(run);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class PipelineRun {
private final long timestamp;
private final long duration;
private final int changesCount;
private final boolean building;

@NonNull
final PipelineState result;
Expand All @@ -31,7 +32,8 @@ public PipelineRun(WorkflowRun run) {
run.getTimeInMillis(),
run.getDuration(),
getChanges(run).size(),
PipelineState.of(run));
PipelineState.of(run),
run.isBuilding());
}

PipelineRun(
Expand All @@ -40,13 +42,19 @@ public PipelineRun(WorkflowRun run) {
long timestamp,
long duration,
int changesCount,
@NonNull PipelineState result) {
@NonNull PipelineState result,
boolean building) {
this.id = id;
this.displayName = displayName;
this.timestamp = timestamp;
this.duration = duration;
this.changesCount = changesCount;
this.result = result;
this.building = building;
}

public boolean isBuilding() {
return building;
}

public String etag() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
return NOT_BUILT;
} else if (result == Result.ABORTED) {
return ABORTED;
} else if (run.isInProgress()) {
} else if (run.isBuilding()) {

Check warning on line 40 in src/main/java/io/jenkins/plugins/pipelinegraphview/utils/PipelineState.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 40 is only partially covered, one branch is missing
return RUNNING;
} else {
return UNKNOWN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,15 @@
}

public PipelineStepList getSteps(String stageId) {
// Look up completed state before computing steps.
boolean runIsComplete = !PipelineState.of(run).isInProgress();
// Look up the completed state before computing steps.
boolean runIsComplete = !run.isBuilding();

Check warning on line 105 in src/main/java/io/jenkins/plugins/pipelinegraphview/utils/PipelineStepApi.java

View check run for this annotation

ci.jenkins.io / Code Coverage

Partially covered line

Line 105 is only partially covered, one branch is missing
return getSteps(stageId, CachedPipelineNodeGraphAdaptor.instance.getFor(run), runIsComplete);
}

/* Returns a PipelineStepList, sorted by stageId and Id. */
public PipelineStepList getAllSteps() {
// Look up completed state before computing steps.
boolean runIsComplete = !PipelineState.of(run).isInProgress();
// Look up the completed state before computing steps.
boolean runIsComplete = !run.isBuilding();
return getAllSteps(CachedPipelineNodeGraphAdaptor.instance.getFor(run), runIsComplete);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ public PipelineRunFactory(Clock clock) {
}

public PipelineRun succeeded(String id) {
return new PipelineRun(id, "Build " + id, currentTimeMillis(), 5_000, 3, PipelineState.SUCCESS);
return new PipelineRun(id, "Build " + id, currentTimeMillis(), 5_000, 3, PipelineState.SUCCESS, false);
}

public PipelineRun inProgress(String id) {
return new PipelineRun(id, "Build " + id, currentTimeMillis(), 0, 0, PipelineState.RUNNING);
return new PipelineRun(id, "Build " + id, currentTimeMillis(), 0, 0, PipelineState.RUNNING, true);
}

private long currentTimeMillis() {
Expand Down