diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/ProjectTestDefaultTestDeployAssert638ACE4F.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/ProjectTestDefaultTestDeployAssert638ACE4F.assets.json new file mode 100644 index 0000000000000..406833933bccf --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/ProjectTestDefaultTestDeployAssert638ACE4F.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { + "source": { + "path": "ProjectTestDefaultTestDeployAssert638ACE4F.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.github-webhook-workflow-job-queued.js.snapshot/ProjectTestDefaultTestDeployAssert638ACE4F.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/ProjectTestDefaultTestDeployAssert638ACE4F.template.json new file mode 100644 index 0000000000000..ad9d0fb73d1dd --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/ProjectTestDefaultTestDeployAssert638ACE4F.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.github-webhook-workflow-job-queued.js.snapshot/cdk.out b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/cdk.out new file mode 100644 index 0000000000000..1f0068d32659a --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/cdk.out @@ -0,0 +1 @@ +{"version":"36.0.0"} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/integ.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/integ.json new file mode 100644 index 0000000000000..6d175c6391070 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/integ.json @@ -0,0 +1,12 @@ +{ + "version": "36.0.0", + "testCases": { + "ProjectTest/DefaultTest": { + "stacks": [ + "test-codebuild-github-webhook-workflow-job-queued" + ], + "assertionStack": "ProjectTest/DefaultTest/DeployAssert", + "assertionStackName": "ProjectTestDefaultTestDeployAssert638ACE4F" + } + } +} \ No newline at end of file diff --git a/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/manifest.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/manifest.json new file mode 100644 index 0000000000000..976592dc5c752 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/manifest.json @@ -0,0 +1,125 @@ +{ + "version": "36.0.0", + "artifacts": { + "test-codebuild-github-webhook-workflow-job-queued.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "test-codebuild-github-webhook-workflow-job-queued.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "test-codebuild-github-webhook-workflow-job-queued": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "test-codebuild-github-webhook-workflow-job-queued.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}/f4c74c4d08a460df833261b036cc4051884a8c475bc7eaaea6c4b08b0ff530f3.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", + "additionalDependencies": [ + "test-codebuild-github-webhook-workflow-job-queued.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": [ + "test-codebuild-github-webhook-workflow-job-queued.assets" + ], + "metadata": { + "/test-codebuild-github-webhook-workflow-job-queued/MyProject/Role/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyProjectRole9BBE5233" + } + ], + "/test-codebuild-github-webhook-workflow-job-queued/MyProject/Role/DefaultPolicy/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyProjectRoleDefaultPolicyB19B7C29" + } + ], + "/test-codebuild-github-webhook-workflow-job-queued/MyProject/Resource": [ + { + "type": "aws:cdk:logicalId", + "data": "MyProject39F7B0AE" + } + ], + "/test-codebuild-github-webhook-workflow-job-queued/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/test-codebuild-github-webhook-workflow-job-queued/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "test-codebuild-github-webhook-workflow-job-queued" + }, + "ProjectTestDefaultTestDeployAssert638ACE4F.assets": { + "type": "cdk:asset-manifest", + "properties": { + "file": "ProjectTestDefaultTestDeployAssert638ACE4F.assets.json", + "requiresBootstrapStackVersion": 6, + "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version" + } + }, + "ProjectTestDefaultTestDeployAssert638ACE4F": { + "type": "aws:cloudformation:stack", + "environment": "aws://unknown-account/unknown-region", + "properties": { + "templateFile": "ProjectTestDefaultTestDeployAssert638ACE4F.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": [ + "ProjectTestDefaultTestDeployAssert638ACE4F.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": [ + "ProjectTestDefaultTestDeployAssert638ACE4F.assets" + ], + "metadata": { + "/ProjectTest/DefaultTest/DeployAssert/BootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "BootstrapVersion" + } + ], + "/ProjectTest/DefaultTest/DeployAssert/CheckBootstrapVersion": [ + { + "type": "aws:cdk:logicalId", + "data": "CheckBootstrapVersion" + } + ] + }, + "displayName": "ProjectTest/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.github-webhook-workflow-job-queued.js.snapshot/test-codebuild-github-webhook-workflow-job-queued.assets.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/test-codebuild-github-webhook-workflow-job-queued.assets.json new file mode 100644 index 0000000000000..ae99526715010 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/test-codebuild-github-webhook-workflow-job-queued.assets.json @@ -0,0 +1,19 @@ +{ + "version": "36.0.0", + "files": { + "f4c74c4d08a460df833261b036cc4051884a8c475bc7eaaea6c4b08b0ff530f3": { + "source": { + "path": "test-codebuild-github-webhook-workflow-job-queued.template.json", + "packaging": "file" + }, + "destinations": { + "current_account-current_region": { + "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", + "objectKey": "f4c74c4d08a460df833261b036cc4051884a8c475bc7eaaea6c4b08b0ff530f3.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.github-webhook-workflow-job-queued.js.snapshot/test-codebuild-github-webhook-workflow-job-queued.template.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/test-codebuild-github-webhook-workflow-job-queued.template.json new file mode 100644 index 0000000000000..0236f661b1ff7 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/test-codebuild-github-webhook-workflow-job-queued.template.json @@ -0,0 +1,169 @@ +{ + "Resources": { + "MyProjectRole9BBE5233": { + "Type": "AWS::IAM::Role", + "Properties": { + "AssumeRolePolicyDocument": { + "Statement": [ + { + "Action": "sts:AssumeRole", + "Effect": "Allow", + "Principal": { + "Service": "codebuild.amazonaws.com" + } + } + ], + "Version": "2012-10-17" + } + } + }, + "MyProjectRoleDefaultPolicyB19B7C29": { + "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": "MyProject39F7B0AE" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "MyProject39F7B0AE" + } + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "PolicyName": "MyProjectRoleDefaultPolicyB19B7C29", + "Roles": [ + { + "Ref": "MyProjectRole9BBE5233" + } + ] + } + }, + "MyProject39F7B0AE": { + "Type": "AWS::CodeBuild::Project", + "Properties": { + "Artifacts": { + "Type": "NO_ARTIFACTS" + }, + "Cache": { + "Type": "NO_CACHE" + }, + "EncryptionKey": "alias/aws/s3", + "Environment": { + "ComputeType": "BUILD_GENERAL1_SMALL", + "Image": "aws/codebuild/standard:1.0", + "ImagePullCredentialsType": "CODEBUILD", + "PrivilegedMode": false, + "Type": "LINUX_CONTAINER" + }, + "ServiceRole": { + "Fn::GetAtt": [ + "MyProjectRole9BBE5233", + "Arn" + ] + }, + "Source": { + "Location": "https://github.com/aws/aws-cdk.git", + "ReportBuildStatus": false, + "Type": "GITHUB" + }, + "Triggers": { + "FilterGroups": [ + [ + { + "Pattern": "WORKFLOW_JOB_QUEUED", + "Type": "EVENT" + } + ] + ], + "Webhook": true + } + } + } + }, + "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.github-webhook-workflow-job-queued.js.snapshot/tree.json b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/tree.json new file mode 100644 index 0000000000000..329043570fa8f --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.js.snapshot/tree.json @@ -0,0 +1,294 @@ +{ + "version": "tree-0.1", + "tree": { + "id": "App", + "path": "", + "children": { + "test-codebuild-github-webhook-workflow-job-queued": { + "id": "test-codebuild-github-webhook-workflow-job-queued", + "path": "test-codebuild-github-webhook-workflow-job-queued", + "children": { + "MyProject": { + "id": "MyProject", + "path": "test-codebuild-github-webhook-workflow-job-queued/MyProject", + "children": { + "Role": { + "id": "Role", + "path": "test-codebuild-github-webhook-workflow-job-queued/MyProject/Role", + "children": { + "ImportRole": { + "id": "ImportRole", + "path": "test-codebuild-github-webhook-workflow-job-queued/MyProject/Role/ImportRole", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "Resource": { + "id": "Resource", + "path": "test-codebuild-github-webhook-workflow-job-queued/MyProject/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": "test-codebuild-github-webhook-workflow-job-queued/MyProject/Role/DefaultPolicy", + "children": { + "Resource": { + "id": "Resource", + "path": "test-codebuild-github-webhook-workflow-job-queued/MyProject/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": "MyProject39F7B0AE" + }, + ":*" + ] + ] + }, + { + "Fn::Join": [ + "", + [ + "arn:", + { + "Ref": "AWS::Partition" + }, + ":logs:", + { + "Ref": "AWS::Region" + }, + ":", + { + "Ref": "AWS::AccountId" + }, + ":log-group:/aws/codebuild/", + { + "Ref": "MyProject39F7B0AE" + } + ] + ] + } + ] + } + ], + "Version": "2012-10-17" + }, + "policyName": "MyProjectRoleDefaultPolicyB19B7C29", + "roles": [ + { + "Ref": "MyProjectRole9BBE5233" + } + ] + } + }, + "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": "test-codebuild-github-webhook-workflow-job-queued/MyProject/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": "LINUX_CONTAINER", + "image": "aws/codebuild/standard:1.0", + "imagePullCredentialsType": "CODEBUILD", + "privilegedMode": false, + "computeType": "BUILD_GENERAL1_SMALL" + }, + "serviceRole": { + "Fn::GetAtt": [ + "MyProjectRole9BBE5233", + "Arn" + ] + }, + "source": { + "type": "GITHUB", + "reportBuildStatus": false, + "location": "https://github.com/aws/aws-cdk.git" + }, + "triggers": { + "webhook": true, + "filterGroups": [ + [ + { + "type": "EVENT", + "pattern": "WORKFLOW_JOB_QUEUED" + } + ] + ] + } + } + }, + "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": "test-codebuild-github-webhook-workflow-job-queued/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "test-codebuild-github-webhook-workflow-job-queued/CheckBootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnRule", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Stack", + "version": "0.0.0" + } + }, + "ProjectTest": { + "id": "ProjectTest", + "path": "ProjectTest", + "children": { + "DefaultTest": { + "id": "DefaultTest", + "path": "ProjectTest/DefaultTest", + "children": { + "Default": { + "id": "Default", + "path": "ProjectTest/DefaultTest/Default", + "constructInfo": { + "fqn": "constructs.Construct", + "version": "10.3.0" + } + }, + "DeployAssert": { + "id": "DeployAssert", + "path": "ProjectTest/DefaultTest/DeployAssert", + "children": { + "BootstrapVersion": { + "id": "BootstrapVersion", + "path": "ProjectTest/DefaultTest/DeployAssert/BootstrapVersion", + "constructInfo": { + "fqn": "aws-cdk-lib.CfnParameter", + "version": "0.0.0" + } + }, + "CheckBootstrapVersion": { + "id": "CheckBootstrapVersion", + "path": "ProjectTest/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.github-webhook-workflow-job-queued.ts b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.ts new file mode 100644 index 0000000000000..2a6c279d26d34 --- /dev/null +++ b/packages/@aws-cdk-testing/framework-integ/test/aws-codebuild/test/integ.github-webhook-workflow-job-queued.ts @@ -0,0 +1,30 @@ +import * as cdk from 'aws-cdk-lib'; +import * as codebuild from 'aws-cdk-lib/aws-codebuild'; +import { IntegTest } from '@aws-cdk/integ-tests-alpha'; + +class TestStack extends cdk.Stack { + constructor(scope: cdk.App, id: string) { + super(scope, id); + + const source = codebuild.Source.gitHub({ + owner: 'aws', + repo: 'aws-cdk', + reportBuildStatus: false, + webhook: true, + webhookFilters: [ + codebuild.FilterGroup.inEventOf(codebuild.EventAction.WORKFLOW_JOB_QUEUED), + ], + }); + new codebuild.Project(this, 'MyProject', { + source, + grantReportGroupPermissions: false, + }); + } +} + +const app = new cdk.App(); + +const stack = new TestStack(app, 'test-codebuild-github-webhook-workflow-job-queued'); +new IntegTest(app, 'ProjectTest', { + testCases: [stack], +}); diff --git a/packages/aws-cdk-lib/aws-codebuild/README.md b/packages/aws-cdk-lib/aws-codebuild/README.md index 9f96d90097cd0..81dd0e161c18e 100644 --- a/packages/aws-cdk-lib/aws-codebuild/README.md +++ b/packages/aws-cdk-lib/aws-codebuild/README.md @@ -69,6 +69,9 @@ const gitHubSource = codebuild.Source.gitHub({ .inEventOf(codebuild.EventAction.PUSH) .andBranchIs('main') .andCommitMessageIs('the commit message'), + codebuild.FilterGroup + .inEventOf(codebuild.EventAction.RELEASED) + .andBranchIs('main') ], // optional, by default all pushes and Pull Requests will trigger a build }); ``` diff --git a/packages/aws-cdk-lib/aws-codebuild/lib/source.ts b/packages/aws-cdk-lib/aws-codebuild/lib/source.ts index 42a231bdacd06..5e2250fdafe3e 100644 --- a/packages/aws-cdk-lib/aws-codebuild/lib/source.ts +++ b/packages/aws-cdk-lib/aws-codebuild/lib/source.ts @@ -178,6 +178,11 @@ export enum EventAction { */ PULL_REQUEST_UPDATED = 'PULL_REQUEST_UPDATED', + /** + * Closing a Pull Request. + */ + PULL_REQUEST_CLOSED = 'PULL_REQUEST_CLOSED', + /** * Merging a Pull Request. */ @@ -188,6 +193,24 @@ export enum EventAction { * Note that this event is only supported for GitHub and GitHubEnterprise sources. */ PULL_REQUEST_REOPENED = 'PULL_REQUEST_REOPENED', + + /** + * A release is created in the repository. + * Works with GitHub only. + */ + RELEASED = 'RELEASED', + + /** + * A prerelease is created in the repository. + * Works with GitHub only. + */ + PRERELEASED = 'PRERELEASED', + + /** + * A workflow job is queued in the repository. + * Works with GitHub only. + */ + WORKFLOW_JOB_QUEUED = 'WORKFLOW_JOB_QUEUED', } enum WebhookFilterTypes { 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 b9d2c4cb8de7c..e632bd6ba1f60 100644 --- a/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts +++ b/packages/aws-cdk-lib/aws-codebuild/test/codebuild.test.ts @@ -567,6 +567,9 @@ describe('default properties', () => { webhookFilters: [ codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH).andTagIsNot('stable'), codebuild.FilterGroup.inEventOf(codebuild.EventAction.PULL_REQUEST_REOPENED).andBaseBranchIs('main'), + codebuild.FilterGroup.inEventOf(codebuild.EventAction.RELEASED).andBaseBranchIs('main'), + codebuild.FilterGroup.inEventOf(codebuild.EventAction.PRERELEASED).andBaseBranchIs('main'), + codebuild.FilterGroup.inEventOf(codebuild.EventAction.WORKFLOW_JOB_QUEUED).andBaseBranchIs('main'), ], }), }); @@ -595,6 +598,18 @@ describe('default properties', () => { { Type: 'EVENT', Pattern: 'PULL_REQUEST_REOPENED' }, { Type: 'BASE_REF', Pattern: 'refs/heads/main' }, ], + [ + { Type: 'EVENT', Pattern: 'RELEASED' }, + { Type: 'BASE_REF', Pattern: 'refs/heads/main' }, + ], + [ + { Type: 'EVENT', Pattern: 'PRERELEASED' }, + { Type: 'BASE_REF', Pattern: 'refs/heads/main' }, + ], + [ + { Type: 'EVENT', Pattern: 'WORKFLOW_JOB_QUEUED' }, + { Type: 'BASE_REF', Pattern: 'refs/heads/main' }, + ], ], }, }); @@ -664,6 +679,7 @@ describe('default properties', () => { codebuild.EventAction.PULL_REQUEST_CREATED, codebuild.EventAction.PULL_REQUEST_UPDATED, codebuild.EventAction.PULL_REQUEST_MERGED, + codebuild.EventAction.PULL_REQUEST_CLOSED, ).andTagIs('v.*'), // duplicate event actions are fine codebuild.FilterGroup.inEventOf(codebuild.EventAction.PUSH, codebuild.EventAction.PUSH).andActorAccountIsNot('aws-cdk-dev'), @@ -685,7 +701,7 @@ describe('default properties', () => { Webhook: true, FilterGroups: [ [ - { Type: 'EVENT', Pattern: 'PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED, PULL_REQUEST_MERGED' }, + { Type: 'EVENT', Pattern: 'PULL_REQUEST_CREATED, PULL_REQUEST_UPDATED, PULL_REQUEST_MERGED, PULL_REQUEST_CLOSED' }, { Type: 'HEAD_REF', Pattern: 'refs/tags/v.*' }, ], [