Skip to content

Commit 8710430

Browse files
committed
chore: use Java 21 for building sigstore-java
This change bumps JDK we use when building the project, and it is mainly to avoid known bugs in the toolchain. The resulting binaries should still be compatible with Java 11. At the same time, the commit skips "./gradlew test" checks for Java 11, and we still execute tests with Java 11 via conformance.yml. It would allow us to bump testing libraries as some of them require Java 17. Signed-off-by: Vladimir Sitnikov <[email protected]>
1 parent 331ac9f commit 8710430

File tree

8 files changed

+34
-24
lines changed

8 files changed

+34
-24
lines changed

.github/workflows/ci.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ jobs:
1919
build:
2020
strategy:
2121
matrix:
22-
java-version: [11, 17]
22+
# sigstore-java still supports Java 11, however, we test it with conformance-tests only
23+
java-version: [17, 21]
2324
fail-fast: false
2425

2526
concurrency:
@@ -39,10 +40,10 @@ jobs:
3940
- name: Set up JDK ${{ matrix.java-version }}
4041
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
4142
with:
42-
# We need Java 17 for the build, so we install it always
43+
# We need Java 21 for the build, so we install it always
4344
java-version: |
4445
${{ matrix.java-version }}
45-
17
46+
21
4647
distribution: 'temurin'
4748
- name: Setup Go environment
4849
uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
@@ -62,9 +63,9 @@ jobs:
6263

6364
- name: Ensure sigstore-java self signing still works
6465
if: ${{ !github.event.pull_request.head.repo.fork }}
65-
run: ./gradlew sigstore-java:publishToMavenLocal -Prelease -PskipPgpSigning
66+
run: ./gradlew -Porg.gradle.java.installations.auto-download=false sigstore-java:publishToMavenLocal -Prelease -PskipPgpSigning
6667

6768
- name: Test sigstore-java/sandbox
6869
run: |
6970
cd sandbox
70-
./gradlew build
71+
./gradlew -Porg.gradle.java.installations.auto-download=false build

.github/workflows/conformance.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
strategy:
1414
max-parallel: 1
1515
matrix:
16-
java-version: [11, 17]
16+
java-version: [11, 17, 21]
1717
sigstore-env: [production, staging]
1818
fail-fast: false
1919

@@ -30,21 +30,21 @@ jobs:
3030
with:
3131
persist-credentials: false
3232

33-
- name: Set up JDK 17
33+
- name: Set up JDK 21
3434
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
3535
with:
36-
java-version: 17
36+
java-version: 21
3737
distribution: 'temurin'
3838

3939
- name: Setup Gradle
4040
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
4141

4242
- name: Build sigstore-java cli and server jar
43-
run: ./gradlew :sigstore-cli:serverShadowJar
44-
43+
run: ./gradlew -Porg.gradle.java.installations.auto-download=false :sigstore-cli:serverShadowJar
44+
4545
- name: Start test server in background
4646
run: java -jar ${{ github.workspace }}/sigstore-cli/build/libs/sigstore-cli-server-all.jar &
47-
47+
4848
- name: Wait for server to be ready
4949
run: curl --retry-connrefused --retry 10 --retry-delay 1 --fail http://localhost:8080/
5050

.github/workflows/examples.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@ jobs:
7272
- name: Setup Java
7373
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
7474
with:
75-
java-version: 17
75+
java-version: 21
7676
distribution: 'temurin'
7777

7878
- name: Setup Gradle
7979
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
8080

8181
- name: install sigstore java development jars into mavenLocal
82-
run: ./gradlew publishToMavenLocal -Prelease -PskipSigning
82+
run: ./gradlew -Porg.gradle.java.installations.auto-download=false publishToMavenLocal -Prelease -PskipSigning
8383

8484
- name: calculate development version
8585
id: dev_version

.github/workflows/release-sigstore-gradle-plugin-from-tag.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,18 @@ jobs:
4747
with:
4848
persist-credentials: false
4949

50-
- name: Set up JDK 17
50+
- name: Set up JDK 21
5151
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
5252
with:
53-
java-version: 17
53+
java-version: 21
5454
distribution: 'temurin'
5555

5656
- name: Setup Gradle
5757
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
5858

5959
- name: Build, Sign and Release to Gradle Plugin Portal
6060
run: |
61-
./gradlew publishPlugins -Prelease -Pgradle.publish.key=$GRADLE_PUBLISH_KEY -Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET
61+
./gradlew -Porg.gradle.java.installations.auto-download=false publishPlugins -Prelease -Pgradle.publish.key=$GRADLE_PUBLISH_KEY -Pgradle.publish.secret=$GRADLE_PUBLISH_SECRET
6262
env:
6363
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_PRIVATE_KEY }}
6464
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }}

.github/workflows/release-sigstore-java-from-tag.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,18 @@ jobs:
4848
with:
4949
persist-credentials: false
5050

51-
- name: Set up JDK 17
51+
- name: Set up JDK 21
5252
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
5353
with:
54-
java-version: 17
54+
java-version: 21
5555
distribution: 'temurin'
5656

5757
- name: Setup Gradle
5858
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
5959

6060
- name: Build, Sign and Release to Maven Central
6161
run: |
62-
./gradlew clean :sigstore-java:publishMavenJavaPublicationToSonatypeRepository :sigstore-maven-plugin:publishMavenJavaPublicationToSonatypeRepository -Prelease
62+
./gradlew -Porg.gradle.java.installations.auto-download=false clean :sigstore-java:publishMavenJavaPublicationToSonatypeRepository :sigstore-maven-plugin:publishMavenJavaPublicationToSonatypeRepository -Prelease
6363
env:
6464
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.PGP_PRIVATE_KEY }}
6565
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.PGP_PASSPHRASE }}

.github/workflows/tuf-conformance.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
strategy:
1313
max-parallel: 1
1414
matrix:
15-
java-version: [11, 17]
15+
java-version: [11, 17, 21]
1616
fail-fast: false
1717

1818
concurrency:
@@ -28,17 +28,17 @@ jobs:
2828
with:
2929
persist-credentials: false
3030

31-
- name: Set up JDK 17
31+
- name: Set up JDK 21
3232
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
3333
with:
34-
java-version: 17
34+
java-version: 21
3535
distribution: 'temurin'
3636

3737
- name: Setup Gradle
3838
uses: gradle/actions/setup-gradle@ac638b010cf58a27ee6c972d7336334ccaf61c96 # v4.4.1
3939

4040
- name: Build tuf cli
41-
run: ./gradlew :tuf-cli:build
41+
run: ./gradlew -Porg.gradle.java.installations.auto-download=false :tuf-cli:build
4242

4343
- name: Unpack tuf distribution
4444
run: tar -xvf ${{ github.workspace }}/tuf-cli/build/distributions/tuf-cli-*.tar --strip-components 1

build-logic/build-parameters/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ buildParameters {
1414
}
1515
val projectName = "sigstore-java"
1616
integer("jdkBuildVersion") {
17-
defaultValue.set(17)
17+
defaultValue.set(21)
1818
mandatory.set(true)
1919
description.set("JDK version to use for building $projectName. If the value is 0, then the current Java is used. (see https://docs.gradle.org/8.4/userguide/toolchains.html#sec:consuming)")
2020
}

settings.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
1+
plugins {
2+
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
3+
}
4+
15
rootProject.name = "sigstore-java-root"
26

7+
if (JavaVersion.current() < JavaVersion.VERSION_21) {
8+
throw UnsupportedOperationException("Please use Java 21+ for launching Gradle when building ${rootProject.name}, the current Java is ${JavaVersion.current().majorVersion}. " +
9+
"If you want to execute tests with a different Java version, use -PjdkTestVersion=${JavaVersion.current().majorVersion}")
10+
}
11+
312
includeBuild("build-logic-commons")
413
includeBuild("build-logic")
514

0 commit comments

Comments
 (0)