Skip to content

Commit

Permalink
Merge pull request serverless#6828 from neverendingqs/aws/s3templatename
Browse files Browse the repository at this point in the history
AWS - adding naming function for S3 compiled template file name.
  • Loading branch information
medikoo authored Oct 14, 2019
2 parents 95fae68 + 525fe8a commit a434223
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/plugins/aws/deploy/lib/uploadArtifacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = {
uploadCloudFormationFile() {
this.serverless.cli.log('Uploading CloudFormation file to S3...');

const compiledTemplateFileName = 'compiled-cloudformation-template.json';
const compiledTemplateFileName = this.provider.naming.getCompiledTemplateS3Suffix();

const compiledCfTemplate = this.serverless.service.provider.compiledCloudFormationTemplate;
const normCfTemplate = normalizeFiles.normalizeCloudFormationTemplate(compiledCfTemplate);
Expand Down
3 changes: 2 additions & 1 deletion lib/plugins/aws/deploy/lib/validateTemplate.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use strict';
const getCompiledTemplateS3Suffix = require('../../lib/naming').getCompiledTemplateS3Suffix;
const getS3EndpointForRegion = require('../../utils/getS3EndpointForRegion');

module.exports = {
validateTemplate() {
const bucketName = this.bucketName;
const artifactDirectoryName = this.serverless.service.package.artifactDirectoryName;
const compiledTemplateFileName = 'compiled-cloudformation-template.json';
const compiledTemplateFileName = getCompiledTemplateS3Suffix();
const s3Endpoint = getS3EndpointForRegion(this.provider.getRegion());
this.serverless.cli.log('Validating template...');
const params = {
Expand Down
4 changes: 4 additions & 0 deletions lib/plugins/aws/lib/naming.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ module.exports = {
return 'cloudformation-template-update-stack.json';
},

getCompiledTemplateS3Suffix() {
return 'compiled-cloudformation-template.json';
},

getCoreTemplateFileName() {
return 'cloudformation-template-create-stack.json';
},
Expand Down
4 changes: 2 additions & 2 deletions lib/plugins/aws/lib/updateStack.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module.exports = {

const stackName = this.provider.naming.getStackName();
let stackTags = { STAGE: this.provider.getStage() };
const compiledTemplateFileName = 'compiled-cloudformation-template.json';
const compiledTemplateFileName = this.provider.naming.getCompiledTemplateS3Suffix();
const s3Endpoint = getS3EndpointForRegion(this.provider.getRegion());
const templateUrl = `https://${s3Endpoint}/${this.bucketName}/${this.serverless.service.package.artifactDirectoryName}/${compiledTemplateFileName}`;

Expand Down Expand Up @@ -52,7 +52,7 @@ module.exports = {
},

update() {
const compiledTemplateFileName = 'compiled-cloudformation-template.json';
const compiledTemplateFileName = this.provider.naming.getCompiledTemplateS3Suffix();
const s3Endpoint = getS3EndpointForRegion(this.provider.getRegion());
const templateUrl = `https://${s3Endpoint}/${this.bucketName}/${this.serverless.service.package.artifactDirectoryName}/${compiledTemplateFileName}`;

Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/aws/rollback/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class AwsRollback {
const exists = _.some(deployments, deployment =>
_.some(deployment, {
directory: dateString,
file: 'compiled-cloudformation-template.json',
file: this.provider.naming.getCompiledTemplateS3Suffix(),
})
);

Expand Down

0 comments on commit a434223

Please sign in to comment.