Skip to content

Commit

Permalink
Upgrade aws-cdk-lib to latest 2.134.0 version (#414)
Browse files Browse the repository at this point in the history
Signed-off-by: Rishabh Singh <[email protected]>
  • Loading branch information
rishabh6788 authored May 18, 2024
1 parent 5384d8a commit b2bd241
Show file tree
Hide file tree
Showing 10 changed files with 11,781 additions and 235 deletions.
6 changes: 5 additions & 1 deletion bin/ci-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ const defaultEnv: string = 'Dev';

const ciConfigStack = new CIConfigStack(app, `OpenSearch-CI-Config-${defaultEnv}`, {});

const ciStack = new CIStack(app, `OpenSearch-CI-${defaultEnv}`, {});
const ciStack = new CIStack(app, `OpenSearch-CI-${defaultEnv}`, {
env: {
region: process.env.CDK_DEFAULT_REGION,
},
});

const ciCdnStack = new CiCdnStack(app, `OpenSearch-CI-Cdn-${defaultEnv}`, {});
ciCdnStack.addDependency(ciStack);
2 changes: 1 addition & 1 deletion lib/buildArtifacts/artifacts-public-access.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class ArtifactsPublicAccess {
}));

const urlRewriter = new NodejsFunction(stack, 'CfUrlRewriter', {
runtime: Runtime.NODEJS_14_X,
runtime: Runtime.NODEJS_18_X,
entry: `${__dirname}/../../resources/cf-url-rewriter/cf-url-rewriter.ts`,
handler: 'handler',
memorySize: 128,
Expand Down
6 changes: 2 additions & 4 deletions lib/compute/agent-nodes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,7 @@ export class AgentNodes {
maxTotalUses: -1,
minimumNumberOfSpareInstances: 1,
numExecutors: 1,
amiId: MachineImage.latestAmazonLinux({
generation: AmazonLinuxGeneration.AMAZON_LINUX_2,
amiId: MachineImage.latestAmazonLinux2023({
cpuType: AmazonLinuxCpuType.X86_64,
}).getImage(stack).imageId.toString(),
initScript: 'sudo amazon-linux-extras install java-openjdk11 -y && sudo yum install -y cmake python3 python3-pip && '
Expand All @@ -288,8 +287,7 @@ export class AgentNodes {
maxTotalUses: -1,
minimumNumberOfSpareInstances: 1,
numExecutors: 1,
amiId: MachineImage.latestAmazonLinux({
generation: AmazonLinuxGeneration.AMAZON_LINUX_2,
amiId: MachineImage.latestAmazonLinux2023({
cpuType: AmazonLinuxCpuType.ARM_64,
}).getImage(stack).imageId.toString(),
initScript: 'sudo amazon-linux-extras install java-openjdk11 -y && sudo yum install -y cmake python3 python3-pip && '
Expand Down
23 changes: 15 additions & 8 deletions lib/compute/jenkins-main-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,19 @@ import {
} from 'aws-cdk-lib/aws-autoscaling';
import { Metric, Unit } from 'aws-cdk-lib/aws-cloudwatch';
import {
AmazonLinuxGeneration, CloudFormationInit, InitCommand, InitElement, InitFile, InitPackage,
AmazonLinuxCpuType,
CloudFormationInit,
InitCommand,
InitElement,
InitFile,
InitPackage,
InstanceClass,
InstanceSize,
InstanceType,
MachineImage, SecurityGroup,
SubnetType, Vpc,
MachineImage,
SecurityGroup,
SubnetType,
Vpc,
} from 'aws-cdk-lib/aws-ec2';
import { FileSystem, PerformanceMode, ThroughputMode } from 'aws-cdk-lib/aws-efs';
import {
Expand Down Expand Up @@ -113,8 +120,8 @@ export class JenkinsMainNode {
}
this.mainNodeAsg = new AutoScalingGroup(stack, 'MainNodeAsg', {
instanceType: InstanceType.of(InstanceClass.C5, InstanceSize.XLARGE9),
machineImage: MachineImage.latestAmazonLinux({
generation: AmazonLinuxGeneration.AMAZON_LINUX_2,
machineImage: MachineImage.latestAmazonLinux2023({
cpuType: AmazonLinuxCpuType.X86_64,
}),
role: new Role(stack, 'OpenSearch-CI-MainNodeRole', {
roleName: 'OpenSearch-CI-MainNodeRole',
Expand All @@ -125,7 +132,7 @@ export class JenkinsMainNode {
},
vpc: props.vpc,
vpcSubnets: {
subnetType: SubnetType.PRIVATE_WITH_NAT,
subnetType: SubnetType.PRIVATE_WITH_EGRESS,
},
minCapacity: 1,
maxCapacity: 1,
Expand Down Expand Up @@ -274,7 +281,7 @@ export class JenkinsMainNode {
InitFile.fromString('/etc/httpd/conf.d/jenkins.conf',
httpConfigProps.useSsl
// eslint-disable-next-line no-useless-escape,max-len
? `LogFormat "%{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
? `LogFormat "%{X-Forwarded-For}i %h %l %u %t \\\"%r\\\" %>s %b \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\"" combined
<VirtualHost *:80>
ServerAdmin webmaster@localhost
Redirect permanent / https://replace_url.com/
Expand Down Expand Up @@ -302,7 +309,7 @@ export class JenkinsMainNode {
Header unset Server
</IfModule>`
// eslint-disable-next-line no-useless-escape,max-len
: `LogFormat "%{X-Forwarded-For}i %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
: `LogFormat "%{X-Forwarded-For}i %h %l %u %t \\\"%r\\\" %>s %b \\\"%{Referer}i\\\" \\\"%{User-Agent}i\\\"" combined
<VirtualHost *:80>
ServerAdmin [email protected]
ProxyRequests Off
Expand Down
2 changes: 1 addition & 1 deletion lib/compute/run-additional-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,6 @@ export class RunAdditionalCommands {
values: [`${stack.stackName}/MainNodeAsg`],
}],
});
ssmAssociation.addDependsOn(ssmDocument);
ssmAssociation.addDependency(ssmDocument);
}
}
2 changes: 1 addition & 1 deletion lib/monitoring/ci-alarms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class JenkinsMonitoring {

this.alarms.push(new Alarm(stack, 'ExternalLoadBalancerUnhealthyHosts', {
alarmDescription: 'If any hosts behind the load balancer are unhealthy',
metric: externalLoadBalancer.targetGroup.metricUnhealthyHostCount(),
metric: externalLoadBalancer.targetGroup.metrics.unhealthyHostCount(),
evaluationPeriods: 3,
threshold: 1,
comparisonOperator: ComparisonOperator.GREATER_THAN_OR_EQUAL_TO_THRESHOLD,
Expand Down
Loading

0 comments on commit b2bd241

Please sign in to comment.