diff --git a/packages/@aws-cdk/aws-codebuild/lib/artifacts.ts b/packages/@aws-cdk/aws-codebuild/lib/artifacts.ts index 9e45cad9561b6..2e0f306a016be 100644 --- a/packages/@aws-cdk/aws-codebuild/lib/artifacts.ts +++ b/packages/@aws-cdk/aws-codebuild/lib/artifacts.ts @@ -72,7 +72,7 @@ export class S3BucketBuildArtifacts extends BuildArtifacts { return { type: 'S3', location: this.props.bucket.bucketName, - path: this.props.bucket.path, + path: this.props.path, namespaceType: this.parseNamespaceType(this.props.includeBuildID), name: this.props.name, packaging: this.parsePackaging(this.props.packageZip), diff --git a/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts b/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts index 1ed0689e5e484..fb4e7d3ac6e07 100644 --- a/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts +++ b/packages/@aws-cdk/aws-codebuild/test/test.codebuild.ts @@ -466,6 +466,28 @@ export = { } }, + 'using path in S3 artifacts sets it correctly'(test: Test) { + const stack = new cdk.Stack(); + const bucket = new s3.Bucket(stack, 'Bucket'); + new codebuild.Project(stack, 'Project', { + artifacts: new codebuild.S3BucketBuildArtifacts({ + path: 'some/path', + name: 'some_name', + bucket, + }), + }); + + expect(stack).to(haveResource('AWS::CodeBuild::Project', { + "Artifacts": { + "Path": "some/path", + "Name": "some_name", + "Type": "S3", + }, + })); + + test.done(); + }, + 'artifacts': { 'CodePipeline': { 'both source and artifacs are set to CodePipeline'(test: Test) {