Skip to content

Commit

Permalink
fix(core): DefaultStackSynthesizer bucket prefix missing for template…
Browse files Browse the repository at this point in the history
… assets (#11855)

Related to #10710, #11327 @rix0rrr 

Adding bucketPrefix to "stackTemplateAssetObjectUrl"

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
naveenkoppula committed Jan 6, 2021
1 parent 80f0bfd commit 50a3d3a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ export class DefaultStackSynthesizer extends StackSynthesizer {
//
// Instead, we'll have a protocol with the CLI that we put an 's3://.../...' URL here, and the CLI
// is going to resolve it to the correct 'https://.../' URL before it gives it to CloudFormation.
return `s3://${this.bucketName}/${sourceHash}`;
return `s3://${this.bucketName}/${this.bucketPrefix}${sourceHash}`;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ nodeunitShim({
// WHEN
const asm = myapp.synth();

// THEN -- the S3 url is advertised on the stack artifact
const stackArtifact = asm.getStackArtifact('mystack-bucketPrefix');

// THEN - we have an asset manifest with both assets and the stack template in there
const manifest = readAssetManifest(asm);

Expand All @@ -254,6 +257,10 @@ nodeunitShim({
assumeRoleExternalId: 'file-external-id',
});

const templateHash = last(stackArtifact.stackTemplateAssetObjectUrl?.split('/'));

test.equals(stackArtifact.stackTemplateAssetObjectUrl, `s3://file-asset-bucket/000000000000/${templateHash}`);

test.done();
},

Expand Down

0 comments on commit 50a3d3a

Please sign in to comment.