From 86083081ab0e864eb6147bf53f7388571e0d20b9 Mon Sep 17 00:00:00 2001 From: Adam Ruka Date: Tue, 4 Jan 2022 11:47:15 -0800 Subject: [PATCH] fix(codebuild): setting Cache.none() renders nothing in the template (#18194) When implementing caching in CodeBuild, we made the default cache `Cache.none()`, and, for that reason, do not render anything in the template for that type of cache. However, that does not work well with the CodeBuild API, which interprets the lack of a property as the signal to leave it unchanged. Which means it's not possible currently to disable caching on a Project once it has been enabled once. Fix this by differentiating between the case of "no Cache has been provided", and "the none() Cache has been provided". Closes #18165 ---- *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-codebuild/lib/cache.ts | 8 +- .../aws-codebuild/test/codebuild.test.ts | 9 + ...arning-container-build-image.expected.json | 3 + .../test/integ.defaults.lit.expected.json | 3 + .../test/integ.docker-asset.lit.expected.json | 3 + .../integ.docker-registry.lit.expected.json | 3 + .../test/integ.ecr.lit.expected.json | 3 + .../integ.github-webhook-batch.expected.json | 3 + .../test/integ.github.expected.json | 3 + .../test/integ.project-bucket.expected.json | 3 + ....project-buildspec-artifacts.expected.json | 3 + ...project-file-system-location.expected.json | 3 + .../test/integ.project-logging.expected.json | 3 + .../integ.project-notification.expected.json | 3 + ...-secondary-sources-artifacts.expected.json | 3 + .../test/integ.project-vpc.expected.json | 3 + .../aws-codebuild/test/project.test.ts | 185 ++++++++++-------- ...yed-through-codepipeline.lit.expected.json | 6 + ...eg.pipeline-code-build-batch.expected.json | 3 + ...uild-multiple-inputs-outputs.expected.json | 3 + ...g.pipeline-code-commit-build.expected.json | 3 + .../integ.pipeline-ecs-deploy.expected.json | 3 + ...line-ecs-separate-source.lit.expected.json | 6 + .../test/integ.pipeline-events.expected.json | 3 + .../integ.project-events.expected.json | 5 +- .../codebuild/integ.start-build.expected.json | 3 + .../integ.newpipeline-with-vpc.expected.json | 12 ++ .../test/integ.newpipeline.expected.json | 6 + .../integ.pipeline-security.expected.json | 9 + ...ne-with-assets-single-upload.expected.json | 12 ++ .../integ.pipeline-with-assets.expected.json | 15 ++ .../test/integ.pipeline.expected.json | 9 + .../test/__snapshots__/synth.test.js.snap | 3 + 33 files changed, 262 insertions(+), 83 deletions(-) diff --git a/packages/@aws-cdk/aws-codebuild/lib/cache.ts b/packages/@aws-cdk/aws-codebuild/lib/cache.ts index cf268615eba25..1d8e264649634 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/cache.ts +++ b/packages/@aws-cdk/aws-codebuild/lib/cache.ts @@ -37,7 +37,13 @@ export enum LocalCacheMode { */ export abstract class Cache { public static none(): Cache { - return { _toCloudFormation: () => undefined, _bind: () => { return; } }; + return { + _toCloudFormation(): CfnProject.ProjectCacheProperty | undefined { + return { type: 'NO_CACHE' }; + }, + _bind(): void { + }, + }; } /** diff --git a/packages/@aws-cdk/aws-codebuild/test/codebuild.test.ts b/packages/@aws-cdk/aws-codebuild/test/codebuild.test.ts index f5bb3eacda8d1..1cc66df6b236f 100644 --- a/packages/@aws-cdk/aws-codebuild/test/codebuild.test.ts +++ b/packages/@aws-cdk/aws-codebuild/test/codebuild.test.ts @@ -155,6 +155,9 @@ describe('default properties', () => { 'ComputeType': 'BUILD_GENERAL1_SMALL', }, 'EncryptionKey': 'alias/aws/s3', + 'Cache': { + 'Type': 'NO_CACHE', + }, }, }, }, @@ -335,6 +338,9 @@ describe('default properties', () => { 'Type': 'CODECOMMIT', }, 'EncryptionKey': 'alias/aws/s3', + 'Cache': { + 'Type': 'NO_CACHE', + }, }, }, }, @@ -539,6 +545,9 @@ describe('default properties', () => { 'Type': 'S3', }, 'EncryptionKey': 'alias/aws/s3', + 'Cache': { + 'Type': 'NO_CACHE', + }, }, }, }, diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.expected.json index cee41b06e1ff9..745a6588da5fb 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.aws-deep-learning-container-build-image.expected.json @@ -210,6 +210,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"ls\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } } diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.expected.json index d9e429b2d694c..ff9f8df2fb326 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.defaults.lit.expected.json @@ -147,6 +147,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"echo \\\"Hello, CodeBuild!\\\"\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } } diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.expected.json index e8574d481b17f..66b816d4191af 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.docker-asset.lit.expected.json @@ -164,6 +164,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"ls\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } } diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.expected.json index ca3d5bfef0619..43cdce11f042f 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.docker-registry.lit.expected.json @@ -155,6 +155,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"ls\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } } diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.expected.json index 12ca8fff1853b..fdae4323ed9cd 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.ecr.lit.expected.json @@ -185,6 +185,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"ls\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } } diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.expected.json index b58305bddf2f3..4cedce9c2a951 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.github-webhook-batch.expected.json @@ -169,6 +169,9 @@ ] } }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3", "Triggers": { "BuildType": "BUILD_BATCH", diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.github.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.github.expected.json index 12c37d9da5b3b..1fe01cff9c7b4 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.github.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.github.expected.json @@ -114,6 +114,9 @@ "ReportBuildStatus": false, "Type": "GITHUB" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } } diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json index 2177b1bbc0810..77cc168a3e0d5 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-bucket.expected.json @@ -158,6 +158,9 @@ }, "Type": "S3" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } } diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.expected.json index 9ad98f441d7a6..17cec3ba454e2 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-buildspec-artifacts.expected.json @@ -159,6 +159,9 @@ "BuildSpec": "{\n \"version\": \"0.2\"\n}", "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } } diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.expected.json index 492e78820dc47..fc1f6cffd67c6 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-file-system-location.expected.json @@ -380,6 +380,9 @@ "BuildSpec": "{\n \"version\": \"0.2\"\n}", "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3", "FileSystemLocations": [ { diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-logging.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-logging.expected.json index 722f076547ea3..6dbe8a8127224 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-logging.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-logging.expected.json @@ -202,6 +202,9 @@ "Source": { "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3", "LogsConfig": { "CloudWatchLogs": { diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-notification.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-notification.expected.json index 5cb77017d404d..829263818ad5f 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-notification.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-notification.expected.json @@ -147,6 +147,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"echo \\\"Nothing to do!\\\"\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } }, diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.expected.json index b5e964b69bb80..a8c439a0eaad1 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-secondary-sources-artifacts.expected.json @@ -181,6 +181,9 @@ "BuildSpec": "{\n \"version\": \"0.2\"\n}", "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3", "SecondaryArtifacts": [ { diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.expected.json index cb3561326a2a4..1d9e5d8d8959f 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-vpc.expected.json @@ -380,6 +380,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"echo \\\"Nothing to do!\\\"\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3", "VpcConfig": { "SecurityGroupIds": [ diff --git a/packages/@aws-cdk/aws-codebuild/test/project.test.ts b/packages/@aws-cdk/aws-codebuild/test/project.test.ts index 0041d1651ec9d..bf93885378ac5 100644 --- a/packages/@aws-cdk/aws-codebuild/test/project.test.ts +++ b/packages/@aws-cdk/aws-codebuild/test/project.test.ts @@ -1,4 +1,4 @@ -import { objectLike, ResourcePart, arrayWith } from '@aws-cdk/assert-internal'; +import { ABSENT, objectLike, ResourcePart, arrayWith } from '@aws-cdk/assert-internal'; import '@aws-cdk/assert-internal/jest'; import * as ec2 from '@aws-cdk/aws-ec2'; import * as iam from '@aws-cdk/aws-iam'; @@ -292,103 +292,126 @@ describe('BitBucket source', () => { }); }); -test('project with s3 cache bucket', () => { - // GIVEN - const stack = new cdk.Stack(); +describe('caching', () => { + test('using Cache.none() results in NO_CACHE in the template', () => { + // GIVEN + const stack = new cdk.Stack(); - // WHEN - new codebuild.Project(stack, 'Project', { - source: codebuild.Source.s3({ - bucket: new s3.Bucket(stack, 'SourceBucket'), - path: 'path', - }), - cache: codebuild.Cache.bucket(new s3.Bucket(stack, 'Bucket'), { - prefix: 'cache-prefix', - }), + // WHEN + new codebuild.PipelineProject(stack, 'Project', { + cache: codebuild.Cache.none(), + }); + + // THEN + expect(stack).toHaveResourceLike('AWS::CodeBuild::Project', { + Cache: { + Type: 'NO_CACHE', + Location: ABSENT, + }, + }); }); - // THEN - expect(stack).toHaveResourceLike('AWS::CodeBuild::Project', { - Cache: { - Type: 'S3', - Location: { - 'Fn::Join': [ - '/', - [ - { - 'Ref': 'Bucket83908E77', - }, - 'cache-prefix', + test('project with s3 cache bucket', () => { + // GIVEN + const stack = new cdk.Stack(); + + // WHEN + new codebuild.Project(stack, 'Project', { + source: codebuild.Source.s3({ + bucket: new s3.Bucket(stack, 'SourceBucket'), + path: 'path', + }), + cache: codebuild.Cache.bucket(new s3.Bucket(stack, 'Bucket'), { + prefix: 'cache-prefix', + }), + }); + + // THEN + expect(stack).toHaveResourceLike('AWS::CodeBuild::Project', { + Cache: { + Type: 'S3', + Location: { + 'Fn::Join': [ + '/', + [ + { + 'Ref': 'Bucket83908E77', + }, + 'cache-prefix', + ], ], - ], + }, }, - }, + }); }); -}); -test('s3 codebuild project with sourceVersion', () => { - // GIVEN - const stack = new cdk.Stack(); + test('s3 codebuild project with sourceVersion', () => { + // GIVEN + const stack = new cdk.Stack(); - // WHEN - new codebuild.Project(stack, 'Project', { - source: codebuild.Source.s3({ - bucket: new s3.Bucket(stack, 'Bucket'), - path: 'path', - version: 's3version', - }), - cache: codebuild.Cache.local(codebuild.LocalCacheMode.CUSTOM, codebuild.LocalCacheMode.DOCKER_LAYER, - codebuild.LocalCacheMode.SOURCE), - }); + // WHEN + new codebuild.Project(stack, 'Project', { + source: codebuild.Source.s3({ + bucket: new s3.Bucket(stack, 'Bucket'), + path: 'path', + version: 's3version', + }), + cache: codebuild.Cache.local(codebuild.LocalCacheMode.CUSTOM, codebuild.LocalCacheMode.DOCKER_LAYER, + codebuild.LocalCacheMode.SOURCE), + }); - // THEN - expect(stack).toHaveResource('AWS::CodeBuild::Project', { - SourceVersion: 's3version', + // THEN + expect(stack).toHaveResource('AWS::CodeBuild::Project', { + SourceVersion: 's3version', + }); }); -}); -test('project with local cache modes', () => { - // GIVEN - const stack = new cdk.Stack(); + test('project with local cache modes', () => { + // GIVEN + const stack = new cdk.Stack(); - // WHEN - new codebuild.Project(stack, 'Project', { - source: codebuild.Source.s3({ - bucket: new s3.Bucket(stack, 'Bucket'), - path: 'path', - }), - cache: codebuild.Cache.local(codebuild.LocalCacheMode.CUSTOM, codebuild.LocalCacheMode.DOCKER_LAYER, - codebuild.LocalCacheMode.SOURCE), - }); + // WHEN + new codebuild.Project(stack, 'Project', { + source: codebuild.Source.s3({ + bucket: new s3.Bucket(stack, 'Bucket'), + path: 'path', + }), + cache: codebuild.Cache.local(codebuild.LocalCacheMode.CUSTOM, codebuild.LocalCacheMode.DOCKER_LAYER, + codebuild.LocalCacheMode.SOURCE), + }); - // THEN - expect(stack).toHaveResourceLike('AWS::CodeBuild::Project', { - Cache: { - Type: 'LOCAL', - Modes: [ - 'LOCAL_CUSTOM_CACHE', - 'LOCAL_DOCKER_LAYER_CACHE', - 'LOCAL_SOURCE_CACHE', - ], - }, + // THEN + expect(stack).toHaveResourceLike('AWS::CodeBuild::Project', { + Cache: { + Type: 'LOCAL', + Modes: [ + 'LOCAL_CUSTOM_CACHE', + 'LOCAL_DOCKER_LAYER_CACHE', + 'LOCAL_SOURCE_CACHE', + ], + }, + }); }); -}); -test('project by default has no cache modes', () => { - // GIVEN - const stack = new cdk.Stack(); + test('project by default has cache type set to NO_CACHE', () => { + // GIVEN + const stack = new cdk.Stack(); - // WHEN - new codebuild.Project(stack, 'Project', { - source: codebuild.Source.s3({ - bucket: new s3.Bucket(stack, 'Bucket'), - path: 'path', - }), - }); + // WHEN + new codebuild.Project(stack, 'Project', { + source: codebuild.Source.s3({ + bucket: new s3.Bucket(stack, 'Bucket'), + path: 'path', + }), + }); - // THEN - expect(stack).not.toHaveResourceLike('AWS::CodeBuild::Project', { - Cache: {}, + // THEN + expect(stack).toHaveResourceLike('AWS::CodeBuild::Project', { + Cache: { + Type: 'NO_CACHE', + Location: ABSENT, + }, + }); }); }); diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.expected.json index b15857e14cbcd..29afc8317c758 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.lambda-deployed-through-codepipeline.lit.expected.json @@ -1394,6 +1394,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": \"npm install\"\n },\n \"build\": {\n \"commands\": [\n \"npm run build\",\n \"npm run cdk synth LambdaStack -- -o .\"\n ]\n }\n },\n \"artifacts\": {\n \"files\": \"LambdaStack.template.yaml\"\n }\n}", "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKey01D58D69", @@ -1613,6 +1616,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": \"npm install\"\n },\n \"build\": {\n \"commands\": \"npm run build\"\n }\n },\n \"artifacts\": {\n \"files\": [\n \"index.js\",\n \"node_modules/**/*\"\n ]\n }\n}", "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKey01D58D69", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.expected.json index 67025b2e96c68..3af1036c27a2b 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-batch.expected.json @@ -488,6 +488,9 @@ ] } }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } }, diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.expected.json index 46205d6455441..cd9a20670da04 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-build-multiple-inputs-outputs.expected.json @@ -616,6 +616,9 @@ "Source": { "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } } diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.expected.json index 500a552492eab..410001cabd59b 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-code-commit-build.expected.json @@ -249,6 +249,9 @@ "Source": { "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKey01D58D69", diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.expected.json index 3f7139d458fad..9f9f3404c1413 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-deploy.expected.json @@ -541,6 +541,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": \"$(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)\"\n },\n \"build\": {\n \"commands\": \"docker build -t $REPOSITORY_URI:latest .\"\n },\n \"post_build\": {\n \"commands\": [\n \"docker push $REPOSITORY_URI:latest\",\n \"printf '[{ \\\"name\\\": \\\"Container\\\", \\\"imageUri\\\": \\\"%s\\\" }]' $REPOSITORY_URI:latest > imagedefinitions.json\"\n ]\n }\n },\n \"artifacts\": {\n \"files\": \"imagedefinitions.json\"\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } }, diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.expected.json index e8cbcadeef665..acee7feab59e6 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-ecs-separate-source.lit.expected.json @@ -271,6 +271,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"$(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)\",\n \"docker build -t $REPOSITORY_URI:$CODEBUILD_RESOLVED_SOURCE_VERSION .\"\n ]\n },\n \"post_build\": {\n \"commands\": [\n \"docker push $REPOSITORY_URI:$CODEBUILD_RESOLVED_SOURCE_VERSION\",\n \"export imageTag=$CODEBUILD_RESOLVED_SOURCE_VERSION\"\n ]\n }\n },\n \"env\": {\n \"exported-variables\": [\n \"imageTag\"\n ]\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } }, @@ -454,6 +457,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth --verbose\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } }, diff --git a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.expected.json b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.expected.json index e50f2326bfa19..19be710545e7e 100644 --- a/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.expected.json +++ b/packages/@aws-cdk/aws-codepipeline-actions/test/integ.pipeline-events.expected.json @@ -804,6 +804,9 @@ "Source": { "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "MyPipelineArtifactsBucketEncryptionKey8BF0A7F3", diff --git a/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.expected.json b/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.expected.json index 6d65b68ccb033..e2de1fa26a6a5 100644 --- a/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.expected.json +++ b/packages/@aws-cdk/aws-events-targets/test/codebuild/integ.project-events.expected.json @@ -241,6 +241,9 @@ }, "Type": "CODECOMMIT" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } }, @@ -480,4 +483,4 @@ } } } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.expected.json b/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.expected.json index 432368a1de6d6..58f98f8505b8e 100644 --- a/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.expected.json +++ b/packages/@aws-cdk/aws-stepfunctions-tasks/test/codebuild/integ.start-build.expected.json @@ -154,6 +154,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"echo \\\"Hello, CodeBuild!\\\"\"\n ]\n }\n }\n}", "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3", "Name": "MyTestProject" } diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.expected.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.expected.json index b10333fdc0ca9..1180a0c03f971 100644 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.expected.json +++ b/packages/@aws-cdk/pipelines/test/integ.newpipeline-with-vpc.expected.json @@ -1318,6 +1318,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm ci\",\n \"npm run build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3", "VpcConfig": { "SecurityGroupIds": [ @@ -1902,6 +1905,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3", "VpcConfig": { "SecurityGroupIds": [ @@ -2241,6 +2247,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json\\\" --verbose publish \\\"8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5:current_account-current_region\\\"\"\n ]\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3", "VpcConfig": { "SecurityGroupIds": [ @@ -2339,6 +2348,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-Beta/PipelineStackBetaStack1E6541489.assets.json\\\" --verbose publish \\\"ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e:current_account-current_region\\\"\"\n ]\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3", "VpcConfig": { "SecurityGroupIds": [ diff --git a/packages/@aws-cdk/pipelines/test/integ.newpipeline.expected.json b/packages/@aws-cdk/pipelines/test/integ.newpipeline.expected.json index 935ad4ce5136a..13a2fa4b5a954 100644 --- a/packages/@aws-cdk/pipelines/test/integ.newpipeline.expected.json +++ b/packages/@aws-cdk/pipelines/test/integ.newpipeline.expected.json @@ -1999,6 +1999,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"npm ci\",\n \"npm run build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } }, @@ -2295,6 +2298,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": "alias/aws/s3" } } diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.expected.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-security.expected.json index 3d808a0f31767..7f9c7a276e8b6 100644 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-security.expected.json +++ b/packages/@aws-cdk/pipelines/test/integ.pipeline-security.expected.json @@ -1374,6 +1374,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"yarn install --frozen-lockfile\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"yarn build\",\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "TestPipelineArtifactsBucketEncryptionKey13258842", @@ -2029,6 +2032,9 @@ }, "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "TestPipelineArtifactsBucketEncryptionKey13258842", @@ -2340,6 +2346,9 @@ }, "Type": "NO_SOURCE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "TestPipelineArtifactsBucketEncryptionKey13258842", diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.expected.json b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.expected.json index d5143a1b24ecf..1e3b8da882e14 100644 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.expected.json +++ b/packages/@aws-cdk/pipelines/test/integ.pipeline-with-assets-single-upload.expected.json @@ -808,6 +808,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKeyF5BF0670", @@ -1114,6 +1117,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKeyF5BF0670", @@ -1327,6 +1333,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKeyF5BF0670", @@ -1512,6 +1521,9 @@ "BuildSpec": "buildspec-assets-PipelineStack-Pipeline-Assets-FileAsset.yaml", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKeyF5BF0670", 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 545dc0f39651e..86ea5b197c1fe 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 @@ -834,6 +834,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKeyF5BF0670", @@ -1140,6 +1143,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKeyF5BF0670", @@ -1353,6 +1359,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKeyF5BF0670", @@ -1538,6 +1547,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json\\\" --verbose publish \\\"8289faf53c7da377bb2b90615999171adef5e1d8f6b88810e5fef75e6ca09ba5:12345678-test-region\\\"\"\n ]\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKeyF5BF0670", @@ -1569,6 +1581,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g cdk-assets\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk-assets --path \\\"assembly-PipelineStack-PreProd/PipelineStackPreProdStack65A0AD1F.assets.json\\\" --verbose publish \\\"ac76997971c3f6ddf37120660003f1ced72b4fc58c498dfd99c78fa77e721e0e:12345678-test-region\\\"\"\n ]\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKeyF5BF0670", diff --git a/packages/@aws-cdk/pipelines/test/integ.pipeline.expected.json b/packages/@aws-cdk/pipelines/test/integ.pipeline.expected.json index 0f158a1dffdf5..0cdaf3a38943d 100644 --- a/packages/@aws-cdk/pipelines/test/integ.pipeline.expected.json +++ b/packages/@aws-cdk/pipelines/test/integ.pipeline.expected.json @@ -767,6 +767,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"pre_build\": {\n \"commands\": [\n \"npm ci\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"npx cdk synth\"\n ]\n }\n },\n \"artifacts\": {\n \"secondary-artifacts\": {\n \"CloudAsm\": {\n \"base-directory\": \"cdk.out\",\n \"files\": \"**/*\"\n },\n \"IntegTests\": {\n \"base-directory\": \"test\",\n \"files\": \"**/*\"\n }\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKeyF5BF0670", @@ -1073,6 +1076,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"set -eu\",\n \"cat README.md\"\n ]\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKeyF5BF0670", @@ -1286,6 +1292,9 @@ "BuildSpec": "{\n \"version\": \"0.2\",\n \"phases\": {\n \"install\": {\n \"commands\": [\n \"npm install -g aws-cdk\"\n ]\n },\n \"build\": {\n \"commands\": [\n \"cdk -a . deploy PipelineStack --require-approval=never --verbose\"\n ]\n }\n }\n}", "Type": "CODEPIPELINE" }, + "Cache": { + "Type": "NO_CACHE" + }, "EncryptionKey": { "Fn::GetAtt": [ "PipelineArtifactsBucketEncryptionKeyF5BF0670", diff --git a/packages/decdk/test/__snapshots__/synth.test.js.snap b/packages/decdk/test/__snapshots__/synth.test.js.snap index 44db46163e8a7..433eca7032550 100644 --- a/packages/decdk/test/__snapshots__/synth.test.js.snap +++ b/packages/decdk/test/__snapshots__/synth.test.js.snap @@ -1634,6 +1634,9 @@ Object { "Artifacts": Object { "Type": "CODEPIPELINE", }, + "Cache": Object { + "Type": "NO_CACHE", + }, "EncryptionKey": Object { "Fn::GetAtt": Array [ "Key961B73FD",