From 9043e0f81ae766808821534961d8c70a1930f99f Mon Sep 17 00:00:00 2001 From: Jeff Lu Date: Tue, 12 Dec 2023 12:25:14 -0800 Subject: [PATCH] Using jenv to set Java version on Jenkins Mac agent node (#4278) Signed-off-by: Jeff Lu --- jenkins/opensearch/publish-min-snapshots.jenkinsfile | 5 ++--- .../opensearch/publish-min-snapshots.jenkinsfile.txt | 2 ++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/jenkins/opensearch/publish-min-snapshots.jenkinsfile b/jenkins/opensearch/publish-min-snapshots.jenkinsfile index c5eb035dc1..22f6dcce7b 100644 --- a/jenkins/opensearch/publish-min-snapshots.jenkinsfile +++ b/jenkins/opensearch/publish-min-snapshots.jenkinsfile @@ -123,11 +123,10 @@ pipeline { label AGENT_MACOS_X64 } } - tools { - jdk dockerAgent.javaVersion - } steps { script { + echo("Switching to Java ${env.javaVersionNumber} on Mac Docker Container") + sh("jenv local ${dockerAgent.javaVersion}") buildManifest( componentName: "OpenSearch", inputManifest: "manifests/${INPUT_MANIFEST}", diff --git a/tests/jenkins/jenkinsjob-regression-files/opensearch/publish-min-snapshots.jenkinsfile.txt b/tests/jenkins/jenkinsjob-regression-files/opensearch/publish-min-snapshots.jenkinsfile.txt index f9efc54990..f6d955567f 100644 --- a/tests/jenkins/jenkinsjob-regression-files/opensearch/publish-min-snapshots.jenkinsfile.txt +++ b/tests/jenkins/jenkinsjob-regression-files/opensearch/publish-min-snapshots.jenkinsfile.txt @@ -89,6 +89,8 @@ publish-min-snapshots.stage(macos-x64-tar, groovy.lang.Closure) publish-min-snapshots.echo(Executing on agent [label:Jenkins-Agent-MacOS12-X64-Mac1Metal-Multi-Host]) publish-min-snapshots.script(groovy.lang.Closure) + publish-min-snapshots.echo(Switching to Java 17 on Mac Docker Container) + publish-min-snapshots.sh(jenv local openjdk-17) publish-min-snapshots.buildManifest({componentName=OpenSearch, inputManifest=manifests/3.0.0/opensearch-3.0.0.yml, platform=darwin, architecture=x64, distribution=tar, snapshot=true}) buildManifest.sh(./build.sh manifests/3.0.0/opensearch-3.0.0.yml -d tar --component OpenSearch -p darwin -a x64 --snapshot) publish-min-snapshots.echo(Uploading darwin min snapshots to S3)