diff --git a/src/main/resources/META-INF/rewrite/rewrite.yml b/src/main/resources/META-INF/rewrite/rewrite.yml
index d502465..d1389cf 100644
--- a/src/main/resources/META-INF/rewrite/rewrite.yml
+++ b/src/main/resources/META-INF/rewrite/rewrite.yml
@@ -58,10 +58,15 @@ recipeList:
relativeFileName: Jenkinsfile
overwriteExisting: true
fileContents: >
- buildPlugin(useContainerAgent: true, configurations: [
- [ platform: 'linux', jdk: '11' ],
- [ platform: 'windows', jdk: '11' ],
- [ platform: 'linux', jdk: '17' ],
+ /*
+ 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],
])
---
type: specs.openrewrite.org/v1beta/recipe
diff --git a/src/test/java/org/openrewrite/jenkins/ModernizeJenkinsfileTest.java b/src/test/java/org/openrewrite/jenkins/ModernizeJenkinsfileTest.java
index 5ccc9dc..d73af0e 100644
--- a/src/test/java/org/openrewrite/jenkins/ModernizeJenkinsfileTest.java
+++ b/src/test/java/org/openrewrite/jenkins/ModernizeJenkinsfileTest.java
@@ -32,7 +32,9 @@ public void defaults(RecipeSpec spec) {
@Test
void shouldCreateJenkinsfile() {
- rewriteRun(pomXml(
+ rewriteRun(
+ //language=xml
+ pomXml(
"""
@@ -54,19 +56,28 @@ void shouldCreateJenkinsfile() {
"""),
- text(null, """
- buildPlugin(useContainerAgent: true, configurations: [
- [ platform: 'linux', jdk: '11' ],
- [ platform: 'windows', jdk: '11' ],
- [ platform: 'linux', jdk: '17' ],
- ])""".stripIndent(),
+ //language=groovy
+ text(null,
+ """
+ /*
+ 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],
+ ])
+ """,
spec -> spec.path("Jenkinsfile")));
}
@Test
@DocumentExample
void shouldUpdateJenkinsfile() {
- rewriteRun(pomXml(
+ rewriteRun(
+ //language=xml
+ pomXml(
"""
@@ -87,17 +98,21 @@ void shouldUpdateJenkinsfile() {
- """),
- text("""
- buildPlugin()
- """.stripIndent(), """
- buildPlugin(useContainerAgent: true, configurations: [
- [ platform: 'linux', jdk: '11' ],
- [ platform: 'windows', jdk: '11' ],
- [ platform: 'linux', jdk: '17' ],
+ """
+ ),
+ //language=groovy
+ text("buildPlugin()",
+ """
+ /*
+ 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],
])
-
- """.stripIndent(),
- spec -> spec.path("Jenkinsfile")));
+ """,
+ spec -> spec.noTrim().path("Jenkinsfile")));
}
}