Skip to content

Commit

Permalink
[FIXED JENKINS-33005] Make StageStepExecution defensively call isRead…
Browse files Browse the repository at this point in the history
…y on foreign builds.

Also make CpsFlowExecution.onLoad unconditionally set programPromise, in case CpsStepContext.getThreadGroupSynchronously is waiting for it.
Originally-Committed-As: 0b4c317b7bc610283be00fef18b796a43315454c
  • Loading branch information
jglick committed Feb 17, 2016
1 parent 5c34a41 commit 53ac56f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
Expand Up @@ -416,14 +416,21 @@ protected void initializeStorage() throws IOException {
@Override
public void onLoad(FlowExecutionOwner owner) throws IOException {
this.owner = owner;
initializeStorage();
try {
if (!isComplete())
loadProgramAsync(getProgramDataFile());
} catch (IOException e) {
SettableFuture<CpsThreadGroup> p = SettableFuture.create();
programPromise = p;
loadProgramFailed(e, p);
initializeStorage();
try {
if (!isComplete()) {
loadProgramAsync(getProgramDataFile());
}
} catch (IOException e) {
SettableFuture<CpsThreadGroup> p = SettableFuture.create();
programPromise = p;
loadProgramFailed(e, p);
}
} finally {
if (programPromise == null) {
programPromise = Futures.immediateFailedFuture(new IllegalStateException("completed or broken execution"));
}
}
}

Expand Down
Expand Up @@ -238,7 +238,7 @@ public String getDisplayName() {
ListenableFuture<CpsThreadGroup> pp;
CpsFlowExecution flowExecution = getFlowExecution();
while ((pp = flowExecution.programPromise) == null) {
Thread.sleep(100); // TODO why is this occasionally not set right away?
Thread.sleep(100); // TODO does JENKINS-33005 remove the need for this?
}
try {
threadGroup = pp.get();
Expand Down

0 comments on commit 53ac56f

Please sign in to comment.