From 5c01da8d82f77e0241890101258aace2dac1902d Mon Sep 17 00:00:00 2001 From: barticus Date: Mon, 10 Aug 2020 22:53:17 +1000 Subject: [PATCH 1/3] fix(pipelines): manual approval of changeset uses wrong ordering (#9508) From `addApplication` or `addStackArtifactDeployment` method. Currently, when calling `addStackArtifactDeployment`, you can pass in `AddStackOptions`, but the `executeRunOrder` property is not respected later in the process where `DeployCdkStackAction.fromStackArtifact` is called. From addApplication, this property is used when manualApprovals has been opted in to, but as it is not respected, it results in bug #9101 Fixes #9101 (I think!) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/pipelines/lib/stage.ts | 7 +++--- .../pipelines/test/stack-ordering.test.ts | 25 ++++++++++++++++++- 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/packages/@aws-cdk/pipelines/lib/stage.ts b/packages/@aws-cdk/pipelines/lib/stage.ts index 6b379f686fe2e..dd5aa28c5e50e 100644 --- a/packages/@aws-cdk/pipelines/lib/stage.ts +++ b/packages/@aws-cdk/pipelines/lib/stage.ts @@ -184,7 +184,7 @@ export class CdkStage extends Construct { if (this._prepared) { return; } this._prepared = true; - for (const { prepareRunOrder: runOrder, stackArtifact } of this.stacksToDeploy) { + for (const { prepareRunOrder, stackArtifact, executeRunOrder } of this.stacksToDeploy) { const artifact = this.host.stackOutputArtifact(stackArtifact.id); this.pipelineStage.addAction(DeployCdkStackAction.fromStackArtifact(this, stackArtifact, { @@ -192,7 +192,8 @@ export class CdkStage extends Construct { cloudAssemblyInput: this.cloudAssemblyArtifact, output: artifact, outputFileName: artifact ? 'outputs.json' : undefined, - prepareRunOrder: runOrder, + prepareRunOrder, + executeRunOrder, })); } } @@ -387,4 +388,4 @@ interface DeployStackCommand { prepareRunOrder: number; executeRunOrder: number; stackArtifact: cxapi.CloudFormationStackArtifact; -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/pipelines/test/stack-ordering.test.ts b/packages/@aws-cdk/pipelines/test/stack-ordering.test.ts index e755572c78544..45d0cb76bf6b8 100644 --- a/packages/@aws-cdk/pipelines/test/stack-ordering.test.ts +++ b/packages/@aws-cdk/pipelines/test/stack-ordering.test.ts @@ -55,6 +55,29 @@ test('multiple independent stacks go in parallel', () => { }); }); +test('manual approval is inserted in correct location', () => { + // WHEN + pipeline.addApplicationStage(new TwoStackApp(app, 'MyApp'), { + manualApprovals: true, + }); + + // THEN + expect(pipelineStack).toHaveResourceLike('AWS::CodePipeline::Pipeline', { + Stages: arrayWith({ + Name: 'MyApp', + Actions: sortedByRunOrder([ + objectLike({ Name: 'Stack1.Prepare' }), + objectLike({ Name: 'ManualApproval' }), + objectLike({ Name: 'Stack1.Deploy' }), + objectLike({ Name: 'Stack2.Prepare' }), + objectLike({ Name: 'ManualApproval2' }), + objectLike({ Name: 'Stack2.Deploy' }), + ]), + }), + }); +}); + + class TwoStackApp extends Stage { constructor(scope: Construct, id: string, props?: StageProps) { super(scope, id, props); @@ -80,4 +103,4 @@ class ThreeStackApp extends Stage { stack3.addDependency(stack1); stack3.addDependency(stack2); } -} \ No newline at end of file +} From f78c3469522006d38078db6effc4556d44da9747 Mon Sep 17 00:00:00 2001 From: Robert Djurasaj Date: Mon, 10 Aug 2020 07:14:47 -0600 Subject: [PATCH 2/3] fix(efs): LifecyclePolicy of AFTER_7_DAYS is not applied (#9475) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #9474 (see for details). ```ts const fileSystem = new efs.FileSystem(this, "EFS", { removalPolicy: cdk.RemovalPolicy.DESTROY, lifecyclePolicy: efs.LifecyclePolicy.AFTER_7_DAYS, vpc, }); ``` Old behavior: ```bash npm run build; cdk synth | grep -r -n1 "AFTER_"; cdk diff > demo@0.1.0 build /Users/robertd/code/demo > tsc Stack EFSDemoTest Resources [~] AWS::EFS::FileSystem EFS EFSBAA8953A └─ [-] LifecyclePolicies └─ [{"TransitionToIA":"AFTER_14_DAYS"}] ``` **New (expected) behavior:** 🎆 🥳 🍾 ```bash npm run build; cdk synth | grep -r -n1 "AFTER_"; cdk diff > demo@0.1.0 build /Users/robertd/demo > tsc (standard input)-327- LifecyclePolicies: (standard input):328: - TransitionToIA: AFTER_7_DAYS (standard input)-329- UpdateReplacePolicy: Delete Stack EFSDemoTest Resources [~] AWS::EFS::FileSystem EFS EFSBAA8953A └─ [~] LifecyclePolicies └─ @@ -1,5 +1,5 @@ [ ] [ [ ] { [-] "TransitionToIA": "AFTER_14_DAYS" [+] "TransitionToIA": "AFTER_7_DAYS" [ ] } [ ] ] ``` ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- packages/@aws-cdk/aws-efs/README.md | 2 +- packages/@aws-cdk/aws-efs/lib/efs-file-system.ts | 14 ++++++-------- .../@aws-cdk/aws-efs/test/efs-file-system.test.ts | 6 +++--- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/packages/@aws-cdk/aws-efs/README.md b/packages/@aws-cdk/aws-efs/README.md index 01d766117a6b1..f1082eeddbc83 100644 --- a/packages/@aws-cdk/aws-efs/README.md +++ b/packages/@aws-cdk/aws-efs/README.md @@ -68,7 +68,7 @@ fileSystem.connections.allowDefaultPortFrom(instance); In order to automatically mount this file system during instance launch, following code can be used as reference: -``` +```ts const vpc = new ec2.Vpc(this, 'VPC'); const fileSystem = new efs.FileSystem(this, 'MyEfsFileSystem', { diff --git a/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts b/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts index 8103ee40bae79..854503f388f7d 100644 --- a/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts +++ b/packages/@aws-cdk/aws-efs/lib/efs-file-system.ts @@ -13,27 +13,27 @@ export enum LifecyclePolicy { /** * After 7 days of not being accessed. */ - AFTER_7_DAYS, + AFTER_7_DAYS = 'AFTER_7_DAYS', /** * After 14 days of not being accessed. */ - AFTER_14_DAYS, + AFTER_14_DAYS = 'AFTER_14_DAYS', /** * After 30 days of not being accessed. */ - AFTER_30_DAYS, + AFTER_30_DAYS = 'AFTER_30_DAYS', /** * After 60 days of not being accessed. */ - AFTER_60_DAYS, + AFTER_60_DAYS = 'AFTER_60_DAYS', /** * After 90 days of not being accessed. */ - AFTER_90_DAYS + AFTER_90_DAYS = 'AFTER_90_DAYS' } /** @@ -247,9 +247,7 @@ export class FileSystem extends Resource implements IFileSystem { const filesystem = new CfnFileSystem(this, 'Resource', { encrypted: props.encrypted, kmsKeyId: (props.kmsKey ? props.kmsKey.keyId : undefined), - lifecyclePolicies: (props.lifecyclePolicy ? Array.of({ - transitionToIa: LifecyclePolicy[props.lifecyclePolicy], - } as CfnFileSystem.LifecyclePolicyProperty) : undefined), + lifecyclePolicies: (props.lifecyclePolicy ? [{ transitionToIa: props.lifecyclePolicy }] : undefined), performanceMode: props.performanceMode, throughputMode: props.throughputMode, provisionedThroughputInMibps: props.provisionedThroughputPerSecond?.toMebibytes(), diff --git a/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts b/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts index 42fa89ee8d9ae..5104c069ec061 100644 --- a/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts +++ b/packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts @@ -75,16 +75,16 @@ test('encrypted file system is created correctly with custom KMS', () => { })); }); -test('file system is created correctly with life cycle property', () => { +test('file system is created correctly with a life cycle property', () => { // WHEN new FileSystem(stack, 'EfsFileSystem', { vpc, - lifecyclePolicy: LifecyclePolicy.AFTER_14_DAYS, + lifecyclePolicy: LifecyclePolicy.AFTER_7_DAYS, }); // THEN expectCDK(stack).to(haveResource('AWS::EFS::FileSystem', { LifecyclePolicies: [{ - TransitionToIA: 'AFTER_14_DAYS', + TransitionToIA: 'AFTER_7_DAYS', }], })); }); From bd45f3419e24d6a9d9989a0efeacf2233866100b Mon Sep 17 00:00:00 2001 From: Justin Dray Date: Mon, 10 Aug 2020 23:40:07 +1000 Subject: [PATCH 3/3] fix(pipelines): CodeBuild images have (too) old Node version (#9446) fixes #9070 This change moves CDK pipelines from standard build image 1.0 to 4.0 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .gitignore | 2 ++ .../lib/actions/deploy-cdk-stack-action.ts | 2 +- .../lib/actions/publish-assets-action.ts | 6 ++++-- .../lib/actions/update-pipeline-action.ts | 1 + .../pipelines/lib/private/asset-manifest.ts | 2 +- .../pipelines/lib/private/construct-internals.ts | 2 +- .../pipelines/lib/synths/simple-synth-action.ts | 6 +++--- .../lib/validation/shell-script-action.ts | 1 + packages/@aws-cdk/pipelines/test/builds.test.ts | 15 +++++++++++++++ .../test/integ.pipeline-with-assets.expected.json | 10 +++++----- .../pipelines/test/integ.pipeline.expected.json | 6 +++--- .../pipelines/test/pipeline-assets.test.ts | 8 ++++++++ packages/@aws-cdk/pipelines/test/pipeline.test.ts | 6 ++++++ packages/@aws-cdk/pipelines/test/testutil.ts | 4 ++-- .../@aws-cdk/pipelines/test/validation.test.ts | 9 +++++++++ 15 files changed, 62 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index 74312eef24f20..055b85911775d 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,5 @@ yarn-error.log # Parcel default cache directory .parcel-cache +# Cloud9 +.c9 diff --git a/packages/@aws-cdk/pipelines/lib/actions/deploy-cdk-stack-action.ts b/packages/@aws-cdk/pipelines/lib/actions/deploy-cdk-stack-action.ts index 790f18db764af..c13dad054c790 100644 --- a/packages/@aws-cdk/pipelines/lib/actions/deploy-cdk-stack-action.ts +++ b/packages/@aws-cdk/pipelines/lib/actions/deploy-cdk-stack-action.ts @@ -1,3 +1,4 @@ +import * as path from 'path'; import * as cfn from '@aws-cdk/aws-cloudformation'; import * as codepipeline from '@aws-cdk/aws-codepipeline'; import * as cpactions from '@aws-cdk/aws-codepipeline-actions'; @@ -5,7 +6,6 @@ import * as events from '@aws-cdk/aws-events'; import * as iam from '@aws-cdk/aws-iam'; import { Arn, Construct, Fn, Stack } from '@aws-cdk/core'; import * as cxapi from '@aws-cdk/cx-api'; -import * as path from 'path'; import { appOf, assemblyBuilderOf } from '../private/construct-internals'; /** diff --git a/packages/@aws-cdk/pipelines/lib/actions/publish-assets-action.ts b/packages/@aws-cdk/pipelines/lib/actions/publish-assets-action.ts index c9fb4a334c6f2..a16862c20d014 100644 --- a/packages/@aws-cdk/pipelines/lib/actions/publish-assets-action.ts +++ b/packages/@aws-cdk/pipelines/lib/actions/publish-assets-action.ts @@ -81,6 +81,10 @@ export class PublishAssetsAction extends Construct implements codepipeline.IActi const project = new codebuild.PipelineProject(this, 'Default', { projectName: this.props.projectName, + environment: { + buildImage: codebuild.LinuxBuildImage.STANDARD_4_0, + privileged: (props.assetType === AssetType.DOCKER_IMAGE) ? true : undefined, + }, buildSpec: codebuild.BuildSpec.fromObject({ version: '0.2', phases: { @@ -92,8 +96,6 @@ export class PublishAssetsAction extends Construct implements codepipeline.IActi }, }, }), - // Needed to perform Docker builds - environment: props.assetType === AssetType.DOCKER_IMAGE ? { privileged: true } : undefined, role: props.role, }); diff --git a/packages/@aws-cdk/pipelines/lib/actions/update-pipeline-action.ts b/packages/@aws-cdk/pipelines/lib/actions/update-pipeline-action.ts index e7b19ac860102..c17c7826c3a7c 100644 --- a/packages/@aws-cdk/pipelines/lib/actions/update-pipeline-action.ts +++ b/packages/@aws-cdk/pipelines/lib/actions/update-pipeline-action.ts @@ -54,6 +54,7 @@ export class UpdatePipelineAction extends Construct implements codepipeline.IAct const selfMutationProject = new codebuild.PipelineProject(this, 'SelfMutation', { projectName: props.projectName, + environment: { buildImage: codebuild.LinuxBuildImage.STANDARD_4_0 }, buildSpec: codebuild.BuildSpec.fromObject({ version: '0.2', phases: { diff --git a/packages/@aws-cdk/pipelines/lib/private/asset-manifest.ts b/packages/@aws-cdk/pipelines/lib/private/asset-manifest.ts index 752c7c242bc48..66b9b78d9cbb0 100644 --- a/packages/@aws-cdk/pipelines/lib/private/asset-manifest.ts +++ b/packages/@aws-cdk/pipelines/lib/private/asset-manifest.ts @@ -1,7 +1,7 @@ // FIXME: copied from `ckd-assets`, because this tool needs to read the asset manifest aswell. -import { AssetManifest, DockerImageDestination, DockerImageSource, FileDestination, FileSource, Manifest } from '@aws-cdk/cloud-assembly-schema'; import * as fs from 'fs'; import * as path from 'path'; +import { AssetManifest, DockerImageDestination, DockerImageSource, FileDestination, FileSource, Manifest } from '@aws-cdk/cloud-assembly-schema'; /** * A manifest of assets diff --git a/packages/@aws-cdk/pipelines/lib/private/construct-internals.ts b/packages/@aws-cdk/pipelines/lib/private/construct-internals.ts index 13b1ac7c1dd0c..7fc07f8d30fa5 100644 --- a/packages/@aws-cdk/pipelines/lib/private/construct-internals.ts +++ b/packages/@aws-cdk/pipelines/lib/private/construct-internals.ts @@ -1,9 +1,9 @@ /** * Get access to construct internals that we need but got removed from the Stages PR. */ +import * as path from 'path'; import { App, IConstruct, Stage } from '@aws-cdk/core'; import * as cxapi from '@aws-cdk/cx-api'; -import * as path from 'path'; export function appOf(construct: IConstruct): App { const root = construct.node.root; diff --git a/packages/@aws-cdk/pipelines/lib/synths/simple-synth-action.ts b/packages/@aws-cdk/pipelines/lib/synths/simple-synth-action.ts index 2d5b14470fafc..fc088c46e00a2 100644 --- a/packages/@aws-cdk/pipelines/lib/synths/simple-synth-action.ts +++ b/packages/@aws-cdk/pipelines/lib/synths/simple-synth-action.ts @@ -1,9 +1,9 @@ +import * as path from 'path'; import * as codebuild from '@aws-cdk/aws-codebuild'; import * as codepipeline from '@aws-cdk/aws-codepipeline'; import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions'; import * as events from '@aws-cdk/aws-events'; import { Construct } from '@aws-cdk/core'; -import * as path from 'path'; import { cloudAssemblyBuildSpecDir } from '../private/construct-internals'; import { copyEnvironmentVariables, filterEmpty } from './_util'; @@ -54,7 +54,7 @@ export interface SimpleSynthOptions { /** * Build environment to use for CodeBuild job * - * @default BuildEnvironment.LinuxBuildImage.STANDARD_1_0 + * @default BuildEnvironment.LinuxBuildImage.STANDARD_4_0 */ readonly environment?: codebuild.BuildEnvironment; @@ -210,7 +210,7 @@ export class SimpleSynthAction implements codepipeline.IAction { const project = new codebuild.PipelineProject(scope, 'CdkBuildProject', { projectName: this.props.projectName ?? this.props.projectName, - environment: this.props.environment, + environment: { buildImage: codebuild.LinuxBuildImage.STANDARD_4_0, ...this.props.environment }, buildSpec: codebuild.BuildSpec.fromObject({ version: '0.2', phases: { diff --git a/packages/@aws-cdk/pipelines/lib/validation/shell-script-action.ts b/packages/@aws-cdk/pipelines/lib/validation/shell-script-action.ts index 301e641cb15fa..b5d1d820b8a6b 100644 --- a/packages/@aws-cdk/pipelines/lib/validation/shell-script-action.ts +++ b/packages/@aws-cdk/pipelines/lib/validation/shell-script-action.ts @@ -134,6 +134,7 @@ export class ShellScriptAction implements codepipeline.IAction { } this._project = new codebuild.PipelineProject(scope, 'Project', { + environment: { buildImage: codebuild.LinuxBuildImage.STANDARD_4_0 }, buildSpec: codebuild.BuildSpec.fromObject({ version: '0.2', phases: { diff --git a/packages/@aws-cdk/pipelines/test/builds.test.ts b/packages/@aws-cdk/pipelines/test/builds.test.ts index 132e46ac28f23..014eb8e79e40f 100644 --- a/packages/@aws-cdk/pipelines/test/builds.test.ts +++ b/packages/@aws-cdk/pipelines/test/builds.test.ts @@ -31,6 +31,9 @@ test.each([['npm'], ['yarn']])('%s build automatically determines artifact base- // THEN expect(pipelineStack).toHaveResourceLike('AWS::CodeBuild::Project', { + Environment: { + Image: 'aws/codebuild/standard:4.0', + }, Source: { BuildSpec: encodedJson(deepObjectLike({ artifacts: { @@ -55,6 +58,9 @@ test.each([['npm'], ['yarn']])('%s build respects subdirectory', (npmYarn) => { // THEN expect(pipelineStack).toHaveResourceLike('AWS::CodeBuild::Project', { + Environment: { + Image: 'aws/codebuild/standard:4.0', + }, Source: { BuildSpec: encodedJson(deepObjectLike({ phases: { @@ -80,6 +86,9 @@ test.each([['npm'], ['yarn']])('%s assumes no build step by default', (npmYarn) // THEN expect(pipelineStack).toHaveResourceLike('AWS::CodeBuild::Project', { + Environment: { + Image: 'aws/codebuild/standard:4.0', + }, Source: { BuildSpec: encodedJson(deepObjectLike({ phases: { @@ -106,6 +115,9 @@ test.each([['npm'], ['yarn']])('%s can have its install command overridden', (np // THEN expect(pipelineStack).toHaveResourceLike('AWS::CodeBuild::Project', { + Environment: { + Image: 'aws/codebuild/standard:4.0', + }, Source: { BuildSpec: encodedJson(deepObjectLike({ phases: { @@ -141,6 +153,9 @@ test('Standard (NPM) synth can output additional artifacts', () => { // THEN expect(pipelineStack).toHaveResourceLike('AWS::CodeBuild::Project', { + Environment: { + Image: 'aws/codebuild/standard:4.0', + }, Source: { BuildSpec: encodedJson(deepObjectLike({ artifacts: { diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.expected.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.expected.json index 058eb255d030a..777cffa9703f6 100644 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.expected.json +++ b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets.expected.json @@ -183,7 +183,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:4.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, @@ -1087,7 +1087,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:4.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, @@ -1391,7 +1391,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:4.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, @@ -1564,7 +1564,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:4.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, @@ -1594,7 +1594,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:4.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.expected.json b/packages/@aws-cdk/pipelines/test/integ.pipeline.expected.json index bd0840aeee7ba..7063a7cf29a0d 100644 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline.expected.json +++ b/packages/@aws-cdk/pipelines/test/integ.pipeline.expected.json @@ -183,7 +183,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:4.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, @@ -986,7 +986,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:4.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, @@ -1290,7 +1290,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/standard:1.0", + "Image": "aws/codebuild/standard:4.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, diff --git a/packages/@aws-cdk/pipelines/test/pipeline-assets.test.ts b/packages/@aws-cdk/pipelines/test/pipeline-assets.test.ts index 41c05e322fa54..25bc092c723ff 100644 --- a/packages/@aws-cdk/pipelines/test/pipeline-assets.test.ts +++ b/packages/@aws-cdk/pipelines/test/pipeline-assets.test.ts @@ -41,6 +41,9 @@ test('command line properly locates assets in subassembly', () => { // THEN expect(pipelineStack).toHaveResourceLike('AWS::CodeBuild::Project', { + Environment: { + Image: 'aws/codebuild/standard:4.0', + }, Source: { BuildSpec: encodedJson(deepObjectLike({ phases: { @@ -107,6 +110,7 @@ test('file image asset publishers do not use privilegedmode, have right AssumeRo }, Environment: objectLike({ PrivilegedMode: false, + Image: 'aws/codebuild/standard:4.0', }), }); @@ -137,6 +141,7 @@ test('docker image asset publishers use privilegedmode, have right AssumeRole', })), }, Environment: objectLike({ + Image: 'aws/codebuild/standard:4.0', PrivilegedMode: true, }), }); @@ -161,6 +166,9 @@ test('can control fix/CLI version used in pipeline selfupdate', () => { // THEN expect(stack2).toHaveResourceLike('AWS::CodeBuild::Project', { + Environment: { + Image: 'aws/codebuild/standard:4.0', + }, Source: { BuildSpec: encodedJson(deepObjectLike({ phases: { diff --git a/packages/@aws-cdk/pipelines/test/pipeline.test.ts b/packages/@aws-cdk/pipelines/test/pipeline.test.ts index 08567b3741961..421075cc2b02b 100644 --- a/packages/@aws-cdk/pipelines/test/pipeline.test.ts +++ b/packages/@aws-cdk/pipelines/test/pipeline.test.ts @@ -177,6 +177,9 @@ test('pipeline has self-mutation stage', () => { }); expect(pipelineStack).toHaveResourceLike('AWS::CodeBuild::Project', { + Environment: { + Image: 'aws/codebuild/standard:4.0', + }, Source: { BuildSpec: encodedJson(deepObjectLike({ phases: { @@ -200,6 +203,9 @@ test('selfmutation stage correctly identifies nested assembly of pipeline stack' // THEN expect(stackTemplate(nestedPipelineStack)).toHaveResourceLike('AWS::CodeBuild::Project', { + Environment: { + Image: 'aws/codebuild/standard:4.0', + }, Source: { BuildSpec: encodedJson(deepObjectLike({ phases: { diff --git a/packages/@aws-cdk/pipelines/test/testutil.ts b/packages/@aws-cdk/pipelines/test/testutil.ts index 9c87e64c502b7..ca5cb3db0e672 100644 --- a/packages/@aws-cdk/pipelines/test/testutil.ts +++ b/packages/@aws-cdk/pipelines/test/testutil.ts @@ -1,9 +1,9 @@ +import * as fs from 'fs'; +import * as path from 'path'; import * as codepipeline from '@aws-cdk/aws-codepipeline'; import * as codepipeline_actions from '@aws-cdk/aws-codepipeline-actions'; import * as s3 from '@aws-cdk/aws-s3'; import { App, AppProps, Construct, Environment, SecretValue, Stack, StackProps, Stage } from '@aws-cdk/core'; -import * as fs from 'fs'; -import * as path from 'path'; import * as cdkp from '../lib'; import { assemblyBuilderOf } from '../lib/private/construct-internals'; diff --git a/packages/@aws-cdk/pipelines/test/validation.test.ts b/packages/@aws-cdk/pipelines/test/validation.test.ts index dffe91ebe4dfd..2e57aaa30c0fc 100644 --- a/packages/@aws-cdk/pipelines/test/validation.test.ts +++ b/packages/@aws-cdk/pipelines/test/validation.test.ts @@ -75,6 +75,9 @@ test('can use stack outputs as validation inputs', () => { }); expect(pipelineStack).toHaveResourceLike('AWS::CodeBuild::Project', { + Environment: { + Image: 'aws/codebuild/standard:4.0', + }, Source: { BuildSpec: encodedJson(deepObjectLike({ phases: { @@ -113,6 +116,9 @@ test('can use additional files from source', () => { }), }); expect(pipelineStack).toHaveResourceLike('AWS::CodeBuild::Project', { + Environment: { + Image: 'aws/codebuild/standard:4.0', + }, Source: { BuildSpec: encodedJson(deepObjectLike({ phases: { @@ -149,6 +155,9 @@ test('can use additional files from build', () => { }), }); expect(pipelineStack).toHaveResourceLike('AWS::CodeBuild::Project', { + Environment: { + Image: 'aws/codebuild/standard:4.0', + }, Source: { BuildSpec: encodedJson(deepObjectLike({ phases: {