Skip to content
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

Improved StepExecutions, available outside test scope #149

Merged
merged 1 commit into from Jan 18, 2024

Conversation

jglick
Copy link
Member

@jglick jglick commented Jan 18, 2024

I found myself using the StepExecutions utility a lot in jenkinsci/workflow-cps-plugin#834 but there were some limitations that made it awkward:

  • You needed to return null; even for synchronous steps which were not designed to return a value (the most common case), forcing use of a block-form lambda even for bodies consisting of a single statement.
  • The requirement that the body lambda be Serializable made for some awkward idioms. This was never productive since the body is used only in StepExecution.start, so even if the execution gets serialized, there is never a reason to deserialize the body.

After making those improvements I realized that the utility could actually be useful for production code, so opening it up outside of test scope. (Not helpful for existing steps since these need to retain serial form compatibility of the StepExecution implementation, except perhaps in the case of SynchronousStepExecutions.)

@jglick jglick requested a review from a team as a code owner January 18, 2024 16:39
jglick added a commit to jglick/workflow-cps-plugin that referenced this pull request Jan 18, 2024
@jglick jglick merged commit 03be811 into jenkinsci:master Jan 18, 2024
14 checks passed
@jglick jglick deleted the StepExecutions branch January 18, 2024 17:04
jglick added a commit to jglick/workflow-cps-plugin that referenced this pull request Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants