Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e61b4f3

Browse files
authored
Add Java25 container (#36349)
* Add Java25 container * Fix copy-paste leftover
1 parent 6b9d534 commit e61b4f3

9 files changed

Lines changed: 111 additions & 10 deletions

File tree

sdks/java/container/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,6 @@ task pushAll {
8383
dependsOn ":sdks:java:container:java11:docker"
8484
dependsOn ":sdks:java:container:java17:docker"
8585
dependsOn ":sdks:java:container:java21:docker"
86+
dependsOn ":sdks:java:container:java25:docker"
8687
dependsOn ":sdks:java:container:distroless:pushAll"
8788
}

sdks/java/container/distroless/build.gradle

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@ configurations {
2626
dockerDependency
2727
}
2828

29-
task pushAll {
30-
dependsOn ":sdks:java:container:distroless:java17:docker"
31-
dependsOn ":sdks:java:container:distroless:java21:docker"
29+
tasks.register('pushAll') {
30+
dependsOn ":sdks:java:container:distroless:java17:docker"
31+
dependsOn ":sdks:java:container:distroless:java21:docker"
32+
// TODO(#35627) add Java25 distroless container once gcr.io/distroless includes java25
3233
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* License); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an AS IS BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
project.ext {
20+
imageJavaVersion = '25'
21+
}
22+
23+
// Load the main build script which contains all build logic.
24+
apply from: "../common.gradle"
25+
26+
dependencies {
27+
dockerDependency project(path: ":sdks:java:container:agent")
28+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
# Java 21 java.security properties file override for JVM
17+
# base properties derived from:
18+
# openjdk version "21-ea" 2023-09-19
19+
# OpenJDK Runtime Environment (build 21-ea+23-1988)
20+
# OpenJDK 64-Bit Server VM (build 21-ea+23-1988, mixed mode, sharing)
21+
22+
# Java has now disabled TLSv1 and TLSv1.1. We specifically put it in the
23+
# legacy algorithms list to allow it to be used if something better is not
24+
# available (e.g. TLSv1.2). This will prevent breakages for existing users
25+
# (for example JDBC with MySQL). See
26+
# https://bugs.java.com/bugdatabase/view_bug.do?bug_id=JDK-8202343
27+
# for additional details.
28+
jdk.tls.disabledAlgorithms=SSLv3, DTLSv1.0, RC4, DES, \
29+
MD5withRSA, DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
30+
ECDH
31+
32+
# The raw value from 21-ea for legacyAlgorithms is
33+
# NULL, anon, RC4, DES, 3DES_EDE_CBC
34+
# Because these values are in disabledAlgorithms, it is erroneous to include
35+
# them in legacy (they are disabled in Java 8, 11, and 17 as well). Here we
36+
# only include TLSv1 and TLSv1.1 which were removed from disabledAlgorithms
37+
jdk.tls.legacyAlgorithms=TLSv1, TLSv1.1
38+
39+
# /dev/random blocks in virtualized environments due to lack of
40+
# good entropy sources, which makes SecureRandom use impractical.
41+
# In particular, that affects the performance of HTTPS that relies
42+
# on SecureRandom.
43+
#
44+
# Due to that, /dev/urandom is used as the default.
45+
#
46+
# See http://www.2uo.de/myths-about-urandom/ for some background
47+
# on security of /dev/urandom on Linux.
48+
securerandom.source=file:/dev/./urandom
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "jamm",
3+
"enabled": true,
4+
"options": {
5+
"java_arguments": [
6+
"--add-modules=jamm",
7+
"--module-path=/opt/apache/beam/jars/jamm.jar",
8+
"--add-opens=java.base/java.lang=jamm",
9+
"--add-opens=java.base/java.util=jamm"
10+
]
11+
}
12+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "java-security",
3+
"enabled": true,
4+
"options": {
5+
"properties": {
6+
"java.security.properties": "/opt/apache/beam/options/java25-security.properties"
7+
}
8+
}
9+
}

sdks/java/core/src/main/java/org/apache/beam/sdk/util/construction/Environments.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ public class Environments {
9797
public enum JavaVersion {
9898
java11("java11", "11", 11),
9999
java17("java17", "17", 17),
100-
java21("java21", "21", 21);
100+
java21("java21", "21", 21),
101+
java25("java25", "25", 25);
101102

102103
// Legacy name, as used in container image
103104
private final String legacyName;
@@ -135,7 +136,7 @@ public static JavaVersion forSpecification(String specification) {
135136
specification = specification.substring(2);
136137
}
137138
int specificationInt = Integer.parseInt(specification);
138-
JavaVersion fallback = java21;
139+
JavaVersion fallback = java25;
139140
int minDistance = Integer.MAX_VALUE;
140141
for (JavaVersion candidate : JavaVersion.values()) {
141142
int distance = candidate.specificationInt - specificationInt;

sdks/java/core/src/test/java/org/apache/beam/sdk/util/construction/EnvironmentsTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,21 +298,21 @@ public void testLtsJavaVersion() {
298298
assertEquals("java17", JavaVersion.java17.legacyName());
299299
assertEquals(JavaVersion.java21, JavaVersion.forSpecification("21"));
300300
assertEquals("java21", JavaVersion.java21.legacyName());
301+
assertEquals(JavaVersion.java25, JavaVersion.forSpecification("25"));
302+
assertEquals("java25", JavaVersion.java25.legacyName());
301303
}
302304

303305
@Test
304306
public void testNonLtsJavaVersion() {
305307
assertEquals(JavaVersion.java11, JavaVersion.forSpecification("9"));
306308
assertEquals(JavaVersion.java11, JavaVersion.forSpecification("10"));
307309
assertEquals(JavaVersion.java17, JavaVersion.forSpecification("12"));
308-
assertEquals(JavaVersion.java17, JavaVersion.forSpecification("13"));
309-
assertEquals(JavaVersion.java17, JavaVersion.forSpecification("14"));
310-
assertEquals(JavaVersion.java17, JavaVersion.forSpecification("15"));
311310
assertEquals(JavaVersion.java17, JavaVersion.forSpecification("16"));
312311
assertEquals(JavaVersion.java21, JavaVersion.forSpecification("18"));
313-
assertEquals(JavaVersion.java21, JavaVersion.forSpecification("19"));
314312
assertEquals(JavaVersion.java21, JavaVersion.forSpecification("20"));
315-
assertEquals(JavaVersion.java21, JavaVersion.forSpecification("22"));
313+
assertEquals(JavaVersion.java25, JavaVersion.forSpecification("22"));
314+
assertEquals(JavaVersion.java25, JavaVersion.forSpecification("24"));
315+
assertEquals(JavaVersion.java25, JavaVersion.forSpecification("26"));
316316
}
317317

318318
@Test(expected = UnsupportedOperationException.class)

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ include(":sdks:java:container:agent")
170170
include(":sdks:java:container:java11")
171171
include(":sdks:java:container:java17")
172172
include(":sdks:java:container:java21")
173+
include(":sdks:java:container:java25")
173174
include(":sdks:java:container:distroless")
174175
include(":sdks:java:container:distroless:java17")
175176
include(":sdks:java:container:distroless:java21")

0 commit comments

Comments
 (0)