-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Update a single InterruptedBuildAction
rather than creating a second one
#10610
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
exec.recordCauseOfInterruption(build, listener); | ||
})); | ||
FreeStyleBuild b = j.buildAndAssertStatus(Result.NOT_BUILT, p); | ||
assertThat(b.getActions(InterruptedBuildAction.class).stream().map(iba -> iba.getCauses().stream().map(CauseOfInterruption::getShortDescription).toList()).toList(), is(List.of(List.of("one", "two", "three", "four")))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without fix, fails with
java.lang.AssertionError:
Expected: is <[[one, two, three, four]]>
but: was <[[one, two], [three, four]]>
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6)
at hudson.model.ExecutorTest.recordCauseOfInterruption(ExecutorTest.java:245)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
/label ready-for-merge This PR is now ready for merge, after ~24 hours, we will merge it if there's no negative feedback. Thanks! |
As noted in jenkinsci/remoting#802, I saw a
build.xml
that had twoInterruptedBuildAction
s, each with one cause of interruption. The intention ofcauses
being a list was presumably that there would be one action enumerating all causes, though the current behavior may be harmless if all callers in fact are prepared to query multiple actions.jenkins/core/src/main/java/jenkins/model/queue/AsynchronousExecution.java
Line 76 in 60df855
recordCauseOfInterruption
may be called externally, which https://github.com/jenkinsci/workflow-job-plugin/blob/5e2896f2283418e36387d59fedc5a46f840a7668/src/main/java/org/jenkinsci/plugins/workflow/job/WorkflowRun.java#L405 in fact does.jenkins/core/src/main/java/hudson/model/Executor.java
Lines 235 to 238 in 60df855
Testing done
Automated test, though it is not terribly realistic since freestyle builds only call
recordCauseOfInterruption
once, injenkins/core/src/main/java/hudson/model/Run.java
Line 1855 in 60df855
Proposed changelog entries
Proposed changelog category
/label internal
Proposed upgrade guidelines
N/A
Before the changes are marked as
ready-for-merge
:Maintainer checklist
upgrade-guide-needed
label is set and there is a Proposed upgrade guidelines section in the pull request title (see example).lts-candidate
to be considered (see query).