Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What's changed?
Added a few examples (as ignored tests) that new recipes may be able to refactor.
What's your motivation?
Exploring ways to be more specific in refactoring
Jenkinsfile
.The Jenkins project recently announced the ability to test on JDK 21, but it requires a change to the project's
Jenkinsfile
.Since Java is changing faster than ever before, it'd be great to automate this.
An example is in jenkinsci/commons-text-api-plugin#41.
Anything in particular you'd like reviewers to focus on?
What are the steps involved in parsing a
Jenkinsfile
as groovy?This is a bit different than regular groovy in that a shared library defining possible functions is automatically imported by the Jenkins controller. Jenkins admins can define what shared libraries are imported on each controller, and whether or not it's implicit, so it can be very difficult to discover which functions are available on a given controller.
The definition of
buildPlugin()
, which I focus on here, is available in OSS.Have you considered any alternatives or workarounds?
The current recipe to modernize a Jenkinsfile does text replacement. It works, but it's very opinionated. Open to other alternatives.