cloudmason2 1.8.0 → 2.0.0
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/publish.js +2 -1
- package/commands/set_repo.js +10 -2
- package/package.json +1 -1
package/commands/publish.js
CHANGED
|
@@ -51,7 +51,8 @@ exports.main = async function(args){
|
|
|
51
51
|
const stackText = await getFileText(s3, bucket, stackKey);
|
|
52
52
|
if (stackText === null){ throw new Error('No stack found for v' + fullVersion) }
|
|
53
53
|
|
|
54
|
-
|
|
54
|
+
// Marketplace lowercases the version title in the SSM alias parameter name
|
|
55
|
+
const amiAlias = `resolve:ssm:/aws/service/marketplace/${manifest.productId}/${fullVersion.toLowerCase()}`;
|
|
55
56
|
const upgradeText = buildUpgradeTemplate(stackText, amiAlias);
|
|
56
57
|
const upgradeKey = `${appPrefix}/versions/${vFolder}/upgrade.yaml`;
|
|
57
58
|
await s3.send(new PutObjectCommand({ Bucket: bucket, Key: upgradeKey, Body: upgradeText, ContentType: Mime.contentType(upgradeKey) }));
|
package/commands/set_repo.js
CHANGED
|
@@ -2,7 +2,7 @@ const fs = require('fs');
|
|
|
2
2
|
const path = require('path');
|
|
3
3
|
const { S3Client, GetObjectCommand } = require("@aws-sdk/client-s3");
|
|
4
4
|
const { CloudFormationClient, GetTemplateSummaryCommand, DescribeTypeCommand } = require("@aws-sdk/client-cloudformation");
|
|
5
|
-
const { IAMClient, GetRoleCommand, CreateRoleCommand, PutRolePolicyCommand, UpdateAssumeRolePolicyCommand, GetOpenIDConnectProviderCommand, CreateOpenIDConnectProviderCommand } = require("@aws-sdk/client-iam");
|
|
5
|
+
const { IAMClient, GetRoleCommand, CreateRoleCommand, UpdateRoleCommand, PutRolePolicyCommand, UpdateAssumeRolePolicyCommand, GetOpenIDConnectProviderCommand, CreateOpenIDConnectProviderCommand } = require("@aws-sdk/client-iam");
|
|
6
6
|
const { STSClient, GetCallerIdentityCommand } = require("@aws-sdk/client-sts");
|
|
7
7
|
const OrgConfig = require('./helpers/org_config');
|
|
8
8
|
const Apps = require('./helpers/apps');
|
|
@@ -10,6 +10,10 @@ const Apps = require('./helpers/apps');
|
|
|
10
10
|
// Inline role policies cap at 10240 chars; collapse derived actions if we get close
|
|
11
11
|
const POLICY_CHAR_LIMIT = 10000;
|
|
12
12
|
|
|
13
|
+
// 4h sessions (AWS allows up to 12h): publish -await can poll the marketplace
|
|
14
|
+
// change set for 90m+, which outlives the 1h default
|
|
15
|
+
const MAX_SESSION_SECONDS = 14400;
|
|
16
|
+
|
|
13
17
|
// set-repo: create or update the app's GitHub Actions CI role. Sets the trust
|
|
14
18
|
// policy to the given repo and derives the stack template's required permissions
|
|
15
19
|
// from the CloudFormation registry. Run locally under elevated permissions -
|
|
@@ -68,13 +72,17 @@ exports.main = async function(args){
|
|
|
68
72
|
RoleName: roleName,
|
|
69
73
|
PolicyDocument: JSON.stringify(trustPolicy)
|
|
70
74
|
}));
|
|
75
|
+
if (existing.Role.MaxSessionDuration !== MAX_SESSION_SECONDS){
|
|
76
|
+
await iam.send(new UpdateRoleCommand({ RoleName: roleName, MaxSessionDuration: MAX_SESSION_SECONDS }));
|
|
77
|
+
}
|
|
71
78
|
console.log(`Updated ${roleName} trust to repo ${args.repo}`);
|
|
72
79
|
} catch (e){
|
|
73
80
|
if (!/NoSuchEntity/.test(e)){ throw e }
|
|
74
81
|
const created = await iam.send(new CreateRoleCommand({
|
|
75
82
|
RoleName: roleName,
|
|
76
83
|
AssumeRolePolicyDocument: JSON.stringify(trustPolicy),
|
|
77
|
-
Description: `Mason CI role for ${appName} (github.com/${args.repo})
|
|
84
|
+
Description: `Mason CI role for ${appName} (github.com/${args.repo})`,
|
|
85
|
+
MaxSessionDuration: MAX_SESSION_SECONDS
|
|
78
86
|
}));
|
|
79
87
|
roleArn = created.Role.Arn;
|
|
80
88
|
console.log(`Created role ${roleName} for repo ${args.repo}`);
|