From ed215b6a1c071b9ae7e97ca71d4895778d365a28 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Wed, 17 Jul 2024 16:04:14 -0400 Subject: [PATCH] Add MacOS Arm64 Agents Setup and AMI IDs Signed-off-by: Peter Zhu --- lib/ci-stack.ts | 3 ++- lib/compute/agent-nodes.ts | 25 ++++++++++++++++++++----- lib/compute/jenkins-main-node.ts | 4 ++-- packer/jenkins-agent-macos13-arm64.json | 2 +- test/compute/jenkins-main-node.test.ts | 4 ++-- 5 files changed, 27 insertions(+), 11 deletions(-) diff --git a/lib/ci-stack.ts b/lib/ci-stack.ts index 76724fd..40340cc 100644 --- a/lib/ci-stack.ts +++ b/lib/ci-stack.ts @@ -166,7 +166,8 @@ export class CIStack extends Stack { agentNode.AL2023_X64_BENCHMARK_TEST, agentNode.UBUNTU2004_X64_GRADLE_CHECK, agentNode.UBUNTU2004_X64_DOCKER_BUILDER, - agentNode.MACOS12_X64_MULTI_HOST, + agentNode.MACOS13_X64_MULTI_HOST, + agentNode.MACOS13_ARM64_MULTI_HOST, agentNode.WINDOWS2019_X64_DOCKER_HOST, agentNode.WINDOWS2019_X64_DOCKER_BUILDER, agentNode.WINDOWS2019_X64_GRADLE_CHECK, diff --git a/lib/compute/agent-nodes.ts b/lib/compute/agent-nodes.ts index 316c028..65d2df1 100644 --- a/lib/compute/agent-nodes.ts +++ b/lib/compute/agent-nodes.ts @@ -34,7 +34,9 @@ export class AgentNodes { readonly UBUNTU2004_X64_DOCKER_BUILDER: AgentNodeProps; - readonly MACOS12_X64_MULTI_HOST: AgentNodeProps; + readonly MACOS13_X64_MULTI_HOST: AgentNodeProps; + + readonly MACOS13_ARM64_MULTI_HOST: AgentNodeProps; readonly WINDOWS2019_X64_DOCKER_HOST: AgentNodeProps; @@ -201,16 +203,29 @@ export class AgentNodes { + ' sudo apt-get update -y && (sudo killall -9 apt-get apt 2>&1 || echo) && sudo env "DEBIAN_FRONTEND=noninteractive" apt-get upgrade -y', remoteFs: '/var/jenkins', }; - this.MACOS12_X64_MULTI_HOST = { + this.MACOS13_X64_MULTI_HOST = { agentType: 'mac', customDeviceMapping: '/dev/sda1=:300:true:gp3::encrypted', - workerLabelString: 'Jenkins-Agent-MacOS12-X64-Mac1Metal-Multi-Host', + workerLabelString: 'Jenkins-Agent-MacOS13-X64-Mac1Metal-Multi-Host', instanceType: 'Mac1Metal', remoteUser: 'ec2-user', maxTotalUses: -1, minimumNumberOfSpareInstances: 1, - numExecutors: 6, - amiId: 'ami-011470caf4b068ba5', + numExecutors: 4, + amiId: 'ami-05a9221f96f21bfb6', + initScript: 'echo', + remoteFs: '/var/jenkins', + }; + this.MACOS13_ARM64_MULTI_HOST = { + agentType: 'mac', + customDeviceMapping: '/dev/sda1=:300:true:gp3::encrypted', + workerLabelString: 'Jenkins-Agent-MacOS13-ARM64-Mac2M2proMetal-Multi-Host1', + instanceType: 'Mac2M2proMetal', + remoteUser: 'ec2-user', + maxTotalUses: -1, + minimumNumberOfSpareInstances: 1, + numExecutors: 4, + amiId: 'ami-0931ef2039744bef9', initScript: 'echo', remoteFs: '/var/jenkins', }; diff --git a/lib/compute/jenkins-main-node.ts b/lib/compute/jenkins-main-node.ts index aa5905a..7d0fce4 100644 --- a/lib/compute/jenkins-main-node.ts +++ b/lib/compute/jenkins-main-node.ts @@ -239,10 +239,10 @@ export class JenkinsMainNode { InitPackage.yum('openssl'), InitPackage.yum('mod_ssl'), InitPackage.yum('amazon-efs-utils'), - InitCommand.shellCommand('amazon-linux-extras install java-openjdk11 -y'), InitPackage.yum('docker'), InitPackage.yum('python3'), InitPackage.yum('python3-pip.noarch'), + InitPackage.yum('java-11-amazon-corretto'), InitCommand.shellCommand('pip3 install botocore'), InitCommand.shellCommand('systemctl enable crond.service'), InitCommand.shellCommand('systemctl start crond.service'), @@ -250,7 +250,7 @@ export class JenkinsMainNode { InitCommand.shellCommand('sudo wget -nv https://github.com/mikefarah/yq/releases/download/v4.22.1/yq_linux_amd64 -O /usr/bin/yq && sudo chmod +x /usr/bin/yq'), // eslint-disable-next-line max-len InitCommand.shellCommand('sudo curl -L https://github.com/docker/compose/releases/download/v2.9.0/docker-compose-$(uname -s)-$(uname -m) -o /usr/bin/docker-compose && sudo chmod +x /usr/bin/docker-compose'), - InitCommand.shellCommand('python3 -m pip install --upgrade pip && python3 -m pip install cryptography boto3 requests-aws4auth'), + InitCommand.shellCommand('pip3 install cryptography boto3 requests-aws4auth'), InitCommand.shellCommand(httpConfigProps.useSsl // eslint-disable-next-line max-len diff --git a/packer/jenkins-agent-macos13-arm64.json b/packer/jenkins-agent-macos13-arm64.json index 672256e..10892ec 100644 --- a/packer/jenkins-agent-macos13-arm64.json +++ b/packer/jenkins-agent-macos13-arm64.json @@ -1,6 +1,6 @@ { "variables": { - "ami_name": "Jenkins-Agent-MacOS13-ARM64-Mac2M2ProMetal", + "ami_name": "Jenkins-Agent-MacOS13-ARM64-Mac2M2proMetal", "os_version": "13.6.7", "os_architecture": "arm64_mac", "build-region": "us-east-1", diff --git a/test/compute/jenkins-main-node.test.ts b/test/compute/jenkins-main-node.test.ts index 636bd0f..55913fd 100644 --- a/test/compute/jenkins-main-node.test.ts +++ b/test/compute/jenkins-main-node.test.ts @@ -26,8 +26,8 @@ describe('JenkinsMainNode Config Elements', () => { // THEN test('Config elements expected counts', async () => { - expect(configElements.filter((e) => e.elementType === 'COMMAND')).toHaveLength(24); - expect(configElements.filter((e) => e.elementType === 'PACKAGE')).toHaveLength(10); + expect(configElements.filter((e) => e.elementType === 'COMMAND')).toHaveLength(23); + expect(configElements.filter((e) => e.elementType === 'PACKAGE')).toHaveLength(11); expect(configElements.filter((e) => e.elementType === 'FILE')).toHaveLength(4); });