-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add support for parsing Groovy sources (incl. Jenkinsfiles) #662
Comments
Thanks for the reminder/suggestion @simonzn ! I've added a first commit to parse any file that starts with Jenkinsfile as Groovy in openrewrite/rewrite@7ed7222. The logic for which parsers to use in the rewrite-maven-plugin is here. rewrite-maven-plugin/src/main/java/org/openrewrite/maven/ResourceParser.java Lines 135 to 247 in 558223d
Would you be open to adding the GroovyParser in there as well? Even a draft PR would be fine to get this going. |
Thanks for your swift reply @timtebeek ! I meant to do that, but then I found #641 and realized there might be more to it. I can absolutely extend the |
Until the next release you can try out this change using our snapshot versions. Let me know how that works for you! :) |
I tested the snapshots with our Jenkinsfile recipes, everything works as expected now :-) Thanks a lot! |
What problem are you trying to solve?
We use Maven plugins for all CI tasks and would also like to run rewrite recipes for updating Jenkinsfiles through this plugin.
Describe the solution you'd like
The GroovyParser is already able to parse Jenkinsfiles, and I have tested it successfully with our pipelines. We would like the Maven plugin to parse Jenkinsfiles as Groovy sources by default instead of Quarks.
Currently the name must be "Jenkinsfile":
We have two pipelines in each repository, "Jenkinsfile" for building the project and "Jenkinsfile_Release" for releasing it. It is quite common to have some suffix for Jenkinsfiles, so we would like the GroovyParser to accept
Jenkinsfile*
(or maybe even*Jenkinsfile*
to support prefixes as well - although we don't use them).Have you considered any alternatives or workarounds?
Currently we execute text recipes on Jenkinsfiles by passing
-Drewrite.plainTextMasks="**/Jenkinsfile*,...
(otherwise they are only added as Quarks). This works for us for now, but may become limiting. Adding the GroovyParser would also mean we could use text recipes without modifying the plainTextMasks.The text was updated successfully, but these errors were encountered: