Skip to content

Commit f32cba9

Browse files
authored
fix(aws-codebuild): correctly set S3 path when using it as artifact. (#1072)
1 parent d7ef2a5 commit f32cba9

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

packages/@aws-cdk/aws-codebuild/lib/artifacts.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export class S3BucketBuildArtifacts extends BuildArtifacts {
7272
return {
7373
type: 'S3',
7474
location: this.props.bucket.bucketName,
75-
path: this.props.bucket.path,
75+
path: this.props.path,
7676
namespaceType: this.parseNamespaceType(this.props.includeBuildID),
7777
name: this.props.name,
7878
packaging: this.parsePackaging(this.props.packageZip),

packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts

+22
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,28 @@ export = {
466466
}
467467
},
468468

469+
'using path in S3 artifacts sets it correctly'(test: Test) {
470+
const stack = new cdk.Stack();
471+
const bucket = new s3.Bucket(stack, 'Bucket');
472+
new codebuild.Project(stack, 'Project', {
473+
artifacts: new codebuild.S3BucketBuildArtifacts({
474+
path: 'some/path',
475+
name: 'some_name',
476+
bucket,
477+
}),
478+
});
479+
480+
expect(stack).to(haveResource('AWS::CodeBuild::Project', {
481+
"Artifacts": {
482+
"Path": "some/path",
483+
"Name": "some_name",
484+
"Type": "S3",
485+
},
486+
}));
487+
488+
test.done();
489+
},
490+
469491
'artifacts': {
470492
'CodePipeline': {
471493
'both source and artifacs are set to CodePipeline'(test: Test) {

0 commit comments

Comments
 (0)