Skip to content

Commit 978df68

Browse files
committed
Correct run order of UI deployment steps
1 parent 9873ce2 commit 978df68

File tree

2 files changed

+31
-23
lines changed

2 files changed

+31
-23
lines changed

cloud/lib/constructs/DeployS3Step.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class DeployS3Step extends Step implements ICodePipelineActionFactory {
3535
actionName: this.actionName,
3636
bucket: Bucket.fromBucketName(options.scope, `${this.actionName}-Bucket`, this.bucketName),
3737
input: options.artifacts.toCodePipeline(this.input),
38-
runOrder: options.runOrder + 1,
38+
runOrder: options.runOrder,
3939
})
4040
);
4141

cloud/lib/pipeline-stack.ts

Lines changed: 30 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@ import { BuildEnvironmentVariableType, BuildSpec } from 'aws-cdk-lib/aws-codebui
22
import { PolicyStatement } from 'aws-cdk-lib/aws-iam';
33
import { IBucket } from 'aws-cdk-lib/aws-s3';
44
import { Stack, StackProps } from 'aws-cdk-lib/core';
5-
import { CodeBuildStep, CodePipeline, CodePipelineSource, ShellStep } from 'aws-cdk-lib/pipelines';
5+
import {
6+
CodeBuildStep,
7+
CodePipeline,
8+
CodePipelineSource,
9+
ShellStep,
10+
Step,
11+
} from 'aws-cdk-lib/pipelines';
612
import { Construct } from 'constructs';
713

814
import { AppStage } from './app-stage';
@@ -147,27 +153,29 @@ export class PipelineStack extends Stack {
147153
});
148154

149155
deployment.addPost(
150-
uiBuildStep,
151-
new DeployS3Step('UI-Deploy', {
152-
actionName: 'UI-Deploy',
153-
bucketName: hostBucketName,
154-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
155-
input: uiBuildStep.primaryOutput!,
156-
}),
157-
new CodeBuildStep('CF-Invalidation', {
158-
commands: [
159-
'aws cloudfront create-invalidation --distribution-id $CF_DISTRIBUTION_ID --paths "/*"',
160-
],
161-
envFromCfnOutputs: {
162-
CF_DISTRIBUTION_ID: appStage.cloudFrontDistributionId,
163-
},
164-
rolePolicyStatements: [
165-
new PolicyStatement({
166-
actions: ['cloudfront:CreateInvalidation'],
167-
resources: [`arn:aws:cloudfront::${env.account}:distribution/*`],
168-
}),
169-
],
170-
})
156+
...Step.sequence([
157+
uiBuildStep,
158+
new DeployS3Step('UI-Deploy', {
159+
actionName: 'UI-Deploy',
160+
bucketName: hostBucketName,
161+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
162+
input: uiBuildStep.primaryOutput!,
163+
}),
164+
new CodeBuildStep('CF-Invalidation', {
165+
commands: [
166+
'aws cloudfront create-invalidation --distribution-id $CF_DISTRIBUTION_ID --paths "/*"',
167+
],
168+
envFromCfnOutputs: {
169+
CF_DISTRIBUTION_ID: appStage.cloudFrontDistributionId,
170+
},
171+
rolePolicyStatements: [
172+
new PolicyStatement({
173+
actions: ['cloudfront:CreateInvalidation'],
174+
resources: [`arn:aws:cloudfront::${env.account}:distribution/*`],
175+
}),
176+
],
177+
}),
178+
])
171179
);
172180
}
173181
}

0 commit comments

Comments
 (0)