Skip to content

Commit

Permalink
Adds java 21 support
Browse files Browse the repository at this point in the history
  • Loading branch information
RetGal committed Jul 30, 2024
1 parent 73e9ea0 commit e78426b
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 31 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 21 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,11 @@ sourceSets {
}
}

sourceCompatibility = 1.8
java {
sourceCompatibility = JavaVersion.VERSION_17
}

project.buildDir = 'target'
project.layout.buildDirectory = 'target'

repositories {
mavenCentral()
Expand All @@ -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"
Expand All @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions jenkins/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/groovy/util/Result.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Result {

def Result() {}

def int status() {
int status() {
return status
}
}
4 changes: 2 additions & 2 deletions test/groovy/vars/KustomizeTest.groovy
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
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
import org.junit.Test

class KustomizeTest extends BasePipelineTest {

Script kustomize;
Script kustomize

@Before
@Override
Expand Down
2 changes: 1 addition & 1 deletion vars/cleanBuilds.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.jenkinsci.plugins.badge.action.BadgeAction
// the function implements how many build per environment should be kept
// parameter is maxKeepBuilds
def call(Map args) {
def maxNumberToKeepBuilds = args?.maxKeepBuilds ?: 10;
def maxNumberToKeepBuilds = args?.maxKeepBuilds ?: 10

def environmentBuildCount = [:]
Jenkins.instance.getItemByFullName(args.job)
Expand Down
4 changes: 2 additions & 2 deletions vars/openshiftUtils.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// credentialsId -> credentials for the OpenShift login
// namespace -> true adds NAMESPACE_NAME param
//
def void applyTemplate(String ocpUrl, String ocpProject, String templateFile, String credentialsId, boolean namespace) {
void applyTemplate(String ocpUrl, String ocpProject, String templateFile, String credentialsId, boolean namespace) {

echo "-- start resource update by template --"
echo "OpenShift server URL: $ocpUrl"
Expand Down Expand Up @@ -47,7 +47,7 @@ def void applyTemplate(String ocpUrl, String ocpProject, String templateFile, St
// envFile -> environment file
// namespace -> true adds NAMESPACE_NAME param
//
def void applyTemplateWithEnvFile(String ocpUrl, String ocpProject, String templateFile, String credentialsId, String envFile, boolean namespace) {
void applyTemplateWithEnvFile(String ocpUrl, String ocpProject, String templateFile, String credentialsId, String envFile, boolean namespace) {

echo "-- start resource update by template with environment file --"
echo "OpenShift server URL: $ocpUrl"
Expand Down

0 comments on commit e78426b

Please sign in to comment.