-
Notifications
You must be signed in to change notification settings - Fork 8
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
Jenkinsfile is not overwritten #52
Comments
Thanks for reporting your issue here and offer to help! I've had a quick look, adding some diagnostics from the serialized LST manifest.csv:
I don't yet know what's going on; especially since you're reporting the same issue locally. 🤔 I had thought there might be a parse issue, but from the above that does not immediately seem the case. |
Gave it a go here as well just now; seeing the same behaviour, and can trace that back to how the recipe is implemented: rewrite-jenkins/src/main/resources/META-INF/rewrite/rewrite.yml Lines 53 to 70 in 8914ccd
The recipe right now does not override files of a different type, as evidenced by this failing test: @Test
void shouldOverrideExisting() {
String after = """
/*
See the documentation for more options:
https://github.com/jenkins-infra/pipeline-library/
*/
buildPlugin(
useContainerAgent: true, // Set to `false` if you need to use Docker for containerized tests
configurations: [
[platform: 'linux', jdk: 21],
[platform: 'windows', jdk: 17],
])
""";
rewriteRun(
spec -> spec.recipe(new CreateTextFile(after, "Jenkinsfile", true)),
groovy(
"""
#!groovy
buildPlugin()
""",
after,
spec -> spec.path("Jenkinsfile")
)
);
} I'll see if I can fix that in OpenRewrite/rewrite itself |
Picked up in The problem is a side effect of now parsing Jenkinsfiles as Groovy rather than PlainText that we did before. Thanks for bringing this to our attention! |
The underlying issue has been fixed, and should roll out to our snapshot versions soon. We deploy the latest changes to app.moderne.io such that it should be usable for the next batch of projects again. I see you've already made the required changes to your jdk-21-prerequisites-and-powermock branch, such that I think we don't have to expedite a deploy & release, right? Thanks again for pointing out this issue! |
That's right, @timtebeek , but I will try it on other repositories. |
What version of OpenRewrite are you using?
I'm using it through Moderne.io, so I don't know, sorry.
How are you running OpenRewrite?
I'm using Moderne.io.
I don't think you will be able to see the results, but I used my latest recipe of recipes that gave: https://app.moderne.io/results/Dm3ZuYTUW
The plugin I tried this on is multibranch-scan-webhook-trigger-plugin.
You can see the first commit there: jenkinsci/multibranch-scan-webhook-trigger-plugin@fde4557
You can replay the recipe of recipes here: https://app.moderne.io/recipes/builder/j0daJWhoh?organizationId=SmVua2lucyBDSQ%3D%3D .
What is the smallest, simplest way to reproduce the problem?
Re-run the recipe.
A friend of mine tried only the modernize Jenkinsfile on his machine with the same project thanks to the maven command, and it failed to change the file too.
Once the file was deleted, the recipe created the file correctly.
What did you expect to see?
Well, at least a rewritten Jenkinsfile, even if the complexity of the Jenkinsfile was lost (some of them are not just
buildplugin()
, but lots of instructions like in https://raw.githubusercontent.com/jenkinsci/kubernetes-plugin/master/Jenkinsfile.What did you see instead?
Nothing, until we deleted the local Jenkinsfile.
What is the full stack trace of any errors you encountered?
No error.
Are you interested in [contributing a fix to OpenRewrite]
I'd love to contribute if possible. While I may not have all the required skills, I'm enthusiastic about the project and willing to learn.
The text was updated successfully, but these errors were encountered: