diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index b8259cf..79b6849 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -11,11 +11,11 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 8 - uses: actions/setup-java@v2 + - uses: actions/checkout@v4 + - name: Set up JDK 21 + uses: actions/setup-java@v4 with: - java-version: '8' + java-version: '21' distribution: 'adopt' - name: Grant execute permission for gradlew run: chmod +x gradlew diff --git a/build.gradle b/build.gradle index de6cf0c..996e99d 100644 --- a/build.gradle +++ b/build.gradle @@ -16,9 +16,11 @@ sourceSets { } } -sourceCompatibility = 1.8 +java { + sourceCompatibility = JavaVersion.VERSION_17 +} -project.buildDir = 'target' +project.layout.buildDirectory = 'target' repositories { mavenCentral() @@ -31,31 +33,32 @@ dependencies { // mandatory dependencies for using Spock // note: please use same Groovy version as on Jenkins - implementation "org.codehaus.groovy:groovy-all:2.4.12" + implementation "org.codehaus.groovy:groovy-all:2.4.21" implementation "com.cloudbees:groovy-cps:1.31@jar", withoutIcu - implementation "org.jenkins-ci.main:jenkins-core:2.225", withoutIcu - implementation "org.jenkins-ci.plugins:badge:1.8@jar" + implementation "org.jenkins-ci.main:jenkins-core:2.452", withoutIcu + implementation "org.jenkins-ci.plugins:badge:1.13@jar" implementation "org.jenkins-ci.plugins:pipeline-maven:3.9.3@jar" // dependency for MavenReport implementation "org.jenkins-ci.plugins:credentials-binding:1.27.1@jar" - implementation "org.slf4j:jcl-over-slf4j:1.7.25" - testImplementation "org.slf4j:log4j-over-slf4j:1.7.25" - testImplementation "org.slf4j:slf4j-api:1.7.25" + implementation "org.slf4j:jcl-over-slf4j:2.0.13" + testImplementation "org.slf4j:log4j-over-slf4j:2.0.13" + testImplementation "org.slf4j:slf4j-api:2.0.12" - testImplementation "ch.qos.logback:logback-core:1.2.3" - testImplementation "ch.qos.logback:logback-classic:1.2.3" - testImplementation "com.google.guava:guava:20.0" + testImplementation "ch.qos.logback:logback-core:1.5.6" + testImplementation "ch.qos.logback:logback-classic:1.5.6" + testImplementation "com.google.guava:guava:33.2.1-jre" - testImplementation "org.spockframework:spock-core:1.3-groovy-2.4@jar" + testImplementation "org.codehaus.groovy:groovy-all:3.0.21" + testImplementation "org.spockframework:spock-core:2.3-groovy-3.0@jar" // Jenkins Pipeline Unit + JUnit 4 testImplementation "com.lesfurets:jenkins-pipeline-unit:1.13" - testImplementation "org.assertj:assertj-core:3.22.0" + testImplementation "org.assertj:assertj-core:3.26.0" // Jenkins related - testImplementation "com.homeaway.devtools.jenkins:jenkins-spock:2.1.4" - testImplementation "javax.servlet:javax.servlet-api:3.1.0" - testImplementation "org.jenkins-ci.main:jenkins-core:2.225", withoutIcu + testImplementation "com.homeaway.devtools.jenkins:jenkins-spock:2.1.5" + testImplementation "javax.servlet:javax.servlet-api:4.0.1" + testImplementation "org.jenkins-ci.main:jenkins-core:2.452", withoutIcu testImplementation "org.jenkins-ci.plugins.workflow:workflow-api:2.40@jar" testImplementation "org.jenkins-ci.plugins.workflow:workflow-step-api:2.22@jar" testImplementation "org.jenkins-ci.plugins.workflow:workflow-cps:2.78@jar" @@ -72,9 +75,9 @@ dependencies { // this is needed for spock to find all the source code in the var directory task copyGlobalLibVars (type: Copy) { - from "$rootDir/vars" + from layout.projectDirectory.dir("vars") include '**/*.groovy' - into "$buildDir/classes/vars" + into layout.buildDirectory.dir("classes/vars") } compileTestGroovy { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6c9a224..0d18421 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.6-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/jenkins/docker-compose.yaml b/jenkins/docker-compose.yaml index 06d37b2..015d008 100644 --- a/jenkins/docker-compose.yaml +++ b/jenkins/docker-compose.yaml @@ -5,8 +5,8 @@ services: privileged: true user: root ports: - - 8081:8080 - - 50000:50000 + - "8081:8080" + - "50000:50000" container_name: jenkins volumes: - ~/jenkins:/var/jenkins_home diff --git a/test/groovy/util/Result.groovy b/test/groovy/util/Result.groovy index c7db8d9..382c294 100644 --- a/test/groovy/util/Result.groovy +++ b/test/groovy/util/Result.groovy @@ -7,7 +7,7 @@ class Result { def Result() {} - def int status() { + int status() { return status } } \ No newline at end of file diff --git a/test/groovy/vars/KustomizeTest.groovy b/test/groovy/vars/KustomizeTest.groovy index f6f68d1..c3f184d 100644 --- a/test/groovy/vars/KustomizeTest.groovy +++ b/test/groovy/vars/KustomizeTest.groovy @@ -1,7 +1,7 @@ package groovy.vars import static com.lesfurets.jenkins.unit.MethodCall.callArgsToString -import static org.assertj.core.api.Assertions.*; +import static org.assertj.core.api.Assertions.* import com.lesfurets.jenkins.unit.BasePipelineTest import org.junit.Before @@ -9,7 +9,7 @@ import org.junit.Test class KustomizeTest extends BasePipelineTest { - Script kustomize; + Script kustomize @Before @Override