Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve ubuntu2404 agents startup issues on EC2 #533

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions lib/compute/agent-nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export class AgentNodes {

readonly UBUNTU2004_X64_GRADLE_CHECK: AgentNodeProps;

readonly UBUNTU2004_X64_DOCKER_BUILDER: AgentNodeProps;
readonly UBUNTU2404_X64_GRADLE_CHECK: AgentNodeProps;

readonly UBUNTU2404_X64_DOCKER_BUILDER: AgentNodeProps;

readonly MACOS13_X64_MULTI_HOST: AgentNodeProps;

Expand Down Expand Up @@ -158,10 +160,25 @@ export class AgentNodes {
+ ' sudo update-alternatives --set "java" "/usr/lib/jvm/temurin-21-jdk-amd64/bin/java" && java -version',
remoteFs: '/var/jenkins',
};
this.UBUNTU2004_X64_DOCKER_BUILDER = {
this.UBUNTU2404_X64_GRADLE_CHECK = {
agentType: 'unix',
customDeviceMapping: '/dev/sda1=:300:true:::encrypted',
workerLabelString: ['Jenkins-Agent-Ubuntu2404-X64-M58xlarge-Single-Host', 'gradle'],
instanceType: 'M58xlarge',
remoteUser: 'ubuntu',
maxTotalUses: 1,
minimumNumberOfSpareInstances: 1,
numExecutors: 1,
amiId: 'ami-0cdc3fd42e6dc728c',
initScript: 'sudo apt-mark hold docker docker.io openssh-server gh grub-efi* shim-signed && docker ps &&'
+ ' sudo apt-get update -y && (sudo killall -9 apt-get apt 2>&1 || echo) && sudo env "DEBIAN_FRONTEND=noninteractive" apt-get upgrade -y &&'
+ ' sudo update-alternatives --set "java" "/usr/lib/jvm/temurin-21-jdk-amd64/bin/java" && java -version',
remoteFs: '/var/jenkins',
};
this.UBUNTU2404_X64_DOCKER_BUILDER = {
agentType: 'unix',
customDeviceMapping: '/dev/sda1=:300:true:::encrypted',
workerLabelString: ['Jenkins-Agent-Ubuntu2004-X64-M52xlarge-Docker-Builder', 'BTR'],
workerLabelString: ['Jenkins-Agent-Ubuntu2404-X64-M52xlarge-Docker-Builder', 'BTR'],
instanceType: 'M52xlarge',
remoteUser: 'ubuntu',
maxTotalUses: 10,
Expand Down
22 changes: 7 additions & 15 deletions packer/scripts/ubuntu/ubuntu2404-agent-setups.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ set -ex
whoami
export DEBIAN_FRONTEND=noninteractive

sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get install -y software-properties-common && sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt-get update -y && sudo apt-get upgrade -y
sudo apt-get update -y && sudo apt-get install -y binfmt-support qemu-system qemu-system-common qemu-user qemu-user-static
sudo apt-get install -y docker.io=24.0.7* docker-compose ntp curl git gnupg2 tar zip unzip jq pigz
sudo apt-get install -y docker.io=24.0.7* docker-compose ntp curl git gnupg2 tar zip unzip jq pigz python3.12-full python3.12-dev
sudo apt-get install -y build-essential

sudo systemctl restart ntp && sudo systemctl enable ntp && sudo systemctl status ntp
Expand Down Expand Up @@ -57,20 +57,12 @@ sudo update-alternatives --set "java" "/usr/lib/jvm/temurin-21-jdk-amd64/bin/jav
sudo update-alternatives --set "javac" "/usr/lib/jvm/temurin-21-jdk-amd64/bin/javac"
java -version

sudo apt-mark hold docker.io openssh-server temurin-8-jdk temurin-11-jdk temurin-17-jdk temurin-21-jdk temurin-23-jdk
sudo apt-get clean -y && sudo apt-get autoremove -y

# Move to bottom as python39 will break apt
sudo apt-get update -y
sudo apt-get install -y python3.9-full python3.9-dev
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.9 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.9 100
sudo update-alternatives --set python3 /usr/bin/python3.9
sudo update-alternatives --set python /usr/bin/python3.9
curl -SL https://bootstrap.pypa.io/get-pip.py | sudo python3 -
sudo pip3 install awscliv2==2.3.1 pipenv==2023.6.12
sudo apt-get install -y mandoc less python3-pip pipenv
sudo pip3 install awscliv2==2.3.1 --break-system-packages
sudo ln -s `which awsv2` /usr/local/bin/aws
sudo aws --install
aws --install

sudo apt-mark hold docker.io openssh-server gh grub-efi* shim-signed temurin-8-jdk temurin-11-jdk temurin-17-jdk temurin-21-jdk temurin-23-jdk
sudo apt-get clean -y && sudo apt-get autoremove -y
4 changes: 2 additions & 2 deletions test/ci-stack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ describe('AgentNodes', () => {

it('should exclude "default" keys when type is "BTR"', () => {
const result = agentNodes.getRequiredAgentNodes('BTR');
expect(result.length).toBe(14);
expect(result.length).toBe(15);
});

it('should return keys containing "benchmark" when type is "benchmark"', () => {
Expand All @@ -398,7 +398,7 @@ describe('AgentNodes', () => {

it('should return keys containing "gradle" when type is "gradle"', () => {
const result = agentNodes.getRequiredAgentNodes('gradle');
expect(result).toHaveLength(2);
expect(result).toHaveLength(3);
});

it('should return keys containing "default" when type is "default"', () => {
Expand Down