Skip to content

Commit

Permalink
Add build number to application artifact
Browse files Browse the repository at this point in the history
  • Loading branch information
akash1810 committed Jul 29, 2024
1 parent 0b315ed commit 4a5a053
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ jobs:
cdk.out:
- cdk/cdk.out
cdk-playground:
- target/cdk-playground.deb
- dist/cdk-playground
cdk-playground-lambda:
- lambda/cdk-playground-lambda.zip
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
target
logs
lambda/cdk-playground-lambda.zip
dist/
4 changes: 3 additions & 1 deletion cdk/jest.setup.js
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
jest.mock("@guardian/cdk/lib/constants/tracking-tag");
jest.mock('@guardian/cdk/lib/constants/tracking-tag');

process.env.GITHUB_RUN_NUMBER = 'TEST';
6 changes: 3 additions & 3 deletions cdk/lib/__snapshots__/cdk-playground.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -1739,13 +1739,13 @@ exitCode=$?
}
trap exitTrap EXIT
mkdir -p $(dirname '/cdk-playground/cdk-playground.deb')
mkdir -p $(dirname '/cdk-playground/cdk-playground-TEST.deb')
aws s3 cp 's3://",
Object {
"Ref": "DistributionBucketName",
},
"/playground/PROD/cdk-playground/cdk-playground.deb' '/cdk-playground/cdk-playground.deb'
dpkg -i /cdk-playground/cdk-playground.deb
"/playground/PROD/cdk-playground/cdk-playground-TEST.deb' '/cdk-playground/cdk-playground-TEST.deb'
dpkg -i /cdk-playground/cdk-playground-TEST.deb
# GuEc2AppExperimental UserData Start
INSTANCE_ID=$(ec2metadata --instance-id)
Expand Down
6 changes: 4 additions & 2 deletions cdk/lib/cdk-playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,17 @@ export class CdkPlayground extends GuStack {
const ec2App = 'cdk-playground';
const ec2AppDomainName = 'cdk-playground.gutools.co.uk';

const buildNumber = process.env.GITHUB_RUN_NUMBER ?? 'DEV';

const { loadBalancer } = new GuEc2AppExperimental(this, {
applicationPort: 9000,
app: ec2App,
instanceType: InstanceType.of(InstanceClass.T4G, InstanceSize.MICRO),
access: { scope: AccessScope.PUBLIC },
userData: {
distributable: {
fileName: `${ec2App}.deb`,
executionStatement: `dpkg -i /${ec2App}/${ec2App}.deb`,
fileName: `${ec2App}-${buildNumber}.deb`,
executionStatement: `dpkg -i /${ec2App}/${ec2App}-${buildNumber}.deb`,
},
},
certificateProps: {
Expand Down
4 changes: 2 additions & 2 deletions script/ci
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ set -e

sbt clean compile test debian:packageBin

# `sbt debian:packageBin` produces `target/cdk-playground_1.0-SNAPSHOT_all.deb`. Rename it to something easier.
mv target/cdk-playground_1.0-SNAPSHOT_all.deb target/cdk-playground.deb
mkdir -p dist/cdk-playground
mv target/cdk-playground_1.0-SNAPSHOT_all.deb "dist/cdk-playground/cdk-playground-$GITHUB_RUN_NUMBER.deb"

0 comments on commit 4a5a053

Please sign in to comment.