Include parameters in baseStack check for aws

pull/289/head
mdugdale 2021-08-22 00:41:25 +01:00
parent 901eaaf581
commit 8b77b3c5c3
3 changed files with 19 additions and 7 deletions

12
dist/index.js vendored
View File

@ -547,15 +547,21 @@ class AWSBuildEnvironment {
return __awaiter(this, void 0, void 0, function* () {
const baseStackName = this.baseStackName;
const baseStack = fs.readFileSync(`${__dirname}/cloud-formations/base-setup.yml`, 'utf8');
const hash = crypto.createHash('md5').update(baseStack).digest('hex');
// Cloud Formation Input
const describeStackInput = {
StackName: baseStackName,
};
const parameters = [
const parametersWithoutHash = [
{ ParameterKey: 'EnvironmentName', ParameterValue: baseStackName },
{ ParameterKey: 'Storage', ParameterValue: `${baseStackName}-storage` },
{ ParameterKey: 'Version', ParameterValue: hash },
];
const hash = crypto
.createHash('md5')
.update(baseStack + JSON.stringify(parametersWithoutHash))
.digest('hex');
const parameters = [
...parametersWithoutHash,
...[{ ParameterKey: 'Version', ParameterValue: hash }],
];
const updateInput = {
StackName: baseStackName,

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -253,16 +253,22 @@ class AWSBuildEnvironment implements CloudRunnerProviderInterface {
async setupBaseStack(CF: SDK.CloudFormation) {
const baseStackName = this.baseStackName;
const baseStack = fs.readFileSync(`${__dirname}/cloud-formations/base-setup.yml`, 'utf8');
const hash = crypto.createHash('md5').update(baseStack).digest('hex');
// Cloud Formation Input
const describeStackInput: SDK.CloudFormation.DescribeStacksInput = {
StackName: baseStackName,
};
const parameters: SDK.CloudFormation.Parameter[] = [
const parametersWithoutHash: SDK.CloudFormation.Parameter[] = [
{ ParameterKey: 'EnvironmentName', ParameterValue: baseStackName },
{ ParameterKey: 'Storage', ParameterValue: `${baseStackName}-storage` },
{ ParameterKey: 'Version', ParameterValue: hash },
];
const hash = crypto
.createHash('md5')
.update(baseStack + JSON.stringify(parametersWithoutHash))
.digest('hex');
const parameters: SDK.CloudFormation.Parameter[] = [
...parametersWithoutHash,
...[{ ParameterKey: 'Version', ParameterValue: hash }],
];
const updateInput: SDK.CloudFormation.UpdateStackInput = {
StackName: baseStackName,