-
Notifications
You must be signed in to change notification settings - Fork 75
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
Define termination milestones for suspending & saving #301
Conversation
@@ -238,7 +253,9 @@ public void onFailure(@NonNull Throwable t) { | |||
} | |||
|
|||
@Restricted(DoNotUse.class) | |||
@Terminator public static void saveAll() throws InterruptedException { | |||
@SuppressWarnings("deprecation") | |||
@Terminator(requires = EXECUTIONS_SUSPENDED, attains = LIST_SAVED) |
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.
One thing I just thought about: if you have workflow-api
installed but not workflow-cps
, is the reactor smart enough to see that nothing attains EXECUTIONS_SUSPENDED
and still allow this to run? Or does it block (bad), or get skipped (fine since you won't have any executions anyway)?
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.
is the reactor smart enough to see that nothing attains
EXECUTIONS_SUSPENDED
and still allow this to run?
I wondered the same, but actually you can see from the fact that tests in this plugin pass that it is OK: it just considers EXECUTIONS_SUSPENDED
to have attained immediately.
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.
actually you can see from the fact that tests in this plugin pass that it is OK
Yeah I suspected that was the case, but wanted to make sure.
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.
(Not the same scenario as you mention, but similar, since the workflow-cps
in test scope of course predates the code that would attain this milestone.)
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.
Example:
diff --git src/test/java/org/jenkinsci/plugins/workflow/actions/ErrorActionTest.java src/test/java/org/jenkinsci/plugins/workflow/actions/ErrorActionTest.java
index 53d4dd1..9d99c10 100644
--- src/test/java/org/jenkinsci/plugins/workflow/actions/ErrorActionTest.java
+++ src/test/java/org/jenkinsci/plugins/workflow/actions/ErrorActionTest.java
@@ -79,6 +79,7 @@ public class ErrorActionTest {
@Test
public void simpleException() throws Throwable {
rr.then(r -> {
+ System.setProperty("jenkins.model.Jenkins.termLogLevel", "INFO");
final String EXPECTED = "For testing purpose";
WorkflowJob job = r.jenkins.createProject(WorkflowJob.class, "p");
job.setDefinition(new CpsFlowDefinition(String.format(
⇒
INFO hudson.lifecycle.Lifecycle#onStatusUpdate: Stopping Jenkins
INFO jenkins.model.Jenkins$16#onAttained: Attained FlowExecutionList.EXECUTIONS_SUSPENDED
INFO jenkins.model.Jenkins$16#onAttained: Attained Started termination
INFO jenkins.model.Jenkins$16#onTaskStarted: Started SCMEvent.closeExecutorService
INFO jenkins.model.Jenkins$16#onTaskCompleted: Completed SCMEvent.closeExecutorService
INFO jenkins.model.Jenkins$16#onTaskStarted: Started FlowExecutionList.saveAll
INFO jenkins.model.Jenkins$16#onTaskCompleted: Completed FlowExecutionList.saveAll
INFO jenkins.model.Jenkins$16#onAttained: Attained FlowExecutionList.LIST_SAVED
INFO jenkins.model.Jenkins$16#onTaskStarted: Started NioChannelSelector.cleanUp
INFO jenkins.model.Jenkins$16#onTaskCompleted: Completed NioChannelSelector.cleanUp
INFO jenkins.model.Jenkins$16#onTaskStarted: Started CpsFlowExecution.suspendAll
INFO jenkins.model.Jenkins$16#onTaskCompleted: Completed CpsFlowExecution.suspendAll
INFO jenkins.model.Jenkins$16#onTaskStarted: Started DurableTaskStep.shutDownThreadPool
INFO jenkins.model.Jenkins$16#onTaskCompleted: Completed DurableTaskStep.shutDownThreadPool
INFO jenkins.model.Jenkins$16#onTaskStarted: Started IOHubProvider.cleanUp
INFO jenkins.model.Jenkins$16#onTaskCompleted: Completed IOHubProvider.cleanUp
INFO jenkins.model.Jenkins$16#onAttained: Attained Completed termination
INFO hudson.lifecycle.Lifecycle#onStatusUpdate: Jenkins stopped
Downstream use in
workflow-cps
coming soon. Also see jenkinsci/workflow-job-plugin#375.