Skip to content

Commit

Permalink
Remove jdk14 live installation and relies on pre-installed AMIs while…
Browse files Browse the repository at this point in the history
… fix gradle check issues (#219)

* Use slash to replace backslash on Windows so groovy wont escape path separator

Signed-off-by: Peter Zhu <[email protected]>

* Remove jdk14 live installation and relies on pre-installed AMIs

Signed-off-by: Peter Zhu <[email protected]>

Signed-off-by: Peter Zhu <[email protected]>
  • Loading branch information
peterzhuamazon authored Nov 3, 2022
1 parent ddef518 commit 1a51f51
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 25 deletions.
4 changes: 2 additions & 2 deletions lib/compute/agent-nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class AgentNodes {
numExecutors: 1,
amiId: 'ami-0720b70e6cb2e8012',
initScript: 'echo',
remoteFs: 'C:\\Users\\Administrator\\jenkins',
remoteFs: 'C:/Users/Administrator/jenkins',
};
this.WINDOWS2019_X64_GRADLE_CHECK = {
agentType: 'windows',
Expand All @@ -162,7 +162,7 @@ export class AgentNodes {
numExecutors: 1,
amiId: 'ami-0720b70e6cb2e8012',
initScript: 'echo',
remoteFs: 'C:\\Users\\Administrator\\jenkins',
remoteFs: 'C:/Users/Administrator/jenkins',
};
this.AL2_X64_DEFAULT_AGENT = {
agentType: 'unix',
Expand Down
2 changes: 1 addition & 1 deletion packer/jenkins-agent-al2-arm64.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
],
"most_recent":true
},
"associate_public_ip_address":false,
"associate_public_ip_address":true,
"ssh_username": "ec2-user",
"ssh_timeout": "3h",
"tags": {
Expand Down
2 changes: 1 addition & 1 deletion packer/jenkins-agent-al2-x64.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
],
"most_recent":true
},
"associate_public_ip_address":false,
"associate_public_ip_address":true,
"ssh_username": "ec2-user",
"ssh_timeout": "3h",
"tags": {
Expand Down
2 changes: 1 addition & 1 deletion packer/jenkins-agent-macos12-x64.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
],
"most_recent":true
},
"associate_public_ip_address":false,
"associate_public_ip_address":true,
"ssh_username": "ec2-user",
"ssh_timeout": "3h",
"tenancy": "host",
Expand Down
2 changes: 1 addition & 1 deletion packer/jenkins-agent-ubuntu2004-x64.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
],
"most_recent":true
},
"associate_public_ip_address":false,
"associate_public_ip_address":true,
"ssh_username": "ubuntu",
"ssh_timeout": "3h",
"tags": {
Expand Down
2 changes: 1 addition & 1 deletion packer/jenkins-agent-win2016-x64.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"most_recent":true
},
"user_data_file":"scripts/windows/userdata.ps1",
"associate_public_ip_address":false,
"associate_public_ip_address":true,
"communicator":"winrm",
"winrm_username":"Administrator",
"winrm_timeout":"40m",
Expand Down
2 changes: 1 addition & 1 deletion packer/jenkins-agent-win2019-x64-alpine-wsl.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"most_recent":true
},
"user_data_file":"scripts/windows/userdata.ps1",
"associate_public_ip_address":false,
"associate_public_ip_address":true,
"communicator":"winrm",
"winrm_username":"Administrator",
"winrm_timeout":"40m",
Expand Down
2 changes: 1 addition & 1 deletion packer/jenkins-agent-win2019-x64.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"most_recent":true
},
"user_data_file":"scripts/windows/userdata.ps1",
"associate_public_ip_address":false,
"associate_public_ip_address":true,
"communicator":"winrm",
"winrm_username":"Administrator",
"winrm_timeout":"40m",
Expand Down
22 changes: 20 additions & 2 deletions packer/scripts/ubuntu2004/ubuntu2004-agent-setups.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ whoami

sudo apt-get update -y && (sudo killall -9 apt-get apt 2>&1 || echo)
sudo apt-get upgrade -y && sudo apt-get install -y software-properties-common && sudo add-apt-repository ppa:jacob/virtualisation -y
sudo apt-get update -y && sudo apt-get install -y binfmt-support qemu qemu-user qemu-user-static docker.io curl python3-pip && pip3 install awscli
sudo apt-get install -y openjdk-8-jdk docker docker.io docker-compose ntp curl git gnupg2 tar zip unzip jq
sudo apt-get update -y && sudo apt-get install -y binfmt-support qemu qemu-user qemu-user-static docker.io curl python3-pip && sudo pip3 install awscli
sudo apt-get install -y docker docker.io docker-compose ntp curl git gnupg2 tar zip unzip jq
sudo apt-get install -y build-essential

sudo systemctl restart ntp && sudo systemctl enable ntp && sudo systemctl status ntp
Expand All @@ -31,3 +31,21 @@ sudo apt-get clean -y

sudo mkdir -p /var/jenkins && sudo chown -R ubuntu:ubuntu /var/jenkins

# Pre-install multi-jdk
sudo apt-get install -y apt-transport-https gnupg
curl -SL https://packages.adoptium.net/artifactory/api/gpg/key/public | sudo apt-key add -
echo "deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main" | sudo tee /etc/apt/sources.list.d/adoptium.list
sudo apt-get update -y
sudo apt-get install -y temurin-8-jdk temurin-11-jdk temurin-17-jdk temurin-19-jdk
# JDK14 required for gradle check to do bwc tests
curl -SL "https://github.com/AdoptOpenJDK/openjdk14-binaries/releases/download/jdk-14.0.2%2B12/OpenJDK14U-jdk_x64_linux_hotspot_14.0.2_12.tar.gz" -o jdk14.tar.gz
tar -xzf jdk14.tar.gz && rm jdk14.tar.gz
mv "jdk-14.0.2+12" "adoptopenjdk-14-amd64"
sudo chown root:root -R adoptopenjdk-14-amd64
sudo mv adoptopenjdk-14-amd64 /usr/lib/jvm/
sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/adoptopenjdk-14-amd64/bin/javac" 1111
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/adoptopenjdk-14-amd64/bin/java" 1111
# Reset to JDK8 so Jenkins can bootstrap it
sudo update-alternatives --set "java" "/usr/lib/jvm/temurin-8-jdk-amd64/bin/java"
sudo update-alternatives --set "javac" "/usr/lib/jvm/temurin-8-jdk-amd64/bin/javac"
java -version
14 changes: 0 additions & 14 deletions resources/baseJenkins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,20 +171,6 @@ tool:
installers:
- adoptOpenJdkInstaller:
id: "jdk-11.0.15+10"
- name: "openjdk-14"
properties:
- installSource:
installers:
- 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

0 comments on commit 1a51f51

Please sign in to comment.