Skip to content

Commit

Permalink
Add JENKINS_HOME_PATH as default JENKINS_HOME always returns /var/jen…
Browse files Browse the repository at this point in the history
…kins_home (#215)

* Add JENKINS_HOME_PATH as default JENKINS_HOME always returns /var/jenkins_home

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>

* Tweak JDK 14 to support windows installation

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
  • Loading branch information
peterzhuamazon authored Nov 2, 2022
1 parent f846949 commit 6a8f7c6
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 5 deletions.
36 changes: 36 additions & 0 deletions lib/compute/agent-node-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,18 @@ export class AgentNodeConfig {
],
tenancy: 'Default',
type: config.instanceType,
nodeProperties: [
{
envVars: {
env: [
{
key: 'JENKINS_HOME_PATH',
value: config.remoteFs,
},
],
},
},
],
useEphemeralDevices: false,
};
}
Expand Down Expand Up @@ -243,6 +255,18 @@ export class AgentNodeConfig {
],
tenancy: 'Host',
type: config.instanceType,
nodeProperties: [
{
envVars: {
env: [
{
key: 'JENKINS_HOME_PATH',
value: config.remoteFs,
},
],
},
},
],
useEphemeralDevices: false,
};
}
Expand Down Expand Up @@ -293,6 +317,18 @@ export class AgentNodeConfig {
],
tenancy: 'Default',
type: config.instanceType,
nodeProperties: [
{
envVars: {
env: [
{
key: 'JENKINS_HOME_PATH',
value: config.remoteFs,
},
],
},
},
],
useEphemeralDevices: false,
};
}
Expand Down
12 changes: 10 additions & 2 deletions resources/baseJenkins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
40 changes: 37 additions & 3 deletions test/data/test_env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 6a8f7c6

Please sign in to comment.