From 85c04096b37722b55748e2190242341039f37bf6 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 24 Jun 2022 16:59:58 -0400 Subject: [PATCH] Add Ubuntu Single Host for Gradle Check (#149) * Add Ubuntu Single Host for Gradle Check Signed-off-by: Peter Zhu * Change default idle time to 60min Signed-off-by: Peter Zhu --- lib/ci-stack.ts | 2 +- lib/compute/agent-node-config.ts | 2 +- lib/compute/agent-nodes.ts | 23 +++++++++++++++++++---- resources/baseJenkins.yaml | 20 ++++++++++++++++++++ test/data/test_env.yaml | 26 ++++++++++++++++++++++++-- 5 files changed, 65 insertions(+), 8 deletions(-) diff --git a/lib/ci-stack.ts b/lib/ci-stack.ts index 26dd08fc..99d6e71c 100644 --- a/lib/ci-stack.ts +++ b/lib/ci-stack.ts @@ -102,7 +102,7 @@ export class CIStack extends Stack { const listenerCertificate = ListenerCertificate.fromArn(certificateArn.secretValue.toString()); const agentNode = new AgentNodes(); const agentNodes: AgentNodeProps[] = [agentNode.AL2_X64, agentNode.AL2_X64_DOCKER_HOST, agentNode.AL2_ARM64, agentNode.AL2_ARM64_DOCKER_HOST, - agentNode.UBUNTU_X64_DOCKER_BUILDER]; + agentNode.UBUNTU_X64, agentNode.UBUNTU_X64_DOCKER_BUILDER]; const mainJenkinsNode = new JenkinsMainNode(this, { vpc, diff --git a/lib/compute/agent-node-config.ts b/lib/compute/agent-node-config.ts index ebe8007c..b74966d1 100644 --- a/lib/compute/agent-node-config.ts +++ b/lib/compute/agent-node-config.ts @@ -160,7 +160,7 @@ export class AgentNodeConfig { ebsOptimized: false, hostKeyVerificationStrategy: 'OFF', iamInstanceProfile: this.AgentNodeInstanceProfileArn, - idleTerminationMinutes: '30', + idleTerminationMinutes: '60', initScript: config.initScript, labelString: config.workerLabelString, launchTimeoutStr: '300', diff --git a/lib/compute/agent-nodes.ts b/lib/compute/agent-nodes.ts index 721e8361..fc12899f 100644 --- a/lib/compute/agent-nodes.ts +++ b/lib/compute/agent-nodes.ts @@ -21,6 +21,8 @@ export class AgentNodes { readonly AL2_ARM64_DOCKER_HOST: AgentNodeProps; + readonly UBUNTU_X64: AgentNodeProps; + readonly UBUNTU_X64_DOCKER_BUILDER: AgentNodeProps; constructor() { @@ -30,7 +32,8 @@ export class AgentNodes { remoteUser: 'ec2-user', numExecutors: 1, amiId: 'ami-00a07e55fcad01043', - initScript: 'sudo yum update -y || sleep 10 && sudo yum update -y', + initScript: 'sudo yum clean all && sudo yum repolist &&' + + ' sudo yum update --exclude=openssh* --exclude=docker* -y', }; this.AL2_X64_DOCKER_HOST = { workerLabelString: 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host', @@ -38,7 +41,8 @@ export class AgentNodes { remoteUser: 'ec2-user', numExecutors: 8, amiId: 'ami-00a07e55fcad01043', - initScript: 'sudo yum update -y || sleep 10 && sudo yum update -y', + initScript: 'sudo yum clean all && sudo yum repolist &&' + + ' sudo yum update --exclude=openssh* --exclude=docker* -y', }; this.AL2_ARM64 = { workerLabelString: 'Jenkins-Agent-al2-arm64-c6g4xlarge-Single-Host', @@ -46,7 +50,8 @@ export class AgentNodes { remoteUser: 'ec2-user', numExecutors: 1, amiId: 'ami-020c52efb1a60f1ae', - initScript: 'sudo yum update -y || sleep 10 && sudo yum update -y', + initScript: 'sudo yum clean all && sudo yum repolist &&' + + ' sudo yum update --exclude=openssh* --exclude=docker* -y', }; this.AL2_ARM64_DOCKER_HOST = { workerLabelString: 'Jenkins-Agent-al2-arm64-c6g4xlarge-Docker-Host', @@ -54,7 +59,17 @@ export class AgentNodes { remoteUser: 'ec2-user', numExecutors: 8, amiId: 'ami-020c52efb1a60f1ae', - initScript: 'sudo yum update -y || sleep 10 && sudo yum update -y', + initScript: 'sudo yum clean all && sudo yum repolist &&' + + ' sudo yum update --exclude=openssh* --exclude=docker* -y', + }; + this.UBUNTU_X64 = { + workerLabelString: 'Jenkins-Agent-Ubuntu2004-X64-c54xlarge-Single-Host', + instanceType: 'C54xlarge', + remoteUser: 'ubuntu', + numExecutors: 1, + amiId: 'ami-0f6ceb3b3687a3fba', + initScript: 'sudo apt-mark hold docker docker.io openssh-server && docker ps &&' + + ' sudo apt-get update -y && sudo apt-get upgrade -y && sudo apt-get install docker-compose -y', }; this.UBUNTU_X64_DOCKER_BUILDER = { workerLabelString: 'Jenkins-Agent-Ubuntu2004-X64-m52xlarge-Docker-Builder', diff --git a/resources/baseJenkins.yaml b/resources/baseJenkins.yaml index 98bb1d49..0c0e62d2 100644 --- a/resources/baseJenkins.yaml +++ b/resources/baseJenkins.yaml @@ -157,6 +157,26 @@ tool: installations: - home: "git" name: "Default" + jdk: + installations: + - name: "jdk-8" + properties: + - installSource: + installers: + - adoptOpenJdkInstaller: + id: "jdk8u332-b09" + - name: "jdk-11" + properties: + - installSource: + installers: + - adoptOpenJdkInstaller: + id: "jdk-11.0.15+10" + - name: "jdk-17" + properties: + - installSource: + installers: + - adoptOpenJdkInstaller: + id: "jdk-17.0.3+7" mavenGlobalConfig: globalSettingsProvider: "standard" settingsProvider: "standard" diff --git a/test/data/test_env.yaml b/test/data/test_env.yaml index 42c718ad..82235dfe 100644 --- a/test/data/test_env.yaml +++ b/test/data/test_env.yaml @@ -8,12 +8,14 @@ jenkins: disableRememberMe: false labelAtoms: - name: built-in + - name: main-node + labelString: main-node markupFormatter: rawHtml: disableSyntaxHighlighting: true - mode: NORMAL + mode: EXCLUSIVE myViewsTabBar: standard - numExecutors: 2 + numExecutors: 4 primaryView: all: name: all @@ -167,6 +169,26 @@ tool: installations: - home: git name: Default + jdk: + installations: + - name: jdk-8 + properties: + - installSource: + installers: + - adoptOpenJdkInstaller: + id: jdk8u332-b09 + - name: jdk-11 + properties: + - installSource: + installers: + - adoptOpenJdkInstaller: + id: jdk-11.0.15+10 + - name: jdk-17 + properties: + - installSource: + installers: + - adoptOpenJdkInstaller: + id: jdk-17.0.3+7 mavenGlobalConfig: globalSettingsProvider: standard settingsProvider: standard