Skip to content

Commit

Permalink
Main/Agent Node new setups on tag and executors (#147)
Browse files Browse the repository at this point in the history
* Main/Agent Node new setups on tag and executors

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

* Remove DCO check as it is replaced by dco app

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

* Remove stack in node ts as it is not used anymore

Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
  • Loading branch information
peterzhuamazon authored Jun 22, 2022
1 parent eeaa11b commit 34a7187
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 52 deletions.
18 changes: 0 additions & 18 deletions .github/workflows/dco.yml

This file was deleted.

6 changes: 3 additions & 3 deletions lib/ci-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ export class CIStack extends Stack {
const certificateArn = Secret.fromSecretCompleteArn(this, 'certificateArn', importedArnSecretBucketValue.toString());
const importedReloadPasswordSecretsArn = Fn.importValue(`${CIConfigStack.CASC_RELOAD_TOKEN_SECRET_EXPORT_VALUE}`);
const listenerCertificate = ListenerCertificate.fromArn(certificateArn.secretValue.toString());
const agentNode = new AgentNodes(this);
const agentNodes: AgentNodeProps[] = [agentNode.AL2_X64, agentNode.AL2_X64_DOCKER_1, agentNode.AL2_ARM64, agentNode.AL2_ARM64_DOCKER_1,
agentNode.UBUNTU_X64_DOCKER];
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];

const mainJenkinsNode = new JenkinsMainNode(this, {
vpc,
Expand Down
5 changes: 3 additions & 2 deletions lib/compute/agent-node-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export interface AgentNodeProps {
instanceType: string;
workerLabelString: string;
remoteUser: string;
numExecutors: number;
initScript: string
}

Expand Down Expand Up @@ -168,7 +169,7 @@ export class AgentNodeConfig {
minimumNumberOfSpareInstances: 1,
mode: 'EXCLUSIVE',
monitoring: true,
numExecutors: 4,
numExecutors: config.numExecutors,
remoteAdmin: config.remoteUser,
remoteFS: '/var/jenkins',
securityGroups: props.agentNodeSecurityGroup,
Expand All @@ -177,7 +178,7 @@ export class AgentNodeConfig {
t2Unlimited: false,
tags: [{
name: 'Name',
value: `${stack.stackName}/AgentNode`,
value: `${stack.stackName}/AgentNode/${config.workerLabelString}`,
},
{
name: 'type',
Expand Down
49 changes: 22 additions & 27 deletions lib/compute/agent-nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,66 +9,61 @@
import {
AmazonLinuxCpuType, AmazonLinuxGeneration, MachineImage,
} from '@aws-cdk/aws-ec2';
import { Stack } from '@aws-cdk/core';
import { AgentNodeProps } from './agent-node-config';

export class AgentNodes {
// Refer: https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/ec2/model/InstanceType.html for instance types
readonly AL2_X64: AgentNodeProps;

readonly AL2_X64_DOCKER_1: AgentNodeProps;
readonly AL2_X64_DOCKER_HOST: AgentNodeProps;

readonly AL2_ARM64: AgentNodeProps;

readonly AL2_ARM64_DOCKER_1: AgentNodeProps;
readonly AL2_ARM64_DOCKER_HOST: AgentNodeProps;

readonly UBUNTU_X64_DOCKER: AgentNodeProps;
readonly UBUNTU_X64_DOCKER_BUILDER: AgentNodeProps;

constructor(stack: Stack) {
constructor() {
this.AL2_X64 = {
workerLabelString: 'AL2-X64',
workerLabelString: 'Jenkins-Agent-al2-x64-c54xlarge-Single-Host',
instanceType: 'C54xlarge',
remoteUser: 'ec2-user',
amiId: MachineImage.latestAmazonLinux({
generation: AmazonLinuxGeneration.AMAZON_LINUX_2,
cpuType: AmazonLinuxCpuType.X86_64,
}).getImage(stack).imageId.toString(),
initScript: 'sudo mkdir -p /var/jenkins/ && sudo chown -R ec2-user:ec2-user /var/jenkins &&'
+ ' sudo yum install -y java-1.8.0-openjdk cmake python3 python3-pip python3-devel && sudo yum groupinstall -y "Development Tools" &&'
+ ' sudo ln -sfn `which pip3` /usr/bin/pip && pip3 install pipenv && sudo ln -s ~/.local/bin/pipenv /usr/local/bin',
numExecutors: 1,
amiId: 'ami-00a07e55fcad01043',
initScript: 'sudo yum update -y || sleep 10 && sudo yum update -y',
};
this.AL2_X64_DOCKER_1 = {
this.AL2_X64_DOCKER_HOST = {
workerLabelString: 'Jenkins-Agent-al2-x64-c54xlarge-Docker-Host',
instanceType: 'C54xlarge',
remoteUser: 'ec2-user',
numExecutors: 8,
amiId: 'ami-00a07e55fcad01043',
initScript: 'sudo yum update -y || sudo yum update -y',
initScript: 'sudo yum update -y || sleep 10 && sudo yum update -y',
};
this.AL2_ARM64 = {
workerLabelString: 'AL2-ARM64',
workerLabelString: 'Jenkins-Agent-al2-arm64-c6g4xlarge-Single-Host',
instanceType: 'C6g4xlarge',
remoteUser: 'ec2-user',
amiId: MachineImage.latestAmazonLinux({
generation: AmazonLinuxGeneration.AMAZON_LINUX_2,
cpuType: AmazonLinuxCpuType.ARM_64,
}).getImage(stack).imageId.toString(),
initScript: 'sudo mkdir -p /var/jenkins/ && sudo chown -R ec2-user:ec2-user /var/jenkins &&'
+ ' sudo yum install -y java-1.8.0-openjdk cmake python3 python3-pip python3-devel && sudo yum groupinstall -y "Development Tools" &&'
+ ' sudo ln -sfn `which pip3` /usr/bin/pip && pip3 install pipenv && sudo ln -s ~/.local/bin/pipenv /usr/local/bin',
numExecutors: 1,
amiId: 'ami-020c52efb1a60f1ae',
initScript: 'sudo yum update -y || sleep 10 && sudo yum update -y',
};
this.AL2_ARM64_DOCKER_1 = {
this.AL2_ARM64_DOCKER_HOST = {
workerLabelString: 'Jenkins-Agent-al2-arm64-c6g4xlarge-Docker-Host',
instanceType: 'C6g4xlarge',
remoteUser: 'ec2-user',
numExecutors: 8,
amiId: 'ami-020c52efb1a60f1ae',
initScript: 'sudo yum update -y || sudo yum update -y',
initScript: 'sudo yum update -y || sleep 10 && sudo yum update -y',
};
this.UBUNTU_X64_DOCKER = {
this.UBUNTU_X64_DOCKER_BUILDER = {
workerLabelString: 'Jenkins-Agent-Ubuntu2004-X64-m52xlarge-Docker-Builder',
instanceType: 'M52xlarge',
remoteUser: 'ubuntu',
numExecutors: 1,
amiId: 'ami-0f6ceb3b3687a3fba',
initScript: 'sudo apt-mark hold docker docker.io openssh-server && docker ps',
initScript: 'sudo apt-mark hold docker docker.io openssh-server && docker ps'
+ 'sudo apt-get update -y && sudo apt-get upgrade -y',
};
}
}
6 changes: 4 additions & 2 deletions resources/baseJenkins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 34a7187

Please sign in to comment.