@catladder/cli 0.0.0-refactor-cache-1b2d6c36 → 0.0.0-refactor-resolve-references-862e93ac
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/dist/bundles/catenv/index.js +230 -121
- package/dist/bundles/cli/index.js +226 -117
- package/dist/pipeline/src/bash/BashExpression.d.ts +3 -1
- package/dist/pipeline/src/bash/BashExpression.js +10 -3
- package/dist/pipeline/src/bash/BashExpression.js.map +1 -1
- package/dist/pipeline/src/bash/bashYaml.js +25 -2
- package/dist/pipeline/src/bash/bashYaml.js.map +1 -1
- package/dist/pipeline/src/build/cache/createJobCache.js +5 -1
- package/dist/pipeline/src/build/cache/createJobCache.js.map +1 -1
- package/dist/pipeline/src/build/docker.js +1 -1
- package/dist/pipeline/src/build/docker.js.map +1 -1
- package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +1 -1
- package/dist/pipeline/src/context/getEnvironmentVariables.js +20 -10
- package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
- package/dist/pipeline/src/context/resolveReferences.d.ts +0 -3
- package/dist/pipeline/src/context/resolveReferences.js +1 -53
- package/dist/pipeline/src/context/resolveReferences.js.map +1 -1
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js +2 -0
- package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
- package/dist/pipeline/src/deploy/kubernetes/kubeEnv.d.ts +3 -3
- package/dist/pipeline/src/deploy/kubernetes/kubeValues.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.d.ts +2 -2
- package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.js.map +1 -1
- package/dist/pipeline/src/deploy/types/googleCloudRun.d.ts +7 -2
- package/dist/pipeline/src/types/context.d.ts +2 -1
- package/dist/pipeline/src/types/context.js.map +1 -1
- package/dist/pipeline/src/variables/VariableValue.d.ts +3 -0
- package/dist/pipeline/src/variables/VariableValue.js +3 -0
- package/dist/pipeline/src/variables/VariableValue.js.map +1 -0
- package/dist/pipeline/src/variables/VariableValueContainingReferences.d.ts +25 -0
- package/dist/pipeline/src/variables/VariableValueContainingReferences.js +62 -0
- package/dist/pipeline/src/variables/VariableValueContainingReferences.js.map +1 -0
- package/dist/pipeline/src/variables/replaceAllReferences.d.ts +3 -0
- package/dist/pipeline/src/variables/replaceAllReferences.js +25 -0
- package/dist/pipeline/src/variables/replaceAllReferences.js.map +1 -0
- package/dist/pipeline/src/variables/replaceAllReferencesOnce.d.ts +5 -0
- package/dist/pipeline/src/variables/replaceAllReferencesOnce.js +23 -0
- package/dist/pipeline/src/variables/replaceAllReferencesOnce.js.map +1 -0
- package/dist/pipeline/src/variables/replaceReferencesOnce.d.ts +8 -0
- package/dist/pipeline/src/variables/replaceReferencesOnce.js +21 -0
- package/dist/pipeline/src/variables/replaceReferencesOnce.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/pipeline/src/bash/replaceAsync.d.ts +0 -2
- package/dist/pipeline/src/bash/replaceAsync.js +0 -37
- package/dist/pipeline/src/bash/replaceAsync.js.map +0 -1
|
@@ -751,12 +751,13 @@ exports.getProjectNamespace = getProjectNamespace;
|
|
|
751
751
|
/***/ }),
|
|
752
752
|
|
|
753
753
|
/***/ 2376:
|
|
754
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
754
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
755
755
|
|
|
756
756
|
"use strict";
|
|
757
757
|
|
|
758
758
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
759
759
|
exports.bashEscape = exports.joinBashExpressions = exports.getBashVariable = exports.BashExpression = void 0;
|
|
760
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(1592);
|
|
760
761
|
/**
|
|
761
762
|
* this class represents a string that can be evaluated in bash scripts.
|
|
762
763
|
*
|
|
@@ -772,6 +773,9 @@ class BashExpression {
|
|
|
772
773
|
toString() {
|
|
773
774
|
return this.value.toString();
|
|
774
775
|
}
|
|
776
|
+
replace(searchValue, replacer) {
|
|
777
|
+
return new BashExpression(this.value.toString().replace(searchValue, replacer));
|
|
778
|
+
}
|
|
775
779
|
/**
|
|
776
780
|
*
|
|
777
781
|
* @returns a bash expression to lowercase the string
|
|
@@ -825,10 +829,13 @@ const bashEscape = (value) => {
|
|
|
825
829
|
if (value instanceof BashExpression) {
|
|
826
830
|
return value.toString(); // no need to escape bash expressions, as we want them to evaluate
|
|
827
831
|
}
|
|
832
|
+
if (value instanceof VariableValueContainingReferences_1.VariableValueContainingReferences) {
|
|
833
|
+
return value.toString({
|
|
834
|
+
escapeQuotes: true,
|
|
835
|
+
});
|
|
836
|
+
}
|
|
828
837
|
// we wrap it in double quotes, so we need to escape them
|
|
829
|
-
|
|
830
|
-
return value.replace(/"/g, '\\"');
|
|
831
|
-
return value;
|
|
838
|
+
return value === null || value === void 0 ? void 0 : value.toString().replace(/"/g, '\\"');
|
|
832
839
|
};
|
|
833
840
|
exports.bashEscape = bashEscape;
|
|
834
841
|
//# sourceMappingURL=BashExpression.js.map
|
|
@@ -861,6 +868,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
861
868
|
exports.writeBashYamlToFileScript = exports.yamlBashString = void 0;
|
|
862
869
|
const yaml_1 = __nccwpck_require__(8033);
|
|
863
870
|
const BashExpression_1 = __nccwpck_require__(2376);
|
|
871
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(1592);
|
|
864
872
|
const bashExpressionType = {
|
|
865
873
|
tag: "",
|
|
866
874
|
resolve: (str) => {
|
|
@@ -871,10 +879,32 @@ const bashExpressionType = {
|
|
|
871
879
|
// we create a BLOCK_LITERAL
|
|
872
880
|
// but because bash will interpret the value, it may resolve to a multiline string
|
|
873
881
|
// so we need to indent every line using sed
|
|
874
|
-
return "|-\n" +
|
|
882
|
+
return ("|-\n" +
|
|
883
|
+
ctx.indent +
|
|
884
|
+
indentNewlinesInBashExpression(node.value, ctx.indent));
|
|
875
885
|
},
|
|
876
886
|
identify: (v) => v instanceof BashExpression_1.BashExpression,
|
|
877
887
|
};
|
|
888
|
+
const indentNewlinesInBashExpression = (expression, indent) => {
|
|
889
|
+
return expression.transformWithCommand(`sed '1!s/^/${indent}/'`);
|
|
890
|
+
};
|
|
891
|
+
const variableContainingReferences = {
|
|
892
|
+
tag: "",
|
|
893
|
+
resolve: (str) => {
|
|
894
|
+
// not really needed,but let's make typescript happy
|
|
895
|
+
return new VariableValueContainingReferences_1.VariableValueContainingReferences(str);
|
|
896
|
+
},
|
|
897
|
+
stringify(node, ctx) {
|
|
898
|
+
const value = node.value;
|
|
899
|
+
const stringified = value.parts
|
|
900
|
+
.map((part) => part instanceof BashExpression_1.BashExpression
|
|
901
|
+
? indentNewlinesInBashExpression(part, ctx.indent)
|
|
902
|
+
: part.toString().replace(/\n/g, `\n${ctx.indent}`))
|
|
903
|
+
.join("");
|
|
904
|
+
return "|-\n" + ctx.indent + stringified;
|
|
905
|
+
},
|
|
906
|
+
identify: (v) => v instanceof VariableValueContainingReferences_1.VariableValueContainingReferences,
|
|
907
|
+
};
|
|
878
908
|
/***
|
|
879
909
|
* creates a yaml string that can be used in bash scripts
|
|
880
910
|
* it handles BashExpressions correctly so that they can be evaluated in bash
|
|
@@ -883,7 +913,7 @@ const yamlBashString = (value) => {
|
|
|
883
913
|
return (0, yaml_1.stringify)(value, {
|
|
884
914
|
defaultStringType: "BLOCK_LITERAL",
|
|
885
915
|
defaultKeyType: "PLAIN",
|
|
886
|
-
customTags: [bashExpressionType],
|
|
916
|
+
customTags: [bashExpressionType, variableContainingReferences],
|
|
887
917
|
aliasDuplicateObjects: false,
|
|
888
918
|
lineWidth: 0,
|
|
889
919
|
});
|
|
@@ -928,50 +958,6 @@ exports.getInjectVarsScript = getInjectVarsScript;
|
|
|
928
958
|
|
|
929
959
|
/***/ }),
|
|
930
960
|
|
|
931
|
-
/***/ 2233:
|
|
932
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
933
|
-
|
|
934
|
-
"use strict";
|
|
935
|
-
|
|
936
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
937
|
-
const BashExpression_1 = __nccwpck_require__(2376);
|
|
938
|
-
// from https://github.com/dsblv/string-replace-async/blob/main/index.js
|
|
939
|
-
// and adjusted a bit
|
|
940
|
-
async function replaceAsync(string, searchValue, replacer) {
|
|
941
|
-
const wasBashExpression = string instanceof BashExpression_1.BashExpression;
|
|
942
|
-
try {
|
|
943
|
-
// 1. Run fake pass of `replace`, collect values from `replacer` calls
|
|
944
|
-
// 2. Resolve them with `Promise.all`
|
|
945
|
-
// 3. Run `replace` with resolved values
|
|
946
|
-
const values = [];
|
|
947
|
-
String.prototype.replace.call(string.toString(), searchValue, function (...args) {
|
|
948
|
-
// eslint-disable-next-line prefer-spread
|
|
949
|
-
const result = replacer.apply(undefined, args);
|
|
950
|
-
values.push(result);
|
|
951
|
-
return "";
|
|
952
|
-
});
|
|
953
|
-
const resolvedValues = await Promise.all(values);
|
|
954
|
-
const containsBashExpression = resolvedValues.some((value) => value instanceof BashExpression_1.BashExpression);
|
|
955
|
-
const result = String.prototype.replace.call(string.toString(), searchValue, function () {
|
|
956
|
-
var _a, _b;
|
|
957
|
-
return (_b = (_a = resolvedValues.shift()) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "";
|
|
958
|
-
});
|
|
959
|
-
if (wasBashExpression || containsBashExpression) {
|
|
960
|
-
return new BashExpression_1.BashExpression(result);
|
|
961
|
-
}
|
|
962
|
-
else {
|
|
963
|
-
return result;
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
catch (error) {
|
|
967
|
-
return Promise.reject(error);
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
exports["default"] = replaceAsync;
|
|
971
|
-
//# sourceMappingURL=replaceAsync.js.map
|
|
972
|
-
|
|
973
|
-
/***/ }),
|
|
974
|
-
|
|
975
961
|
/***/ 8774:
|
|
976
962
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
977
963
|
|
|
@@ -1297,14 +1283,18 @@ exports.componentContextNeedsBuildTimeDotEnv = componentContextNeedsBuildTimeDot
|
|
|
1297
1283
|
/***/ }),
|
|
1298
1284
|
|
|
1299
1285
|
/***/ 340:
|
|
1300
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__)
|
|
1286
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
1301
1287
|
|
|
1302
1288
|
"use strict";
|
|
1303
1289
|
|
|
1290
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1291
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1292
|
+
};
|
|
1304
1293
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1305
1294
|
exports.createJobCacheFromConfig = exports.createJobCacheFromCacheConfigs = void 0;
|
|
1306
1295
|
const path_1 = __nccwpck_require__(1017);
|
|
1307
1296
|
const getAllCacheConfigsFromConfig_1 = __nccwpck_require__(673);
|
|
1297
|
+
const slugify_1 = __importDefault(__nccwpck_require__(7548));
|
|
1308
1298
|
const createJobCacheFromCacheConfigs = (context, caches) => {
|
|
1309
1299
|
if (caches.length === 0)
|
|
1310
1300
|
return undefined;
|
|
@@ -1333,7 +1323,7 @@ const createJobCacheFromCacheConfigs = (context, caches) => {
|
|
|
1333
1323
|
? key
|
|
1334
1324
|
: typeof key === "string"
|
|
1335
1325
|
? (scope === "buildDir" // really edge case...
|
|
1336
|
-
? baseDir
|
|
1326
|
+
? (0, slugify_1.default)(baseDir)
|
|
1337
1327
|
: context.name) +
|
|
1338
1328
|
"-" +
|
|
1339
1329
|
key
|
|
@@ -1642,7 +1632,7 @@ const getDockerJobBaseProps = () => {
|
|
|
1642
1632
|
services: [
|
|
1643
1633
|
{
|
|
1644
1634
|
name: "docker:24.0.6-dind", // see see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27300#note_466755332
|
|
1645
|
-
command: ["--tls=false"],
|
|
1635
|
+
command: ["--tls=false", "--registry-mirror=https://mirror.gcr.io"],
|
|
1646
1636
|
},
|
|
1647
1637
|
],
|
|
1648
1638
|
variables: {},
|
|
@@ -1872,7 +1862,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1872
1862
|
exports.getWorkspaceDefaultCaches = exports.getNextCache = exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void 0;
|
|
1873
1863
|
const lodash_1 = __nccwpck_require__(3255);
|
|
1874
1864
|
const path_1 = __nccwpck_require__(1017);
|
|
1875
|
-
const slugify_1 = __importDefault(__nccwpck_require__(
|
|
1865
|
+
const slugify_1 = __importDefault(__nccwpck_require__(7548));
|
|
1876
1866
|
const getYarnCache = (context, policy = "pull-push") => {
|
|
1877
1867
|
const componentIsInWorkspace = context.type === "component" &&
|
|
1878
1868
|
context.packageManagerInfo.componentIsInWorkspace;
|
|
@@ -2940,7 +2930,9 @@ const getBuildInfoVariables_1 = __nccwpck_require__(7827);
|
|
|
2940
2930
|
const getEnvironmentContext_1 = __nccwpck_require__(3663);
|
|
2941
2931
|
const resolveReferences_1 = __nccwpck_require__(3115);
|
|
2942
2932
|
const transformJobOnlyVars_1 = __nccwpck_require__(1552);
|
|
2933
|
+
const replaceAllReferences_1 = __nccwpck_require__(4035);
|
|
2943
2934
|
const envVars_1 = __nccwpck_require__(6296);
|
|
2935
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(1592);
|
|
2944
2936
|
const getBasePredefinedVariables = (ctx) => {
|
|
2945
2937
|
return {
|
|
2946
2938
|
ENV_SHORT: ctx.env,
|
|
@@ -2949,7 +2941,7 @@ const getBasePredefinedVariables = (ctx) => {
|
|
|
2949
2941
|
...(ctx.envType !== "local" ? (0, getBuildInfoVariables_1.getBuildInfoVariables)(ctx) : {}),
|
|
2950
2942
|
};
|
|
2951
2943
|
};
|
|
2952
|
-
const getEnvironmentVariables = async (ctx,
|
|
2944
|
+
const getEnvironmentVariables = async (ctx, shouldResolveReferences = true) => {
|
|
2953
2945
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2954
2946
|
const environmentContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
2955
2947
|
const { config, env, componentName } = ctx;
|
|
@@ -3012,18 +3004,26 @@ const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
|
|
|
3012
3004
|
const legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
|
|
3013
3005
|
const publicEnvVarsRawWithLegacyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
|
|
3014
3006
|
const publicEnvVarsRawSanitized = (0, envVars_1.stringifyValues)(publicEnvVarsRawWithLegacyFromComponents);
|
|
3015
|
-
const
|
|
3007
|
+
const publicEnvVarsUnresolved = Object.fromEntries(Object.entries(publicEnvVarsRawSanitized).map(([key, value]) => [
|
|
3008
|
+
key,
|
|
3009
|
+
(0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)(value, {
|
|
3010
|
+
componentName: ctx.componentName,
|
|
3011
|
+
}),
|
|
3012
|
+
]));
|
|
3013
|
+
const publicEnvVars = shouldResolveReferences
|
|
3014
|
+
? await (0, replaceAllReferences_1.replaceAllReferences)(publicEnvVarsUnresolved, async (otherComponentName) => {
|
|
3015
|
+
const { envVars: otherEnvVars } = await (0, exports.getEnvironmentVariables)({
|
|
3016
|
+
...ctx,
|
|
3017
|
+
componentName: otherComponentName,
|
|
3018
|
+
}, false);
|
|
3019
|
+
return otherEnvVars;
|
|
3020
|
+
})
|
|
3021
|
+
: publicEnvVarsUnresolved;
|
|
3022
|
+
const envVars = addIndexVar({
|
|
3016
3023
|
...predefinedVariables,
|
|
3017
3024
|
...secretEnvVars,
|
|
3018
|
-
...
|
|
3025
|
+
...publicEnvVars,
|
|
3019
3026
|
});
|
|
3020
|
-
const envVars = (await (0, resolveReferences_1.resolveReferences)(envVarsRaw, async (otherComponentName, alreadyVisited) => {
|
|
3021
|
-
const { envVars: otherEnvVars } = await (0, exports.getEnvironmentVariables)({
|
|
3022
|
-
...ctx,
|
|
3023
|
-
componentName: otherComponentName,
|
|
3024
|
-
}, alreadyVisited);
|
|
3025
|
-
return otherEnvVars;
|
|
3026
|
-
}, alreadyVisited));
|
|
3027
3027
|
return {
|
|
3028
3028
|
envVars,
|
|
3029
3029
|
secretEnvVarKeys,
|
|
@@ -3062,7 +3062,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3062
3062
|
};
|
|
3063
3063
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3064
3064
|
exports.getLabels = void 0;
|
|
3065
|
-
const slugify_1 = __importDefault(__nccwpck_require__(
|
|
3065
|
+
const slugify_1 = __importDefault(__nccwpck_require__(7548));
|
|
3066
3066
|
const sanitize = (value) => {
|
|
3067
3067
|
if (!value)
|
|
3068
3068
|
return value;
|
|
@@ -3142,64 +3142,12 @@ __exportStar(__nccwpck_require__(5133), exports);
|
|
|
3142
3142
|
/***/ }),
|
|
3143
3143
|
|
|
3144
3144
|
/***/ 3115:
|
|
3145
|
-
/***/ (
|
|
3145
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3146
3146
|
|
|
3147
3147
|
"use strict";
|
|
3148
3148
|
|
|
3149
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3150
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3151
|
-
};
|
|
3152
3149
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3153
|
-
exports.translateLegacyFromComponents =
|
|
3154
|
-
const lodash_1 = __nccwpck_require__(3255);
|
|
3155
|
-
const replaceAsync_1 = __importDefault(__nccwpck_require__(2233));
|
|
3156
|
-
// regex to resolve references in catladder variables
|
|
3157
|
-
// those expressions have the pattern ${componentName:variableName}
|
|
3158
|
-
const REGEX = /\$\{(([^:}]+):)?([^}]+)}/gm;
|
|
3159
|
-
const resolveReferences = async (vars, getOtherVariables, alreadyVisitedBase = {}) => {
|
|
3160
|
-
/**
|
|
3161
|
-
*
|
|
3162
|
-
* replace referenced variables with their values in a value string
|
|
3163
|
-
*/
|
|
3164
|
-
const replaceSingleValue = async (value, alreadyVisited = alreadyVisitedBase) => {
|
|
3165
|
-
if (REGEX.test(value.toString())) {
|
|
3166
|
-
// we consider variables that got references in it BashExpressions, because the replacement may be one
|
|
3167
|
-
return await (0, replaceAsync_1.default)(value, REGEX, async (match, _, componentName, variableName) => {
|
|
3168
|
-
var _a, _b;
|
|
3169
|
-
if ((_a = alreadyVisited[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]) {
|
|
3170
|
-
return match; // prevent endless loop
|
|
3171
|
-
}
|
|
3172
|
-
const newAlreadyVisited = (0, lodash_1.merge)({}, alreadyVisited, {
|
|
3173
|
-
[componentName]: {
|
|
3174
|
-
[variableName]: true,
|
|
3175
|
-
},
|
|
3176
|
-
});
|
|
3177
|
-
const result = componentName
|
|
3178
|
-
? (_b = (await (getOtherVariables === null || getOtherVariables === void 0 ? void 0 : getOtherVariables(componentName, newAlreadyVisited).then((r) => r === null || r === void 0 ? void 0 : r[variableName])))) !== null && _b !== void 0 ? _b : null
|
|
3179
|
-
: vars[variableName]; // is self reference
|
|
3180
|
-
const replaced = result !== null && result !== undefined
|
|
3181
|
-
? await replaceSingleValue(result, newAlreadyVisited)
|
|
3182
|
-
: match;
|
|
3183
|
-
return replaced;
|
|
3184
|
-
});
|
|
3185
|
-
}
|
|
3186
|
-
else {
|
|
3187
|
-
return value;
|
|
3188
|
-
}
|
|
3189
|
-
};
|
|
3190
|
-
return Object.fromEntries(await Promise.all(Object.entries(vars).map(async ([key, value]) => {
|
|
3191
|
-
if (value === null || value === undefined) {
|
|
3192
|
-
return [key, null];
|
|
3193
|
-
}
|
|
3194
|
-
return [
|
|
3195
|
-
key,
|
|
3196
|
-
value !== null && value !== undefined
|
|
3197
|
-
? await replaceSingleValue(value)
|
|
3198
|
-
: null,
|
|
3199
|
-
];
|
|
3200
|
-
})));
|
|
3201
|
-
};
|
|
3202
|
-
exports.resolveReferences = resolveReferences;
|
|
3150
|
+
exports.translateLegacyFromComponents = void 0;
|
|
3203
3151
|
const translateLegacyFromComponents = (fromComponents) => {
|
|
3204
3152
|
return Object.fromEntries(Object.entries(fromComponents).flatMap(([componentName, variables]) => {
|
|
3205
3153
|
return Object.entries(variables).map(([ourName, otherName]) => [
|
|
@@ -3935,6 +3883,8 @@ const getServiceDeployScript = (context, service, nameSuffix) => {
|
|
|
3935
3883
|
timeout: customConfig === null || customConfig === void 0 ? void 0 : customConfig.timeout,
|
|
3936
3884
|
"vpc-connector": customConfig === null || customConfig === void 0 ? void 0 : customConfig.vpcConnector,
|
|
3937
3885
|
"vpc-egress": customConfig === null || customConfig === void 0 ? void 0 : customConfig.vpcEgress,
|
|
3886
|
+
network: customConfig === null || customConfig === void 0 ? void 0 : customConfig.network,
|
|
3887
|
+
subnet: customConfig === null || customConfig === void 0 ? void 0 : customConfig.subnet,
|
|
3938
3888
|
"use-http2": customConfig === null || customConfig === void 0 ? void 0 : customConfig.http2,
|
|
3939
3889
|
"allow-unauthenticated": (_d = customConfig === null || customConfig === void 0 ? void 0 : customConfig.allowUnauthenticated) !== null && _d !== void 0 ? _d : true,
|
|
3940
3890
|
ingress: (_e = customConfig === null || customConfig === void 0 ? void 0 : customConfig.ingress) !== null && _e !== void 0 ? _e : "all",
|
|
@@ -4846,7 +4796,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4846
4796
|
};
|
|
4847
4797
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4848
4798
|
exports.KUBERNETES_DEPLOY_TYPE = void 0;
|
|
4849
|
-
const slugify_1 = __importDefault(__nccwpck_require__(
|
|
4799
|
+
const slugify_1 = __importDefault(__nccwpck_require__(7548));
|
|
4850
4800
|
const __1 = __nccwpck_require__(8483);
|
|
4851
4801
|
const BashExpression_1 = __nccwpck_require__(2376);
|
|
4852
4802
|
const additionalSecretKeys_1 = __nccwpck_require__(436);
|
|
@@ -6651,6 +6601,165 @@ exports.writeYamlfile = writeYamlfile;
|
|
|
6651
6601
|
|
|
6652
6602
|
/***/ }),
|
|
6653
6603
|
|
|
6604
|
+
/***/ 1592:
|
|
6605
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
6606
|
+
|
|
6607
|
+
"use strict";
|
|
6608
|
+
|
|
6609
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6610
|
+
exports.createVariableValueContainingReferencesFromString = exports.VariableValueContainingReferences = exports.VariableReference = exports.UnresolvableReference = void 0;
|
|
6611
|
+
class UnresolvableReference {
|
|
6612
|
+
constructor(reference) {
|
|
6613
|
+
this.reference = reference;
|
|
6614
|
+
}
|
|
6615
|
+
toString() {
|
|
6616
|
+
return `Unresolvable reference: ${this.reference.toString()}`;
|
|
6617
|
+
}
|
|
6618
|
+
}
|
|
6619
|
+
exports.UnresolvableReference = UnresolvableReference;
|
|
6620
|
+
class VariableReference {
|
|
6621
|
+
constructor(componentName, variableName) {
|
|
6622
|
+
this.componentName = componentName;
|
|
6623
|
+
this.variableName = variableName;
|
|
6624
|
+
}
|
|
6625
|
+
toString() {
|
|
6626
|
+
return `\${${this.componentName}:${this.variableName}}`;
|
|
6627
|
+
}
|
|
6628
|
+
}
|
|
6629
|
+
exports.VariableReference = VariableReference;
|
|
6630
|
+
class VariableValueContainingReferences {
|
|
6631
|
+
constructor(parts) {
|
|
6632
|
+
this.parts = (Array.isArray(parts) ? parts : [parts]).flatMap((part) => part instanceof VariableValueContainingReferences
|
|
6633
|
+
? part.parts
|
|
6634
|
+
: part === ""
|
|
6635
|
+
? []
|
|
6636
|
+
: [part]);
|
|
6637
|
+
}
|
|
6638
|
+
toString(options = { escapeQuotes: false }) {
|
|
6639
|
+
return this.parts
|
|
6640
|
+
.map((part) => {
|
|
6641
|
+
if (typeof part === "string") {
|
|
6642
|
+
return options.escapeQuotes ? part.replace(/"/g, '\\"') : part;
|
|
6643
|
+
}
|
|
6644
|
+
else {
|
|
6645
|
+
return part.toString();
|
|
6646
|
+
}
|
|
6647
|
+
})
|
|
6648
|
+
.join("");
|
|
6649
|
+
}
|
|
6650
|
+
}
|
|
6651
|
+
exports.VariableValueContainingReferences = VariableValueContainingReferences;
|
|
6652
|
+
// regex to resolve references in catladder variables
|
|
6653
|
+
// those expressions have the pattern ${componentName:variableName}
|
|
6654
|
+
const REGEX = /\$\{(([^:}]+):)?([^}]+)}/gm;
|
|
6655
|
+
const createVariableValueContainingReferencesFromString = (value, options) => {
|
|
6656
|
+
const parts = [];
|
|
6657
|
+
let match;
|
|
6658
|
+
let lastIndex = 0;
|
|
6659
|
+
while ((match = REGEX.exec(value)) !== null) {
|
|
6660
|
+
const [fullMatch, _, otherComponentName, variableName] = match;
|
|
6661
|
+
parts.push(value.slice(lastIndex, match.index));
|
|
6662
|
+
parts.push(new VariableReference(otherComponentName || options.componentName, variableName));
|
|
6663
|
+
lastIndex = REGEX.lastIndex;
|
|
6664
|
+
}
|
|
6665
|
+
parts.push(value.slice(lastIndex));
|
|
6666
|
+
return new VariableValueContainingReferences(parts);
|
|
6667
|
+
};
|
|
6668
|
+
exports.createVariableValueContainingReferencesFromString = createVariableValueContainingReferencesFromString;
|
|
6669
|
+
//# sourceMappingURL=VariableValueContainingReferences.js.map
|
|
6670
|
+
|
|
6671
|
+
/***/ }),
|
|
6672
|
+
|
|
6673
|
+
/***/ 4035:
|
|
6674
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
6675
|
+
|
|
6676
|
+
"use strict";
|
|
6677
|
+
|
|
6678
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6679
|
+
exports.replaceAllReferences = void 0;
|
|
6680
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(1592);
|
|
6681
|
+
const replaceAllReferencesOnce_1 = __nccwpck_require__(2726);
|
|
6682
|
+
const replaceAllReferences = async (values, getEnvVars) => {
|
|
6683
|
+
// replace until there aren't any references left
|
|
6684
|
+
let result = values;
|
|
6685
|
+
let i = 0;
|
|
6686
|
+
while (Object.values(result).some((value) => value.parts.some((part) => part instanceof VariableValueContainingReferences_1.VariableReference))) {
|
|
6687
|
+
const replaced = await (0, replaceAllReferencesOnce_1.replaceAllReferencesOnce)(result, getEnvVars);
|
|
6688
|
+
result = replaced;
|
|
6689
|
+
i++;
|
|
6690
|
+
if (i > 1000) {
|
|
6691
|
+
const unresolved = Object.entries(result).filter(([key, value]) => value.parts.some((part) => part instanceof VariableValueContainingReferences_1.VariableReference));
|
|
6692
|
+
throw new Error("Infinite loop detected in these variables: " +
|
|
6693
|
+
unresolved
|
|
6694
|
+
.map(([key, value]) => `${key} (last reference: ${value.parts.find((part) => part instanceof VariableValueContainingReferences_1.VariableReference)})`)
|
|
6695
|
+
.join(", "));
|
|
6696
|
+
}
|
|
6697
|
+
}
|
|
6698
|
+
return result;
|
|
6699
|
+
};
|
|
6700
|
+
exports.replaceAllReferences = replaceAllReferences;
|
|
6701
|
+
//# sourceMappingURL=replaceAllReferences.js.map
|
|
6702
|
+
|
|
6703
|
+
/***/ }),
|
|
6704
|
+
|
|
6705
|
+
/***/ 2726:
|
|
6706
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
6707
|
+
|
|
6708
|
+
"use strict";
|
|
6709
|
+
|
|
6710
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6711
|
+
exports.replaceAllReferencesOnce = void 0;
|
|
6712
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(1592);
|
|
6713
|
+
const replaceReferencesOnce_1 = __nccwpck_require__(8666);
|
|
6714
|
+
const replaceAllReferencesOnce = async (values, getEnvVars) => {
|
|
6715
|
+
const allReferences = Object.values(values).flatMap((value) => value === null || value === void 0 ? void 0 : value.parts.filter((part) => part instanceof VariableValueContainingReferences_1.VariableReference));
|
|
6716
|
+
const allComponentsUnique = Array.from(new Set(allReferences.map((reference) => reference.componentName)));
|
|
6717
|
+
const allEnvVarsInComponents = Object.fromEntries(await Promise.all(allComponentsUnique.map(async (componentName) => [
|
|
6718
|
+
componentName,
|
|
6719
|
+
await getEnvVars(componentName),
|
|
6720
|
+
])));
|
|
6721
|
+
return Object.fromEntries(Object.entries(values).map(([key, value]) => [
|
|
6722
|
+
key,
|
|
6723
|
+
value !== null && value !== undefined
|
|
6724
|
+
? (0, replaceReferencesOnce_1.replaceReferencesOnce)(value, ({ componentName, variableName }) => {
|
|
6725
|
+
return allEnvVarsInComponents[componentName][variableName];
|
|
6726
|
+
})
|
|
6727
|
+
: value,
|
|
6728
|
+
]));
|
|
6729
|
+
};
|
|
6730
|
+
exports.replaceAllReferencesOnce = replaceAllReferencesOnce;
|
|
6731
|
+
//# sourceMappingURL=replaceAllReferencesOnce.js.map
|
|
6732
|
+
|
|
6733
|
+
/***/ }),
|
|
6734
|
+
|
|
6735
|
+
/***/ 8666:
|
|
6736
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
6737
|
+
|
|
6738
|
+
"use strict";
|
|
6739
|
+
|
|
6740
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6741
|
+
exports.replaceReferencesOnce = void 0;
|
|
6742
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(1592);
|
|
6743
|
+
const replaceReferencesOnce = (value, replacer) => {
|
|
6744
|
+
const replacedParts = value.parts.map((part) => {
|
|
6745
|
+
if (part instanceof VariableValueContainingReferences_1.VariableReference) {
|
|
6746
|
+
const result = replacer({
|
|
6747
|
+
componentName: part.componentName,
|
|
6748
|
+
variableName: part.variableName,
|
|
6749
|
+
});
|
|
6750
|
+
return result !== null && result !== void 0 ? result : new VariableValueContainingReferences_1.UnresolvableReference(part);
|
|
6751
|
+
}
|
|
6752
|
+
else {
|
|
6753
|
+
return part;
|
|
6754
|
+
}
|
|
6755
|
+
});
|
|
6756
|
+
return new VariableValueContainingReferences_1.VariableValueContainingReferences(replacedParts);
|
|
6757
|
+
};
|
|
6758
|
+
exports.replaceReferencesOnce = replaceReferencesOnce;
|
|
6759
|
+
//# sourceMappingURL=replaceReferencesOnce.js.map
|
|
6760
|
+
|
|
6761
|
+
/***/ }),
|
|
6762
|
+
|
|
6654
6763
|
/***/ 5763:
|
|
6655
6764
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
6656
6765
|
|
|
@@ -39770,7 +39879,7 @@ module.exports = safer
|
|
|
39770
39879
|
|
|
39771
39880
|
/***/ }),
|
|
39772
39881
|
|
|
39773
|
-
/***/
|
|
39882
|
+
/***/ 7548:
|
|
39774
39883
|
/***/ (function(module) {
|
|
39775
39884
|
|
|
39776
39885
|
|