diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/cdk.out new file mode 100644 index 0000000000000..bd5311dc372de --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.5"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/codebuild-project-arm.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/codebuild-project-arm.assets.json new file mode 100644 index 0000000000000..15d66e1bb38f4 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/codebuild-project-arm.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.5", + "files": { + "fb14db2f3f849c96db420afc9fd158b99550fa4ffa602209cd78e471a282fc4a": { + "source": { + "path": "codebuild-project-arm.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "fb14db2f3f849c96db420afc9fd158b99550fa4ffa602209cd78e471a282fc4a.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/codebuild-project-arm.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/codebuild-project-arm.template.json new file mode 100644 index 0000000000000..a902bdb9a33ce --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/codebuild-project-arm.template.json @@ -0,0 +1,497 @@ +{ + "Resources": { + "MyProjectMediumRole1F3769C8": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "MyProjectMediumRoleDefaultPolicy08D66D98": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "MyProjectMediumE40D9677" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "MyProjectMediumE40D9677" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "MyProjectMediumE40D9677" + }, + "-*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "MyProjectMediumRoleDefaultPolicy08D66D98", + "Roles": [ + { + "Ref": "MyProjectMediumRole1F3769C8" + } + ] + } + }, + "MyProjectMediumE40D9677": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "NO_ARTIFACTS" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": "alias/aws/s3", + "Environment": { + "ComputeType": "BUILD_GENERAL1_MEDIUM", + "Image": "aws/codebuild/amazonlinux2-aarch64-standard:3.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "ARM_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "MyProjectMediumRole1F3769C8", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\"\n}", + "Type": "NO_SOURCE" + } + } + }, + "MyProjectXLargeRoleC17867F7": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "MyProjectXLargeRoleDefaultPolicyACC3F91E": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "MyProjectXLarge21A68AC6" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "MyProjectXLarge21A68AC6" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "MyProjectXLarge21A68AC6" + }, + "-*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "MyProjectXLargeRoleDefaultPolicyACC3F91E", + "Roles": [ + { + "Ref": "MyProjectXLargeRoleC17867F7" + } + ] + } + }, + "MyProjectXLarge21A68AC6": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "NO_ARTIFACTS" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": "alias/aws/s3", + "Environment": { + "ComputeType": "BUILD_GENERAL1_XLARGE", + "Image": "aws/codebuild/amazonlinux2-aarch64-standard:3.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "ARM_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "MyProjectXLargeRoleC17867F7", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\"\n}", + "Type": "NO_SOURCE" + } + } + }, + "MyProjectX2LargeRole65F64577": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "MyProjectX2LargeRoleDefaultPolicy241428C8": { + "Type": "AWS::IAM::Policy", + "Properties": { + "PolicyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "MyProjectX2Large715B77CC" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "MyProjectX2Large715B77CC" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "MyProjectX2Large715B77CC" + }, + "-*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "MyProjectX2LargeRoleDefaultPolicy241428C8", + "Roles": [ + { + "Ref": "MyProjectX2LargeRole65F64577" + } + ] + } + }, + "MyProjectX2Large715B77CC": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "NO_ARTIFACTS" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": "alias/aws/s3", + "Environment": { + "ComputeType": "BUILD_GENERAL1_2XLARGE", + "Image": "aws/codebuild/amazonlinux2-aarch64-standard:3.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "ARM_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "MyProjectX2LargeRole65F64577", + "Arn" + ] + }, + "Source": { + "BuildSpec": "{\n \"version\": \"0.2\"\n}", + "Type": "NO_SOURCE" + } + } + } + }, + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/integ.json new file mode 100644 index 0000000000000..1b19409d332b6 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "36.0.5", + "testCases": { + "integ-test-codebuild-project-arm/DefaultTest": { + "stacks": [ + "codebuild-project-arm" + ], + "assertionStack": "integ-test-codebuild-project-arm/DefaultTest/DeployAssert", + "assertionStackName": "integtestcodebuildprojectarmDefaultTestDeployAssert4EE92337" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/integtestcodebuildprojectarmDefaultTestDeployAssert4EE92337.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/integtestcodebuildprojectarmDefaultTestDeployAssert4EE92337.assets.json new file mode 100644 index 0000000000000..f367aa992702d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/integtestcodebuildprojectarmDefaultTestDeployAssert4EE92337.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.5", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "integtestcodebuildprojectarmDefaultTestDeployAssert4EE92337.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" + } + } + } + }, + "dockerImages": {} +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/integtestcodebuildprojectarmDefaultTestDeployAssert4EE92337.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/integtestcodebuildprojectarmDefaultTestDeployAssert4EE92337.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/integtestcodebuildprojectarmDefaultTestDeployAssert4EE92337.template.json @@ -0,0 +1,36 @@ +{ + "Parameters": { + "BootstrapVersion": { + "Type": "AWS::SSM::Parameter::Value", + "Default": "/cdk-bootstrap/hnb659fds/version", + "Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" + } + }, + "Rules": { + "CheckBootstrapVersion": { + "Assertions": [ + { + "Assert": { + "Fn::Not": [ + { + "Fn::Contains": [ + [ + "1", + "2", + "3", + "4", + "5" + ], + { + "Ref": "BootstrapVersion" + } + ] + } + ] + }, + "AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." + } + ] + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/manifest.json new file mode 100644 index 0000000000000..9a9ed7d53e31d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/manifest.json @@ -0,0 +1,161 @@ +{ + "version": "36.0.5", + "artifacts": { + "codebuild-project-arm.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "codebuild-project-arm.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "codebuild-project-arm": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "codebuild-project-arm.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/fb14db2f3f849c96db420afc9fd158b99550fa4ffa602209cd78e471a282fc4a.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "codebuild-project-arm.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "codebuild-project-arm.assets" + ], + "metadata": { + "/codebuild-project-arm/MyProjectMedium/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyProjectMediumRole1F3769C8" + } + ], + "/codebuild-project-arm/MyProjectMedium/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyProjectMediumRoleDefaultPolicy08D66D98" + } + ], + "/codebuild-project-arm/MyProjectMedium/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyProjectMediumE40D9677" + } + ], + "/codebuild-project-arm/MyProjectXLarge/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyProjectXLargeRoleC17867F7" + } + ], + "/codebuild-project-arm/MyProjectXLarge/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyProjectXLargeRoleDefaultPolicyACC3F91E" + } + ], + "/codebuild-project-arm/MyProjectXLarge/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyProjectXLarge21A68AC6" + } + ], + "/codebuild-project-arm/MyProjectX2Large/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyProjectX2LargeRole65F64577" + } + ], + "/codebuild-project-arm/MyProjectX2Large/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyProjectX2LargeRoleDefaultPolicy241428C8" + } + ], + "/codebuild-project-arm/MyProjectX2Large/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyProjectX2Large715B77CC" + } + ], + "/codebuild-project-arm/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/codebuild-project-arm/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "codebuild-project-arm" + }, + "integtestcodebuildprojectarmDefaultTestDeployAssert4EE92337.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "integtestcodebuildprojectarmDefaultTestDeployAssert4EE92337.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "integtestcodebuildprojectarmDefaultTestDeployAssert4EE92337": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "integtestcodebuildprojectarmDefaultTestDeployAssert4EE92337.template.json", + "terminationProtection": false, + "validateOnSynth": false, + "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", + "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "integtestcodebuildprojectarmDefaultTestDeployAssert4EE92337.assets" + ], + "lookupRole": { + "arn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-lookup-role-${AWS::AccountId}-${AWS::Region}", + "requiresBootstrapStackVersion": 8, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "dependencies": [ + "integtestcodebuildprojectarmDefaultTestDeployAssert4EE92337.assets" + ], + "metadata": { + "/integ-test-codebuild-project-arm/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/integ-test-codebuild-project-arm/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "integ-test-codebuild-project-arm/DefaultTest/DeployAssert" + }, + "Tree": { + "type": "cdk:tree", + "properties": { + "file": "tree.json" + } + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/tree.json new file mode 100644 index 0000000000000..a3bb52be1cc6d --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.js.snapshot/tree.json @@ -0,0 +1,746 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "codebuild-project-arm": { + "id": "codebuild-project-arm", + "path": "codebuild-project-arm", + "children": { + "MyProjectMedium": { + "id": "MyProjectMedium", + "path": "codebuild-project-arm/MyProjectMedium", + "children": { + "Role": { + "id": "Role", + "path": "codebuild-project-arm/MyProjectMedium/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "codebuild-project-arm/MyProjectMedium/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "codebuild-project-arm/MyProjectMedium/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "codebuild-project-arm/MyProjectMedium/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "codebuild-project-arm/MyProjectMedium/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "MyProjectMediumE40D9677" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "MyProjectMediumE40D9677" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "MyProjectMediumE40D9677" + }, + "-*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "MyProjectMediumRoleDefaultPolicy08D66D98", + "roles": [ + { + "Ref": "MyProjectMediumRole1F3769C8" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "codebuild-project-arm/MyProjectMedium/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "NO_ARTIFACTS" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": "alias/aws/s3", + "environment": { + "type": "ARM_CONTAINER", + "image": "aws/codebuild/amazonlinux2-aarch64-standard:3.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_MEDIUM" + }, + "serviceRole": { + "Fn::GetAtt": [ + "MyProjectMediumRole1F3769C8", + "Arn" + ] + }, + "source": { + "type": "NO_SOURCE", + "buildSpec": "{\n \"version\": \"0.2\"\n}" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.Project", + "version": "0.0.0" + } + }, + "MyProjectXLarge": { + "id": "MyProjectXLarge", + "path": "codebuild-project-arm/MyProjectXLarge", + "children": { + "Role": { + "id": "Role", + "path": "codebuild-project-arm/MyProjectXLarge/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "codebuild-project-arm/MyProjectXLarge/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "codebuild-project-arm/MyProjectXLarge/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "codebuild-project-arm/MyProjectXLarge/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "codebuild-project-arm/MyProjectXLarge/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "MyProjectXLarge21A68AC6" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "MyProjectXLarge21A68AC6" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "MyProjectXLarge21A68AC6" + }, + "-*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "MyProjectXLargeRoleDefaultPolicyACC3F91E", + "roles": [ + { + "Ref": "MyProjectXLargeRoleC17867F7" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "codebuild-project-arm/MyProjectXLarge/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "NO_ARTIFACTS" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": "alias/aws/s3", + "environment": { + "type": "ARM_CONTAINER", + "image": "aws/codebuild/amazonlinux2-aarch64-standard:3.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_XLARGE" + }, + "serviceRole": { + "Fn::GetAtt": [ + "MyProjectXLargeRoleC17867F7", + "Arn" + ] + }, + "source": { + "type": "NO_SOURCE", + "buildSpec": "{\n \"version\": \"0.2\"\n}" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.Project", + "version": "0.0.0" + } + }, + "MyProjectX2Large": { + "id": "MyProjectX2Large", + "path": "codebuild-project-arm/MyProjectX2Large", + "children": { + "Role": { + "id": "Role", + "path": "codebuild-project-arm/MyProjectX2Large/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "codebuild-project-arm/MyProjectX2Large/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "codebuild-project-arm/MyProjectX2Large/Role/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Role", + "aws:cdk:cloudformation:props": { + "assumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnRole", + "version": "0.0.0" + } + }, + "DefaultPolicy": { + "id": "DefaultPolicy", + "path": "codebuild-project-arm/MyProjectX2Large/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "codebuild-project-arm/MyProjectX2Large/Role/DefaultPolicy/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::IAM::Policy", + "aws:cdk:cloudformation:props": { + "policyDocument": { + "Statement": [ + { + "Action": [ + "logs:CreateLogGroup", + "logs:CreateLogStream", + "logs:PutLogEvents" + ], + "Effect": "Allow", + "Resource": [ + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "MyProjectX2Large715B77CC" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "MyProjectX2Large715B77CC" + } + ] + ] + } + ] + }, + { + "Action": [ + "codebuild:BatchPutCodeCoverages", + "codebuild:BatchPutTestCases", + "codebuild:CreateReport", + "codebuild:CreateReportGroup", + "codebuild:UpdateReport" + ], + "Effect": "Allow", + "Resource": { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":codebuild:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":report-group/", + { + "Ref": "MyProjectX2Large715B77CC" + }, + "-*" + ] + ] + } + } + ], + "Version": "2012-10-17" + }, + "policyName": "MyProjectX2LargeRoleDefaultPolicy241428C8", + "roles": [ + { + "Ref": "MyProjectX2LargeRole65F64577" + } + ] + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.CfnPolicy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Policy", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_iam.Role", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "codebuild-project-arm/MyProjectX2Large/Resource", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::CodeBuild::Project", + "aws:cdk:cloudformation:props": { + "artifacts": { + "type": "NO_ARTIFACTS" + }, + "cache": { + "type": "NO_CACHE" + }, + "encryptionKey": "alias/aws/s3", + "environment": { + "type": "ARM_CONTAINER", + "image": "aws/codebuild/amazonlinux2-aarch64-standard:3.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_2XLARGE" + }, + "serviceRole": { + "Fn::GetAtt": [ + "MyProjectX2LargeRole65F64577", + "Arn" + ] + }, + "source": { + "type": "NO_SOURCE", + "buildSpec": "{\n \"version\": \"0.2\"\n}" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.CfnProject", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_codebuild.Project", + "version": "0.0.0" + } + }, + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "codebuild-project-arm/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "codebuild-project-arm/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "integ-test-codebuild-project-arm": { + "id": "integ-test-codebuild-project-arm", + "path": "integ-test-codebuild-project-arm", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "integ-test-codebuild-project-arm/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "integ-test-codebuild-project-arm/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "integ-test-codebuild-project-arm/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "integ-test-codebuild-project-arm/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "integ-test-codebuild-project-arm/DefaultTest/DeployAssert/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTestCase", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/integ-tests-alpha.IntegTest", + "version": "0.0.0" + } + }, + "Tree": { + "id": "Tree", + "path": "Tree", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.App", + "version": "0.0.0" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.ts new file mode 100644 index 0000000000000..bf40ca6e8fac8 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.project-linux-arm.ts @@ -0,0 +1,48 @@ +import { App, Stack } from 'aws-cdk-lib'; +import { Construct } from 'constructs'; +import { BuildSpec, ComputeType, LinuxBuildImage, Project } from 'aws-cdk-lib/aws-codebuild'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; + +class AmazonLinuxArmTestStack extends Stack { + constructor(scope: Construct, id: string) { + super(scope, id); + + new Project(this, 'MyProjectMedium', { + buildSpec: BuildSpec.fromObject({ + version: '0.2', + }), + environment: { + buildImage: LinuxBuildImage.AMAZON_LINUX_2_ARM_3, + computeType: ComputeType.MEDIUM, + }, + }); + + new Project(this, 'MyProjectXLarge', { + buildSpec: BuildSpec.fromObject({ + version: '0.2', + }), + environment: { + buildImage: LinuxBuildImage.AMAZON_LINUX_2_ARM_3, + computeType: ComputeType.X_LARGE, + }, + }); + + new Project(this, 'MyProjectX2Large', { + buildSpec: BuildSpec.fromObject({ + version: '0.2', + }), + environment: { + buildImage: LinuxBuildImage.AMAZON_LINUX_2_ARM_3, + computeType: ComputeType.X2_LARGE, + }, + }); + } +} + +const app = new App(); + +const codebuildArm = new AmazonLinuxArmTestStack(app, 'codebuild-project-arm'); + +new IntegTest(app, 'integ-test-codebuild-project-arm', { + testCases: [codebuildArm], +}); diff --git a/packages/aws-cdk-lib/aws-codebuild/lib/linux-arm-build-image.ts b/packages/aws-cdk-lib/aws-codebuild/lib/linux-arm-build-image.ts index 3d32d529cd3ec..7d6e507d152e2 100644 --- a/packages/aws-cdk-lib/aws-codebuild/lib/linux-arm-build-image.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/linux-arm-build-image.ts @@ -2,7 +2,7 @@ import { BuildSpec } from './build-spec'; import { ComputeType } from './compute-type'; import { EnvironmentType } from './environment-type'; import { runScriptLinuxBuildSpec } from './private/run-script-linux-build-spec'; -import { BuildEnvironment, IBuildImage, ImagePullPrincipalType, DockerImageOptions } from './project'; +import { BuildEnvironment, IBuildImage, ImagePullPrincipalType, DockerImageOptions, isLambdaComputeType } from './project'; import * as ecr from '../../aws-ecr'; import * as secretsmanager from '../../aws-secretsmanager'; @@ -103,17 +103,13 @@ export class LinuxArmBuildImage implements IBuildImage { } /** - * Validates by checking the BuildEnvironment computeType as aarch64 images only support ComputeType.SMALL and - * ComputeType.LARGE + * Validates by checking the BuildEnvironments' images are not Lambda ComputeTypes * @param buildEnvironment BuildEnvironment */ public validate(buildEnvironment: BuildEnvironment): string[] { const ret = []; - if (buildEnvironment.computeType && - buildEnvironment.computeType !== ComputeType.SMALL && - buildEnvironment.computeType !== ComputeType.LARGE) { - ret.push(`ARM images only support ComputeTypes '${ComputeType.SMALL}' and '${ComputeType.LARGE}' - ` + - `'${buildEnvironment.computeType}' was given`); + if (buildEnvironment.computeType && isLambdaComputeType(buildEnvironment.computeType)) { + ret.push(`ARM images do not support Lambda ComputeTypes, got ${buildEnvironment.computeType}`); } return ret; } diff --git a/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts b/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts index 3eb3ac3fe6894..e0923a70b1b3b 100644 --- a/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts +++ b/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts @@ -1751,12 +1751,12 @@ describe('Linux x86-64 Image', () => { }); describe('ARM image', () => { - describe('AMAZON_LINUX_2_ARM', () => { + describe('AMAZON_LINUX_2_ARM_3', () => { test('has type ARM_CONTAINER and default ComputeType LARGE', () => { const stack = new cdk.Stack(); new codebuild.PipelineProject(stack, 'Project', { environment: { - buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, + buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM_3, }, }); @@ -1773,7 +1773,7 @@ describe('ARM image', () => { new codebuild.PipelineProject(stack, 'Project', { environment: { computeType: codebuild.ComputeType.SMALL, - buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, + buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM_3, }, }); @@ -1785,17 +1785,22 @@ describe('ARM image', () => { }); }); - test('cannot be used in conjunction with ComputeType MEDIUM', () => { + test('can be used with ComputeType MEDIUM', () => { const stack = new cdk.Stack(); - expect(() => { - new codebuild.PipelineProject(stack, 'Project', { - environment: { - buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, - computeType: codebuild.ComputeType.MEDIUM, - }, - }); - }).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_MEDIUM' was given/); + new codebuild.PipelineProject(stack, 'Project', { + environment: { + buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM_3, + computeType: codebuild.ComputeType.MEDIUM, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'Environment': { + 'Type': 'ARM_CONTAINER', + 'ComputeType': 'BUILD_GENERAL1_MEDIUM', + }, + }); }); test('can be used with ComputeType LARGE', () => { @@ -1803,7 +1808,7 @@ describe('ARM image', () => { new codebuild.PipelineProject(stack, 'Project', { environment: { computeType: codebuild.ComputeType.LARGE, - buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, + buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM_3, }, }); @@ -1815,17 +1820,39 @@ describe('ARM image', () => { }); }); - test('cannot be used in conjunction with ComputeType X2_LARGE', () => { + test('can be used with ComputeType X_LARGE', () => { const stack = new cdk.Stack(); + new codebuild.PipelineProject(stack, 'Project', { + environment: { + computeType: codebuild.ComputeType.X_LARGE, + buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM_3, + }, + }); - expect(() => { - new codebuild.PipelineProject(stack, 'Project', { - environment: { - buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, - computeType: codebuild.ComputeType.X2_LARGE, - }, - }); - }).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_2XLARGE' was given/); + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'Environment': { + 'Type': 'ARM_CONTAINER', + 'ComputeType': 'BUILD_GENERAL1_XLARGE', + }, + }); + }); + + test('can be used with ComputeType X2_LARGE', () => { + const stack = new cdk.Stack(); + + new codebuild.PipelineProject(stack, 'Project', { + environment: { + buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM_3, + computeType: codebuild.ComputeType.X2_LARGE, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + 'Environment': { + 'Type': 'ARM_CONTAINER', + 'ComputeType': 'BUILD_GENERAL1_2XLARGE', + }, + }); }); test('cannot be used in conjunction with ComputeType LAMBDA_1GB', () => { @@ -1834,11 +1861,11 @@ describe('ARM image', () => { expect(() => { new codebuild.PipelineProject(stack, 'Project', { environment: { - buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM, + buildImage: codebuild.LinuxBuildImage.AMAZON_LINUX_2_ARM_3, computeType: codebuild.ComputeType.LAMBDA_1GB, }, }); - }).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_LAMBDA_1GB' was given/); + }).toThrow('Invalid CodeBuild environment: ARM images do not support Lambda ComputeTypes, got BUILD_LAMBDA_1GB'); }); }); }); diff --git a/packages/aws-cdk-lib/aws-codebuild/test/linux-arm-build-image.test.ts b/packages/aws-cdk-lib/aws-codebuild/test/linux-arm-build-image.test.ts index 13c09bd069214..5653bb0ce1f95 100644 --- a/packages/aws-cdk-lib/aws-codebuild/test/linux-arm-build-image.test.ts +++ b/packages/aws-cdk-lib/aws-codebuild/test/linux-arm-build-image.test.ts @@ -38,17 +38,22 @@ describe('Linux ARM build image', () => { }); }); - test('cannot be used in conjunction with ComputeType MEDIUM', () => { + test('can be used with ComputeType MEDIUM', () => { const stack = new cdk.Stack(); - expect(() => { - new codebuild.PipelineProject(stack, 'Project', { - environment: { - buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_1_0, - computeType: codebuild.ComputeType.MEDIUM, - }, - }); - }).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_MEDIUM' was given/); + new codebuild.PipelineProject(stack, 'Project', { + environment: { + buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_1_0, + computeType: codebuild.ComputeType.MEDIUM, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { + Type: 'ARM_CONTAINER', + ComputeType: 'BUILD_GENERAL1_MEDIUM', + }, + }); }); test('can be used with ComputeType LARGE', () => { @@ -68,17 +73,39 @@ describe('Linux ARM build image', () => { }); }); - test('cannot be used in conjunction with ComputeType X2_LARGE', () => { + test('can be used with ComputeType X_LARGE', () => { const stack = new cdk.Stack(); + new codebuild.PipelineProject(stack, 'Project', { + environment: { + computeType: codebuild.ComputeType.X_LARGE, + buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_1_0, + }, + }); - expect(() => { - new codebuild.PipelineProject(stack, 'Project', { - environment: { - buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_1_0, - computeType: codebuild.ComputeType.X2_LARGE, - }, - }); - }).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_2XLARGE' was given/); + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { + Type: 'ARM_CONTAINER', + ComputeType: 'BUILD_GENERAL1_XLARGE', + }, + }); + }); + + test('can be used with ComputeType X2_LARGE', () => { + const stack = new cdk.Stack(); + + new codebuild.PipelineProject(stack, 'Project', { + environment: { + buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_1_0, + computeType: codebuild.ComputeType.X2_LARGE, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { + Type: 'ARM_CONTAINER', + ComputeType: 'BUILD_GENERAL1_2XLARGE', + }, + }); }); }); @@ -116,17 +143,22 @@ describe('Linux ARM build image', () => { }); }); - test('cannot be used in conjunction with ComputeType MEDIUM', () => { + test('can be used with ComputeType MEDIUM', () => { const stack = new cdk.Stack(); - expect(() => { - new codebuild.PipelineProject(stack, 'Project', { - environment: { - buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_2_0, - computeType: codebuild.ComputeType.MEDIUM, - }, - }); - }).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_MEDIUM' was given/); + new codebuild.PipelineProject(stack, 'Project', { + environment: { + buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_2_0, + computeType: codebuild.ComputeType.MEDIUM, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { + Type: 'ARM_CONTAINER', + ComputeType: 'BUILD_GENERAL1_MEDIUM', + }, + }); }); test('can be used with ComputeType LARGE', () => { @@ -146,17 +178,39 @@ describe('Linux ARM build image', () => { }); }); - test('cannot be used in conjunction with ComputeType X2_LARGE', () => { + test('can be used with ComputeType X_LARGE', () => { const stack = new cdk.Stack(); + new codebuild.PipelineProject(stack, 'Project', { + environment: { + computeType: codebuild.ComputeType.X_LARGE, + buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_2_0, + }, + }); - expect(() => { - new codebuild.PipelineProject(stack, 'Project', { - environment: { - buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_2_0, - computeType: codebuild.ComputeType.X2_LARGE, - }, - }); - }).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_2XLARGE' was given/); + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { + Type: 'ARM_CONTAINER', + ComputeType: 'BUILD_GENERAL1_XLARGE', + }, + }); + }); + + test('can be used with ComputeType X2_LARGE', () => { + const stack = new cdk.Stack(); + + new codebuild.PipelineProject(stack, 'Project', { + environment: { + buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_2_0, + computeType: codebuild.ComputeType.X2_LARGE, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { + Type: 'ARM_CONTAINER', + ComputeType: 'BUILD_GENERAL1_2XLARGE', + }, + }); }); }); @@ -194,17 +248,22 @@ describe('Linux ARM build image', () => { }); }); - test('cannot be used in conjunction with ComputeType MEDIUM', () => { + test('can be used with ComputeType MEDIUM', () => { const stack = new cdk.Stack(); - expect(() => { - new codebuild.PipelineProject(stack, 'Project', { - environment: { - buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_3_0, - computeType: codebuild.ComputeType.MEDIUM, - }, - }); - }).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_MEDIUM' was given/); + new codebuild.PipelineProject(stack, 'Project', { + environment: { + buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_3_0, + computeType: codebuild.ComputeType.MEDIUM, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { + Type: 'ARM_CONTAINER', + ComputeType: 'BUILD_GENERAL1_MEDIUM', + }, + }); }); test('can be used with ComputeType LARGE', () => { @@ -224,17 +283,39 @@ describe('Linux ARM build image', () => { }); }); - test('cannot be used in conjunction with ComputeType X2_LARGE', () => { + test('can be used with ComputeType X_LARGE', () => { const stack = new cdk.Stack(); + new codebuild.PipelineProject(stack, 'Project', { + environment: { + computeType: codebuild.ComputeType.X_LARGE, + buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_3_0, + }, + }); - expect(() => { - new codebuild.PipelineProject(stack, 'Project', { - environment: { - buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_3_0, - computeType: codebuild.ComputeType.X2_LARGE, - }, - }); - }).toThrow(/ARM images only support ComputeTypes 'BUILD_GENERAL1_SMALL' and 'BUILD_GENERAL1_LARGE' - 'BUILD_GENERAL1_2XLARGE' was given/); + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { + Type: 'ARM_CONTAINER', + ComputeType: 'BUILD_GENERAL1_XLARGE', + }, + }); + }); + + test('can be used with ComputeType X2_LARGE', () => { + const stack = new cdk.Stack(); + + new codebuild.PipelineProject(stack, 'Project', { + environment: { + buildImage: codebuild.LinuxArmBuildImage.AMAZON_LINUX_2_STANDARD_3_0, + computeType: codebuild.ComputeType.X2_LARGE, + }, + }); + + Template.fromStack(stack).hasResourceProperties('AWS::CodeBuild::Project', { + Environment: { + Type: 'ARM_CONTAINER', + ComputeType: 'BUILD_GENERAL1_2XLARGE', + }, + }); }); });