Define termination milestones for suspending & saving#301
Define termination milestones for suspending & saving#301jglick merged 1 commit intojenkinsci:masterfrom
Conversation
| @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.
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.
is the reactor smart enough to see that nothing attains
EXECUTIONS_SUSPENDEDand 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.
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.
(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.
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-cpscoming soon. Also see jenkinsci/workflow-job-plugin#375.