Skip to content

Commit 44c1c48

Browse files
authored
Merge pull request #16321 from guardian/aa/tag-rendering-ecs
feat(cdk): Provision ECS infrastructure for tag page rendering CODE
2 parents 0e8129a + 4278768 commit 44c1c48

6 files changed

Lines changed: 1864 additions & 8 deletions

File tree

.github/workflows/cicd.yml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ on:
44
push:
55

66
jobs:
7-
container:
8-
permissions:
9-
packages: write
10-
uses: ./.github/workflows/container.yml
11-
127
production-container:
138
permissions:
149
contents: read
@@ -17,6 +12,14 @@ jobs:
1712
secrets:
1813
GU_RIFF_RAFF_ROLE_ARN: ${{ secrets.GU_RIFF_RAFF_ROLE_ARN }}
1914

15+
container:
16+
permissions:
17+
packages: write
18+
needs: [production-container]
19+
uses: ./.github/workflows/container.yml
20+
with:
21+
production-image-digest: ${{ needs.production-container.outputs.imageDigest }}
22+
2023
prettier:
2124
uses: ./.github/workflows/prettier.yml
2225

.github/workflows/container.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
# Commercial rely on a container image built from the main branch with the tag 'main'
33
on:
44
workflow_call:
5+
inputs:
6+
production-image-digest:
7+
description: 'Digest of image pushed to AWS ECR to run on AWS ECS. Gets used by `cdk synth`.'
8+
required: true
9+
type: string
510
outputs:
611
container-image:
712
description: 'The generated container image path'
@@ -30,6 +35,8 @@ jobs:
3035
echo 'export const GIT_COMMIT_HASH = "${{ github.sha }}";' > src/server/prout.ts
3136
3237
- name: Generate production bundle
38+
env:
39+
IMAGE_DIGEST: ${{ inputs.production-image-digest }}
3340
run: make riffraff-bundle
3441
working-directory: dotcom-rendering
3542

dotcom-rendering/cdk/bin/cdk.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { App } from 'aws-cdk-lib';
22
import { InstanceClass, InstanceSize, InstanceType } from 'aws-cdk-lib/aws-ec2';
3+
import type { RenderingCDKStackProps } from '../lib/renderingStack';
34
import { RenderingCDKStack } from '../lib/renderingStack';
45

56
const cdkApp = new App();
@@ -96,13 +97,21 @@ new RenderingCDKStack(cdkApp, 'FaciaRendering-PROD', {
9697
});
9798

9899
/** Tag pages */
99-
new RenderingCDKStack(cdkApp, 'TagPageRendering-CODE', {
100+
export const TagPageRenderingPropsCODE: RenderingCDKStackProps = {
100101
guApp: 'tag-page-rendering',
101102
stage: 'CODE',
102103
domainName: 'tag-page-rendering.code.dev-guardianapis.com',
103104
scaling: { minimumInstances: 1, maximumInstances: 3 },
104105
instanceType: InstanceType.of(InstanceClass.T4G, InstanceSize.SMALL),
105-
});
106+
imageIdentifier: process.env.IMAGE_DIGEST ?? 'DEV',
107+
};
108+
109+
new RenderingCDKStack(
110+
cdkApp,
111+
'TagPageRendering-CODE',
112+
TagPageRenderingPropsCODE,
113+
);
114+
106115
new RenderingCDKStack(cdkApp, 'TagPageRendering-PROD', {
107116
guApp: 'tag-page-rendering',
108117
stage: 'PROD',

0 commit comments

Comments
 (0)