From dad53d2070632cb2efd5189704fa48b3f0153f2d Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Tue, 1 Nov 2022 22:47:18 -0400 Subject: [PATCH 1/2] Add JENKINS_HOME_PATH as default JENKINS_HOME always returns /var/jenkins_home Signed-off-by: Peter Zhu --- lib/compute/agent-node-config.ts | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/lib/compute/agent-node-config.ts b/lib/compute/agent-node-config.ts index 5845fd68..a3222215 100644 --- a/lib/compute/agent-node-config.ts +++ b/lib/compute/agent-node-config.ts @@ -196,6 +196,18 @@ export class AgentNodeConfig { ], tenancy: 'Default', type: config.instanceType, + nodeProperties: [ + { + envVars: { + env: [ + { + key: 'JENKINS_HOME_PATH', + value: config.remoteFs, + }, + ], + }, + }, + ], useEphemeralDevices: false, }; } @@ -243,6 +255,18 @@ export class AgentNodeConfig { ], tenancy: 'Host', type: config.instanceType, + nodeProperties: [ + { + envVars: { + env: [ + { + key: 'JENKINS_HOME_PATH', + value: config.remoteFs, + }, + ], + }, + }, + ], useEphemeralDevices: false, }; } @@ -293,6 +317,18 @@ export class AgentNodeConfig { ], tenancy: 'Default', type: config.instanceType, + nodeProperties: [ + { + envVars: { + env: [ + { + key: 'JENKINS_HOME_PATH', + value: config.remoteFs, + }, + ], + }, + }, + ], useEphemeralDevices: false, }; } From 0fd614a9851e38ed6ec56b78c5c46c613f09b127 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 2 Nov 2022 13:29:34 -0400 Subject: [PATCH 2/2] Tweak JDK 14 to support windows installation Signed-off-by: Peter Zhu --- resources/baseJenkins.yaml | 12 ++++++++++-- test/data/test_env.yaml | 40 +++++++++++++++++++++++++++++++++++--- 2 files changed, 47 insertions(+), 5 deletions(-) diff --git a/resources/baseJenkins.yaml b/resources/baseJenkins.yaml index 1c0a0fba..fca089dc 100644 --- a/resources/baseJenkins.yaml +++ b/resources/baseJenkins.yaml @@ -175,8 +175,16 @@ tool: properties: - installSource: installers: - - zip: - url: "https://ci.opensearch.org/ci/dbc/tools/OpenJDK14U-jdk_x64_linux_hotspot_14.0.2_12.zip" + - command: + command: "JENKINS_HOME_LINUX=\"/var/jenkins\"\nJENKINS_HOME_WINDOWS=\"\ + C:/Users/Administrator/jenkins\"\n \n\nif uname -s | grep -i NT; then\n\ + \ echo windows agent\n JENKINS_JDK14_PATH=$JENKINS_HOME_WINDOWS/tools/hudson.model.JDK/openjdk-14\n\ + \ JDK14_ZIP=\"OpenJDK14U-jdk_x64_windows_hotspot_14.0.2_12.zip\"\ + \n \nelse\n echo linux agent\n JENKINS_JDK14_PATH=$JENKINS_HOME_LINUX/tools/hudson.model.JDK/openjdk-14\n\ + \ JDK14_ZIP=\"OpenJDK14U-jdk_x64_linux_hotspot_14.0.2_12.zip\"\ + \n \nfi\n\n\nmkdir -p $JENKINS_JDK14_PATH\ncd $JENKINS_JDK14_PATH\n\ + pwd\nrm -rf ./*\ncurl -sSL https://ci.opensearch.org/ci/dbc/tools/$JDK14_ZIP\ + \ -o jdk14.zip\nunzip -q jdk14.zip\nrm jdk14.zip\n\n" - name: "openjdk-17" properties: - installSource: diff --git a/test/data/test_env.yaml b/test/data/test_env.yaml index 266c6f5f..ae21beda 100644 --- a/test/data/test_env.yaml +++ b/test/data/test_env.yaml @@ -187,9 +187,43 @@ tool: properties: - installSource: installers: - - zip: - url: >- - https://ci.opensearch.org/ci/dbc/tools/OpenJDK14U-jdk_x64_linux_hotspot_14.0.2_12.zip + - command: + command: >+ + JENKINS_HOME_LINUX="/var/jenkins" + + JENKINS_HOME_WINDOWS="C:/Users/Administrator/jenkins" + + + if uname -s | grep -i NT; then + echo windows agent + JENKINS_JDK14_PATH=$JENKINS_HOME_WINDOWS/tools/hudson.model.JDK/openjdk-14 + JDK14_ZIP="OpenJDK14U-jdk_x64_windows_hotspot_14.0.2_12.zip" + + else + echo linux agent + JENKINS_JDK14_PATH=$JENKINS_HOME_LINUX/tools/hudson.model.JDK/openjdk-14 + JDK14_ZIP="OpenJDK14U-jdk_x64_linux_hotspot_14.0.2_12.zip" + + fi + + + + mkdir -p $JENKINS_JDK14_PATH + + cd $JENKINS_JDK14_PATH + + pwd + + rm -rf ./* + + curl -sSL + https://ci.opensearch.org/ci/dbc/tools/$JDK14_ZIP -o + jdk14.zip + + unzip -q jdk14.zip + + rm jdk14.zip + - name: openjdk-17 properties: - installSource: