Skip to content

Commit dda4c02

Browse files
committed
Ensure javaVer is prefixed and compared correctly
1 parent 7e50d92 commit dda4c02

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

runners/google-cloud-dataflow-java/build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,10 +308,12 @@ tasks.register('examplesJavaRunnerV2IntegrationTestDistroless', Test.class) {
308308
tasks.register('buildAndPushDistrolessContainerImage', Task.class) {
309309
// Only Java 17 and 21 are supported.
310310
// See https://github.com/GoogleContainerTools/distroless/tree/main/java#image-contents.
311-
def allowed = ["java17", "java21"]
311+
def javaVer = getSupportedJavaVersion()
312+
if(project.hasProperty('testJavaVersion')) {
313+
javaVer = "java${project.getProperty('testJavaVersion')}"
314+
}
312315
doLast {
313-
def javaVer = project.findProperty('testJavaVersion')
314-
if (!allowed.contains(javaVer)) {
316+
if (!javaVer in ["java17", "java21"]) {
315317
throw new GradleException("testJavaVersion must be one of ${allowed}, got: ${javaVer}")
316318
}
317319
if (!project.hasProperty('dockerTag')) {

0 commit comments

Comments
 (0)