@catladder/cli 1.149.0 → 1.149.1
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/package.json
CHANGED
|
@@ -28,14 +28,32 @@ const upsertGcloudServiceAccount = async (
|
|
|
28
28
|
const { projectId, name, displayName, roles, description } = account;
|
|
29
29
|
|
|
30
30
|
// name has limit of 30
|
|
31
|
-
const namePrefix = `${name}
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
const namePrefix = `${name}`;
|
|
32
|
+
const nameSuffixRaw = `${context.environment.shortName}-${context.componentName}`;
|
|
33
|
+
const nameMiddleRaw = `${context.fullConfig.customerName}-${context.fullConfig.appName}`;
|
|
34
|
+
const MAX_LENGTH = 30;
|
|
35
|
+
const NUM_SEPARATORS = 2;
|
|
36
|
+
|
|
37
|
+
// we want to first hash middle, then suffix
|
|
38
|
+
// if for middle we have at least 1 char left, its ok, so we don't hash nameSuffix, otherwise we need to hash that as well
|
|
39
|
+
|
|
40
|
+
const middleMaxLength =
|
|
41
|
+
MAX_LENGTH - namePrefix.length - nameSuffixRaw.length - NUM_SEPARATORS;
|
|
42
|
+
|
|
43
|
+
let nameMiddle: string;
|
|
44
|
+
let nameSuffix: string;
|
|
45
|
+
if (middleMaxLength < 1) {
|
|
46
|
+
nameMiddle = hashIfNessecary(nameMiddleRaw, 1);
|
|
47
|
+
nameSuffix = hashIfNessecary(
|
|
48
|
+
nameSuffixRaw,
|
|
49
|
+
MAX_LENGTH - namePrefix.length - 1 - NUM_SEPARATORS,
|
|
50
|
+
);
|
|
51
|
+
} else {
|
|
52
|
+
nameMiddle = hashIfNessecary(nameMiddleRaw, middleMaxLength);
|
|
53
|
+
nameSuffix = nameSuffixRaw;
|
|
54
|
+
}
|
|
37
55
|
|
|
38
|
-
const fullName = `${namePrefix}
|
|
56
|
+
const fullName = `${namePrefix}-${nameMiddle}-${nameSuffix}`;
|
|
39
57
|
|
|
40
58
|
const fullDisplayName = `${context.fullConfig.customerName}-${context.fullConfig.appName} ${context.environment.shortName}:${context.componentName} | ${displayName}`;
|
|
41
59
|
|