From 1528941628edcd0ebf005119b4cac01b143292d2 Mon Sep 17 00:00:00 2001 From: Kaixiang Zhao Date: Wed, 10 Apr 2019 10:26:35 -0700 Subject: [PATCH] feat(codebuild): add support for more image types Add support for aws/codebuild/golang:1.11 and aws/codebuild/standard:1.0 and default UBUNTU_18_04_STANDARD as the build image Fixes #2079 BREAKING CHANGE: change the default image from UBUNTU_14_04_BASE to UBUNTU_18_04_STANDARD If you want to keep the behavior as previous, please explicitly specify image as UBUNTU_14_04_BASE --- packages/@aws-cdk/aws-codebuild/lib/project.ts | 6 ++++-- .../aws-codebuild/test/integ.caching.expected.json | 2 +- .../aws-codebuild/test/integ.defaults.expected.json | 2 +- .../test/integ.defaults.lit.expected.json | 2 +- .../test/integ.project-bucket.expected.json | 2 +- .../test/integ.project-events.expected.json | 2 +- ...g.project-secondary-sources-artifacts.expected.json | 2 +- .../test/integ.project-shell.expected.json | 2 +- .../aws-codebuild/test/integ.project-vpc.expected.json | 2 +- packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts | 10 +++++----- 10 files changed, 17 insertions(+), 15 deletions(-) diff --git a/packages/@aws-cdk/aws-codebuild/lib/project.ts b/packages/@aws-cdk/aws-codebuild/lib/project.ts index e178ffd3287c9..1484e8d794cdd 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/project.ts +++ b/packages/@aws-cdk/aws-codebuild/lib/project.ts @@ -622,7 +622,7 @@ export class Project extends ProjectBase { props.cacheBucket.grantReadWrite(this.role); } - this.buildImage = (props.environment && props.environment.buildImage) || LinuxBuildImage.UBUNTU_14_04_BASE; + this.buildImage = (props.environment && props.environment.buildImage) || LinuxBuildImage.UBUNTU_18_04_STANDARD; // let source "bind" to the project. this usually involves granting permissions // for the code build role to interact with the source. @@ -941,7 +941,7 @@ export interface BuildEnvironment { /** * The image used for the builds. * - * @default LinuxBuildImage.UBUNTU_14_04_BASE + * @default LinuxBuildImage.UBUNTU_18_04_STANDARD */ readonly buildImage?: IBuildImage; @@ -1023,11 +1023,13 @@ export interface IBuildImage { * @see https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-available.html */ export class LinuxBuildImage implements IBuildImage { + public static readonly UBUNTU_18_04_STANDARD = new LinuxBuildImage('aws/codebuild/standard:1.0'); public static readonly UBUNTU_14_04_BASE = new LinuxBuildImage('aws/codebuild/ubuntu-base:14.04'); public static readonly UBUNTU_14_04_ANDROID_JAVA8_24_4_1 = new LinuxBuildImage('aws/codebuild/android-java-8:24.4.1'); public static readonly UBUNTU_14_04_ANDROID_JAVA8_26_1_1 = new LinuxBuildImage('aws/codebuild/android-java-8:26.1.1'); public static readonly UBUNTU_14_04_DOCKER_17_09_0 = new LinuxBuildImage('aws/codebuild/docker:17.09.0'); public static readonly UBUNTU_14_04_GOLANG_1_10 = new LinuxBuildImage('aws/codebuild/golang:1.10'); + public static readonly UBUNTU_14_04_GOLANG_1_11 = new LinuxBuildImage('aws/codebuild/golang:1.11'); public static readonly UBUNTU_14_04_OPEN_JDK_8 = new LinuxBuildImage('aws/codebuild/java:openjdk-8'); public static readonly UBUNTU_14_04_OPEN_JDK_9 = new LinuxBuildImage('aws/codebuild/java:openjdk-9'); public static readonly UBUNTU_14_04_NODEJS_10_1_0 = new LinuxBuildImage('aws/codebuild/nodejs:10.1.0'); diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json index ebe7bfd136fc3..57686badca7fe 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.caching.expected.json @@ -144,7 +144,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/ubuntu-base:14.04", + "Image": "aws/codebuild/standard:1.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.defaults.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.defaults.expected.json index 61b84b86ddb72..03af104a5737e 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.defaults.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.defaults.expected.json @@ -98,7 +98,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/ubuntu-base:14.04", + "Image": "aws/codebuild/standard:1.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, 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 4512ff62e6bc6..797c76b86f2fe 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 @@ -108,7 +108,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/ubuntu-base:14.04", + "Image": "aws/codebuild/standard:1.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, 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 8993536b45be9..16e306296839d 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 @@ -141,7 +141,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_LARGE", - "Image": "aws/codebuild/ubuntu-base:14.04", + "Image": "aws/codebuild/standard:1.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-events.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-events.expected.json index ef568ae60f87b..318ebe366870d 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-events.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-events.expected.json @@ -186,7 +186,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/ubuntu-base:14.04", + "Image": "aws/codebuild/standard:1.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, 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 ff00b408cf1eb..901e4a91c0046 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 @@ -174,7 +174,7 @@ }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/ubuntu-base:14.04", + "Image": "aws/codebuild/standard:1.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, diff --git a/packages/@aws-cdk/aws-codebuild/test/integ.project-shell.expected.json b/packages/@aws-cdk/aws-codebuild/test/integ.project-shell.expected.json index 148f64722ab9c..976e7c9937dca 100644 --- a/packages/@aws-cdk/aws-codebuild/test/integ.project-shell.expected.json +++ b/packages/@aws-cdk/aws-codebuild/test/integ.project-shell.expected.json @@ -219,7 +219,7 @@ } } ], - "Image": "aws/codebuild/ubuntu-base:14.04", + "Image": "aws/codebuild/standard:1.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, 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 48d7151aeb05c..2bd7159044e5b 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 @@ -489,7 +489,7 @@ } } ], - "Image": "aws/codebuild/ubuntu-base:14.04", + "Image": "aws/codebuild/standard:1.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, diff --git a/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts b/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts index 8cd3dd1891e5e..441f9093a627c 100644 --- a/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts +++ b/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts @@ -128,7 +128,7 @@ export = { "Environment": { "Type": "LINUX_CONTAINER", "PrivilegedMode": false, - "Image": "aws/codebuild/ubuntu-base:14.04", + "Image": "aws/codebuild/standard:1.0", "ComputeType": "BUILD_GENERAL1_SMALL" } } @@ -266,7 +266,7 @@ export = { }, "Environment": { "ComputeType": "BUILD_GENERAL1_SMALL", - "Image": "aws/codebuild/ubuntu-base:14.04", + "Image": "aws/codebuild/standard:1.0", "PrivilegedMode": false, "Type": "LINUX_CONTAINER" }, @@ -766,7 +766,7 @@ export = { "Environment": { "Type": "LINUX_CONTAINER", "PrivilegedMode": false, - "Image": "aws/codebuild/ubuntu-base:14.04", + "Image": "aws/codebuild/standard:1.0", "ComputeType": "BUILD_GENERAL1_SMALL" } })); @@ -797,7 +797,7 @@ export = { "Environment": { "Type": "LINUX_CONTAINER", "PrivilegedMode": false, - "Image": "aws/codebuild/ubuntu-base:14.04", + "Image": "aws/codebuild/standard:1.0", "ComputeType": "BUILD_GENERAL1_SMALL" } })); @@ -1002,7 +1002,7 @@ export = { } ], "PrivilegedMode": false, - "Image": "aws/codebuild/ubuntu-base:14.04", + "Image": "aws/codebuild/standard:1.0", "ComputeType": "BUILD_GENERAL1_SMALL" } }));