forked from aws/aws-cdk
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(codebuild): ReportGroup missing test permissions when set to CODE…
…_COVERAGE (aws#21656) Fixes aws#21534 ---- ### All Submissions: * [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [x] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)? * [x] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
1 parent
5e222b2
commit f2aa08e
Showing
11 changed files
with
750 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
packages/@aws-cdk/aws-codebuild/test/integ.report-group.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import * as cdk from '@aws-cdk/core'; | ||
import * as integ from '@aws-cdk/integ-tests'; | ||
import * as codebuild from '../lib'; | ||
|
||
const app = new cdk.App(); | ||
|
||
const stack = new cdk.Stack(app, 'aws-cdk-report-group'); | ||
|
||
const reportGroupCodeCoverage = new codebuild.ReportGroup(stack, 'CoverageReportGroup', { | ||
type: codebuild.ReportGroupType.CODE_COVERAGE, | ||
}); | ||
|
||
const reportGroupTest = new codebuild.ReportGroup(stack, 'TestReportGroup', { | ||
type: codebuild.ReportGroupType.TEST, | ||
}); | ||
|
||
const project = new codebuild.Project(stack, 'MyProject', { | ||
buildSpec: codebuild.BuildSpec.fromObject({ | ||
version: '0.2', | ||
phases: { | ||
build: { | ||
commands: ['echo "Nothing to do!"'], | ||
}, | ||
}, | ||
reports: { | ||
[reportGroupTest.reportGroupArn]: { | ||
'base-directory': 'test-reports', | ||
'file-format': 'JUNITXML', | ||
'files': [ | ||
'**/*', | ||
], | ||
}, | ||
[reportGroupCodeCoverage.reportGroupArn]: { | ||
'base-directory': 'coverage', | ||
'file-format': 'CLOVERXML', | ||
'files': ['clover.xml'], | ||
}, | ||
}, | ||
}), | ||
grantReportGroupPermissions: false, | ||
}); | ||
reportGroupCodeCoverage.grantWrite(project); | ||
reportGroupTest.grantWrite(project); | ||
|
||
new integ.IntegTest(app, 'ReportGroupIntegTest', { | ||
testCases: [stack], | ||
}); | ||
|
||
app.synth(); |
1 change: 1 addition & 0 deletions
1
...rt-group.integ.snapshot/ReportGroupIntegTestDefaultTestDeployAssert57960C5A.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
194 changes: 194 additions & 0 deletions
194
...aws-cdk/aws-codebuild/test/report-group.integ.snapshot/aws-cdk-report-group.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,194 @@ | ||
{ | ||
"Resources": { | ||
"CoverageReportGroupE23151CF": { | ||
"Type": "AWS::CodeBuild::ReportGroup", | ||
"Properties": { | ||
"ExportConfig": { | ||
"ExportConfigType": "NO_EXPORT" | ||
}, | ||
"Type": "CODE_COVERAGE" | ||
}, | ||
"UpdateReplacePolicy": "Retain", | ||
"DeletionPolicy": "Retain" | ||
}, | ||
"TestReportGroup1F49A500": { | ||
"Type": "AWS::CodeBuild::ReportGroup", | ||
"Properties": { | ||
"ExportConfig": { | ||
"ExportConfigType": "NO_EXPORT" | ||
}, | ||
"Type": "TEST" | ||
}, | ||
"UpdateReplacePolicy": "Retain", | ||
"DeletionPolicy": "Retain" | ||
}, | ||
"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" | ||
} | ||
] | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"Action": [ | ||
"codebuild:BatchPutCodeCoverages", | ||
"codebuild:CreateReport", | ||
"codebuild:UpdateReport" | ||
], | ||
"Effect": "Allow", | ||
"Resource": { | ||
"Fn::GetAtt": [ | ||
"CoverageReportGroupE23151CF", | ||
"Arn" | ||
] | ||
} | ||
}, | ||
{ | ||
"Action": [ | ||
"codebuild:BatchPutTestCases", | ||
"codebuild:CreateReport", | ||
"codebuild:UpdateReport" | ||
], | ||
"Effect": "Allow", | ||
"Resource": { | ||
"Fn::GetAtt": [ | ||
"TestReportGroup1F49A500", | ||
"Arn" | ||
] | ||
} | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"PolicyName": "MyProjectRoleDefaultPolicyB19B7C29", | ||
"Roles": [ | ||
{ | ||
"Ref": "MyProjectRole9BBE5233" | ||
} | ||
] | ||
} | ||
}, | ||
"MyProject39F7B0AE": { | ||
"Type": "AWS::CodeBuild::Project", | ||
"Properties": { | ||
"Artifacts": { | ||
"Type": "NO_ARTIFACTS" | ||
}, | ||
"Environment": { | ||
"ComputeType": "BUILD_GENERAL1_SMALL", | ||
"Image": "aws/codebuild/standard:1.0", | ||
"ImagePullCredentialsType": "CODEBUILD", | ||
"PrivilegedMode": false, | ||
"Type": "LINUX_CONTAINER" | ||
}, | ||
"ServiceRole": { | ||
"Fn::GetAtt": [ | ||
"MyProjectRole9BBE5233", | ||
"Arn" | ||
] | ||
}, | ||
"Source": { | ||
"BuildSpec": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"{\n \"version\": \"0.2\",\n \"phases\": {\n \"build\": {\n \"commands\": [\n \"echo \\\"Nothing to do!\\\"\"\n ]\n }\n },\n \"reports\": {\n \"", | ||
{ | ||
"Fn::GetAtt": [ | ||
"TestReportGroup1F49A500", | ||
"Arn" | ||
] | ||
}, | ||
"\": {\n \"base-directory\": \"test-reports\",\n \"file-format\": \"JUNITXML\",\n \"files\": [\n \"**/*\"\n ]\n },\n \"", | ||
{ | ||
"Fn::GetAtt": [ | ||
"CoverageReportGroupE23151CF", | ||
"Arn" | ||
] | ||
}, | ||
"\": {\n \"base-directory\": \"coverage\",\n \"file-format\": \"CLOVERXML\",\n \"files\": [\n \"clover.xml\"\n ]\n }\n }\n}" | ||
] | ||
] | ||
}, | ||
"Type": "NO_SOURCE" | ||
}, | ||
"Cache": { | ||
"Type": "NO_CACHE" | ||
}, | ||
"EncryptionKey": "alias/aws/s3" | ||
} | ||
} | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
packages/@aws-cdk/aws-codebuild/test/report-group.integ.snapshot/cdk.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"version":"20.0.0"} |
11 changes: 11 additions & 0 deletions
11
packages/@aws-cdk/aws-codebuild/test/report-group.integ.snapshot/integ.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version": "20.0.0", | ||
"testCases": { | ||
"ReportGroupIntegTest/DefaultTest": { | ||
"stacks": [ | ||
"aws-cdk-report-group" | ||
], | ||
"assertionStack": "ReportGroupIntegTestDefaultTestDeployAssert57960C5A" | ||
} | ||
} | ||
} |
64 changes: 64 additions & 0 deletions
64
packages/@aws-cdk/aws-codebuild/test/report-group.integ.snapshot/manifest.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
{ | ||
"version": "20.0.0", | ||
"artifacts": { | ||
"Tree": { | ||
"type": "cdk:tree", | ||
"properties": { | ||
"file": "tree.json" | ||
} | ||
}, | ||
"aws-cdk-report-group": { | ||
"type": "aws:cloudformation:stack", | ||
"environment": "aws://unknown-account/unknown-region", | ||
"properties": { | ||
"templateFile": "aws-cdk-report-group.template.json", | ||
"validateOnSynth": false | ||
}, | ||
"metadata": { | ||
"/aws-cdk-report-group/CoverageReportGroup/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "CoverageReportGroupE23151CF" | ||
} | ||
], | ||
"/aws-cdk-report-group/TestReportGroup/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "TestReportGroup1F49A500", | ||
"trace": [ | ||
"!!DESTRUCTIVE_CHANGES: WILL_REPLACE" | ||
] | ||
} | ||
], | ||
"/aws-cdk-report-group/MyProject/Role/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "MyProjectRole9BBE5233" | ||
} | ||
], | ||
"/aws-cdk-report-group/MyProject/Role/DefaultPolicy/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "MyProjectRoleDefaultPolicyB19B7C29" | ||
} | ||
], | ||
"/aws-cdk-report-group/MyProject/Resource": [ | ||
{ | ||
"type": "aws:cdk:logicalId", | ||
"data": "MyProject39F7B0AE" | ||
} | ||
] | ||
}, | ||
"displayName": "aws-cdk-report-group" | ||
}, | ||
"ReportGroupIntegTestDefaultTestDeployAssert57960C5A": { | ||
"type": "aws:cloudformation:stack", | ||
"environment": "aws://unknown-account/unknown-region", | ||
"properties": { | ||
"templateFile": "ReportGroupIntegTestDefaultTestDeployAssert57960C5A.template.json", | ||
"validateOnSynth": false | ||
}, | ||
"displayName": "ReportGroupIntegTest/DefaultTest/DeployAssert" | ||
} | ||
} | ||
} |
Oops, something went wrong.