cloudmason 2.3.42 → 2.4.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/await-ami.js +3 -4
- package/commands/helpers/cf.js +10 -2
- package/commands/publish.js +1 -1
- package/package.json +1 -1
package/commands/await-ami.js
CHANGED
|
@@ -28,14 +28,14 @@ exports.main = async function(args){
|
|
|
28
28
|
|
|
29
29
|
// Wait for Version Availability Function
|
|
30
30
|
const waitForVersionAvailability = async (client, productId, version) => {
|
|
31
|
-
const maxAttempts =
|
|
31
|
+
const maxAttempts = 180; // 90 minutes with 30-second intervals (90 * 60 / 30 = 180)
|
|
32
32
|
let attempts = 0;
|
|
33
33
|
|
|
34
34
|
console.log(`Polling entity for version ${version} availability...`);
|
|
35
|
-
console.log(`Timeout: 90 minutes (will check every
|
|
35
|
+
console.log(`Timeout: 90 minutes (will check every 30 seconds)`);
|
|
36
36
|
|
|
37
37
|
while (attempts < maxAttempts) {
|
|
38
|
-
await new Promise(resolve => setTimeout(resolve,
|
|
38
|
+
await new Promise(resolve => setTimeout(resolve, 30000)); // Wait 30 seconds
|
|
39
39
|
|
|
40
40
|
try {
|
|
41
41
|
const describeEntityCommand = new DescribeEntityCommand({
|
|
@@ -54,7 +54,6 @@ const waitForVersionAvailability = async (client, productId, version) => {
|
|
|
54
54
|
}
|
|
55
55
|
// Check if version exists in Versions array
|
|
56
56
|
const versionInfo = details.Versions?.find(v => v.VersionTitle === version);
|
|
57
|
-
console.log('Version details:', versionInfo);
|
|
58
57
|
|
|
59
58
|
if (versionInfo) {
|
|
60
59
|
// Check 1: Version must have Sources array with AMI
|
package/commands/helpers/cf.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const { CloudFormationClient,ListStackResourcesCommand, CreateStackCommand,UpdateStackCommand, DeleteStackCommand, ValidateTemplateCommand,DescribeStacksCommand } = require('@aws-sdk/client-cloudformation');
|
|
1
|
+
const { CloudFormationClient,ListStackResourcesCommand, CreateStackCommand,UpdateStackCommand, DeleteStackCommand, ValidateTemplateCommand,DescribeStacksCommand, GetTemplateSummaryCommand } = require('@aws-sdk/client-cloudformation');
|
|
2
2
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path')
|
|
@@ -84,7 +84,15 @@ exports.updateOrgStack = async function(yamlPath){
|
|
|
84
84
|
|
|
85
85
|
exports.updateStack = async function(stackName,s3Url,params,region){
|
|
86
86
|
const client = new CloudFormationClient({ region });
|
|
87
|
-
|
|
87
|
+
|
|
88
|
+
// Get the template's declared parameters so we only pass ones that exist
|
|
89
|
+
const summary = await client.send(new GetTemplateSummaryCommand({ TemplateURL: s3Url }));
|
|
90
|
+
const templateParamKeys = new Set((summary.Parameters || []).map(p => p.ParameterKey));
|
|
91
|
+
|
|
92
|
+
const cfParams = Object.keys(params)
|
|
93
|
+
.filter(k => templateParamKeys.has(k))
|
|
94
|
+
.map(k => { return { ParameterKey: k, ParameterValue: params[k] } });
|
|
95
|
+
|
|
88
96
|
const cmd = {
|
|
89
97
|
StackName: stackName,
|
|
90
98
|
TemplateURL: s3Url,
|
package/commands/publish.js
CHANGED
|
@@ -39,7 +39,7 @@ exports.main = async function(args){
|
|
|
39
39
|
const amiAlias = `/aws/service/marketplace/${pubArgs.productId}/${pubArgs.version}`;
|
|
40
40
|
console.log('AMI Alias:',amiAlias);
|
|
41
41
|
let stackTxt = fs.readFileSync(path.resolve(args.stack),'utf8');
|
|
42
|
-
stackTxt = stackTxt.replace(`ImageId: !Ref AmiId`,`ImageId: resolve:ssm:${amiAlias}`);
|
|
42
|
+
// stackTxt = stackTxt.replace(`ImageId: !Ref AmiId`,`ImageId: resolve:ssm:${amiAlias}`);
|
|
43
43
|
stackTxt = stackTxt.replace(/^#-Strip.+#-Strip/ms,'');
|
|
44
44
|
|
|
45
45
|
// -- Update CF Template with AMI IDs
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"cloudmason","version":"2.
|
|
1
|
+
{"name":"cloudmason","version":"2.4.44","description":"","main":"main.js","scripts":{"build":"node build.js"},"bin":{"mason":"./main.js"},"repository":{"type":"git","url":"https://github.com/kai-harvey/cloudmason.git"},"author":"Kai Harvey","license":"ISC","dependencies":{"@aws-sdk/client-acm":"^3.418.0","@aws-sdk/client-auto-scaling":"^3.470.0","@aws-sdk/client-cloudformation":"^3.418.0","@aws-sdk/client-ec2":"^3.864.0","@aws-sdk/client-iam":"^3.864.0","@aws-sdk/client-marketplace-catalog":"^3.716.0","@aws-sdk/client-route-53":"^3.425.0","@aws-sdk/client-s3":"^3.418.0","@aws-sdk/client-ssm":"^3.421.0","adm-zip":"^0.5.10","ssh2":"^1.16.0","yaml":"^2.6.1"}}
|