@catladder/cli 0.0.0-refactor-cache-5eaa74d2 → 0.0.0-refactor-resolve-references-90442171
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 +228 -121
- package/dist/bundles/cli/index.js +224 -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 +23 -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,30 @@ 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" + node.value
|
|
882
|
+
return "|-\n" + indentNewlinesInBashExpression(node.value, ctx.indent);
|
|
875
883
|
},
|
|
876
884
|
identify: (v) => v instanceof BashExpression_1.BashExpression,
|
|
877
885
|
};
|
|
886
|
+
const indentNewlinesInBashExpression = (expression, indent) => {
|
|
887
|
+
return expression.transformWithCommand(`sed 's/^/${indent}/'`);
|
|
888
|
+
};
|
|
889
|
+
const variableContainingReferences = {
|
|
890
|
+
tag: "",
|
|
891
|
+
resolve: (str) => {
|
|
892
|
+
// not really needed,but let's make typescript happy
|
|
893
|
+
return new VariableValueContainingReferences_1.VariableValueContainingReferences(str);
|
|
894
|
+
},
|
|
895
|
+
stringify(node, ctx) {
|
|
896
|
+
const value = node.value;
|
|
897
|
+
const stringified = value.parts
|
|
898
|
+
.map((part) => part instanceof BashExpression_1.BashExpression
|
|
899
|
+
? indentNewlinesInBashExpression(part, ctx.indent)
|
|
900
|
+
: part.toString())
|
|
901
|
+
.join("");
|
|
902
|
+
return "|-\n" + ctx.indent + stringified;
|
|
903
|
+
},
|
|
904
|
+
identify: (v) => v instanceof VariableValueContainingReferences_1.VariableValueContainingReferences,
|
|
905
|
+
};
|
|
878
906
|
/***
|
|
879
907
|
* creates a yaml string that can be used in bash scripts
|
|
880
908
|
* it handles BashExpressions correctly so that they can be evaluated in bash
|
|
@@ -883,7 +911,7 @@ const yamlBashString = (value) => {
|
|
|
883
911
|
return (0, yaml_1.stringify)(value, {
|
|
884
912
|
defaultStringType: "BLOCK_LITERAL",
|
|
885
913
|
defaultKeyType: "PLAIN",
|
|
886
|
-
customTags: [bashExpressionType],
|
|
914
|
+
customTags: [bashExpressionType, variableContainingReferences],
|
|
887
915
|
aliasDuplicateObjects: false,
|
|
888
916
|
lineWidth: 0,
|
|
889
917
|
});
|
|
@@ -928,50 +956,6 @@ exports.getInjectVarsScript = getInjectVarsScript;
|
|
|
928
956
|
|
|
929
957
|
/***/ }),
|
|
930
958
|
|
|
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
959
|
/***/ 8774:
|
|
976
960
|
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
977
961
|
|
|
@@ -1297,14 +1281,18 @@ exports.componentContextNeedsBuildTimeDotEnv = componentContextNeedsBuildTimeDot
|
|
|
1297
1281
|
/***/ }),
|
|
1298
1282
|
|
|
1299
1283
|
/***/ 340:
|
|
1300
|
-
/***/ ((__unused_webpack_module, exports, __nccwpck_require__)
|
|
1284
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
1301
1285
|
|
|
1302
1286
|
"use strict";
|
|
1303
1287
|
|
|
1288
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
1289
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
1290
|
+
};
|
|
1304
1291
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
1305
1292
|
exports.createJobCacheFromConfig = exports.createJobCacheFromCacheConfigs = void 0;
|
|
1306
1293
|
const path_1 = __nccwpck_require__(1017);
|
|
1307
1294
|
const getAllCacheConfigsFromConfig_1 = __nccwpck_require__(673);
|
|
1295
|
+
const slugify_1 = __importDefault(__nccwpck_require__(7548));
|
|
1308
1296
|
const createJobCacheFromCacheConfigs = (context, caches) => {
|
|
1309
1297
|
if (caches.length === 0)
|
|
1310
1298
|
return undefined;
|
|
@@ -1333,7 +1321,7 @@ const createJobCacheFromCacheConfigs = (context, caches) => {
|
|
|
1333
1321
|
? key
|
|
1334
1322
|
: typeof key === "string"
|
|
1335
1323
|
? (scope === "buildDir" // really edge case...
|
|
1336
|
-
? baseDir
|
|
1324
|
+
? (0, slugify_1.default)(baseDir)
|
|
1337
1325
|
: context.name) +
|
|
1338
1326
|
"-" +
|
|
1339
1327
|
key
|
|
@@ -1642,7 +1630,7 @@ const getDockerJobBaseProps = () => {
|
|
|
1642
1630
|
services: [
|
|
1643
1631
|
{
|
|
1644
1632
|
name: "docker:24.0.6-dind", // see see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27300#note_466755332
|
|
1645
|
-
command: ["--tls=false"],
|
|
1633
|
+
command: ["--tls=false", "--registry-mirror=https://mirror.gcr.io"],
|
|
1646
1634
|
},
|
|
1647
1635
|
],
|
|
1648
1636
|
variables: {},
|
|
@@ -1872,7 +1860,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
1872
1860
|
exports.getWorkspaceDefaultCaches = exports.getNextCache = exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void 0;
|
|
1873
1861
|
const lodash_1 = __nccwpck_require__(3255);
|
|
1874
1862
|
const path_1 = __nccwpck_require__(1017);
|
|
1875
|
-
const slugify_1 = __importDefault(__nccwpck_require__(
|
|
1863
|
+
const slugify_1 = __importDefault(__nccwpck_require__(7548));
|
|
1876
1864
|
const getYarnCache = (context, policy = "pull-push") => {
|
|
1877
1865
|
const componentIsInWorkspace = context.type === "component" &&
|
|
1878
1866
|
context.packageManagerInfo.componentIsInWorkspace;
|
|
@@ -2940,7 +2928,9 @@ const getBuildInfoVariables_1 = __nccwpck_require__(7827);
|
|
|
2940
2928
|
const getEnvironmentContext_1 = __nccwpck_require__(3663);
|
|
2941
2929
|
const resolveReferences_1 = __nccwpck_require__(3115);
|
|
2942
2930
|
const transformJobOnlyVars_1 = __nccwpck_require__(1552);
|
|
2931
|
+
const replaceAllReferences_1 = __nccwpck_require__(4035);
|
|
2943
2932
|
const envVars_1 = __nccwpck_require__(6296);
|
|
2933
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(1592);
|
|
2944
2934
|
const getBasePredefinedVariables = (ctx) => {
|
|
2945
2935
|
return {
|
|
2946
2936
|
ENV_SHORT: ctx.env,
|
|
@@ -2949,7 +2939,7 @@ const getBasePredefinedVariables = (ctx) => {
|
|
|
2949
2939
|
...(ctx.envType !== "local" ? (0, getBuildInfoVariables_1.getBuildInfoVariables)(ctx) : {}),
|
|
2950
2940
|
};
|
|
2951
2941
|
};
|
|
2952
|
-
const getEnvironmentVariables = async (ctx,
|
|
2942
|
+
const getEnvironmentVariables = async (ctx, shouldResolveReferences = true) => {
|
|
2953
2943
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
2954
2944
|
const environmentContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
2955
2945
|
const { config, env, componentName } = ctx;
|
|
@@ -3012,18 +3002,26 @@ const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
|
|
|
3012
3002
|
const legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
|
|
3013
3003
|
const publicEnvVarsRawWithLegacyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
|
|
3014
3004
|
const publicEnvVarsRawSanitized = (0, envVars_1.stringifyValues)(publicEnvVarsRawWithLegacyFromComponents);
|
|
3015
|
-
const
|
|
3005
|
+
const publicEnvVarsUnresolved = Object.fromEntries(Object.entries(publicEnvVarsRawSanitized).map(([key, value]) => [
|
|
3006
|
+
key,
|
|
3007
|
+
(0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)(value, {
|
|
3008
|
+
componentName: ctx.componentName,
|
|
3009
|
+
}),
|
|
3010
|
+
]));
|
|
3011
|
+
const publicEnvVars = shouldResolveReferences
|
|
3012
|
+
? await (0, replaceAllReferences_1.replaceAllReferences)(publicEnvVarsUnresolved, async (otherComponentName) => {
|
|
3013
|
+
const { envVars: otherEnvVars } = await (0, exports.getEnvironmentVariables)({
|
|
3014
|
+
...ctx,
|
|
3015
|
+
componentName: otherComponentName,
|
|
3016
|
+
}, false);
|
|
3017
|
+
return otherEnvVars;
|
|
3018
|
+
})
|
|
3019
|
+
: publicEnvVarsUnresolved;
|
|
3020
|
+
const envVars = addIndexVar({
|
|
3016
3021
|
...predefinedVariables,
|
|
3017
3022
|
...secretEnvVars,
|
|
3018
|
-
...
|
|
3023
|
+
...publicEnvVars,
|
|
3019
3024
|
});
|
|
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
3025
|
return {
|
|
3028
3026
|
envVars,
|
|
3029
3027
|
secretEnvVarKeys,
|
|
@@ -3062,7 +3060,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3062
3060
|
};
|
|
3063
3061
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
3064
3062
|
exports.getLabels = void 0;
|
|
3065
|
-
const slugify_1 = __importDefault(__nccwpck_require__(
|
|
3063
|
+
const slugify_1 = __importDefault(__nccwpck_require__(7548));
|
|
3066
3064
|
const sanitize = (value) => {
|
|
3067
3065
|
if (!value)
|
|
3068
3066
|
return value;
|
|
@@ -3142,64 +3140,12 @@ __exportStar(__nccwpck_require__(5133), exports);
|
|
|
3142
3140
|
/***/ }),
|
|
3143
3141
|
|
|
3144
3142
|
/***/ 3115:
|
|
3145
|
-
/***/ (
|
|
3143
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
3146
3144
|
|
|
3147
3145
|
"use strict";
|
|
3148
3146
|
|
|
3149
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3150
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
3151
|
-
};
|
|
3152
3147
|
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;
|
|
3148
|
+
exports.translateLegacyFromComponents = void 0;
|
|
3203
3149
|
const translateLegacyFromComponents = (fromComponents) => {
|
|
3204
3150
|
return Object.fromEntries(Object.entries(fromComponents).flatMap(([componentName, variables]) => {
|
|
3205
3151
|
return Object.entries(variables).map(([ourName, otherName]) => [
|
|
@@ -3935,6 +3881,8 @@ const getServiceDeployScript = (context, service, nameSuffix) => {
|
|
|
3935
3881
|
timeout: customConfig === null || customConfig === void 0 ? void 0 : customConfig.timeout,
|
|
3936
3882
|
"vpc-connector": customConfig === null || customConfig === void 0 ? void 0 : customConfig.vpcConnector,
|
|
3937
3883
|
"vpc-egress": customConfig === null || customConfig === void 0 ? void 0 : customConfig.vpcEgress,
|
|
3884
|
+
network: customConfig === null || customConfig === void 0 ? void 0 : customConfig.network,
|
|
3885
|
+
subnet: customConfig === null || customConfig === void 0 ? void 0 : customConfig.subnet,
|
|
3938
3886
|
"use-http2": customConfig === null || customConfig === void 0 ? void 0 : customConfig.http2,
|
|
3939
3887
|
"allow-unauthenticated": (_d = customConfig === null || customConfig === void 0 ? void 0 : customConfig.allowUnauthenticated) !== null && _d !== void 0 ? _d : true,
|
|
3940
3888
|
ingress: (_e = customConfig === null || customConfig === void 0 ? void 0 : customConfig.ingress) !== null && _e !== void 0 ? _e : "all",
|
|
@@ -4846,7 +4794,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4846
4794
|
};
|
|
4847
4795
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
4848
4796
|
exports.KUBERNETES_DEPLOY_TYPE = void 0;
|
|
4849
|
-
const slugify_1 = __importDefault(__nccwpck_require__(
|
|
4797
|
+
const slugify_1 = __importDefault(__nccwpck_require__(7548));
|
|
4850
4798
|
const __1 = __nccwpck_require__(8483);
|
|
4851
4799
|
const BashExpression_1 = __nccwpck_require__(2376);
|
|
4852
4800
|
const additionalSecretKeys_1 = __nccwpck_require__(436);
|
|
@@ -6651,6 +6599,165 @@ exports.writeYamlfile = writeYamlfile;
|
|
|
6651
6599
|
|
|
6652
6600
|
/***/ }),
|
|
6653
6601
|
|
|
6602
|
+
/***/ 1592:
|
|
6603
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
6604
|
+
|
|
6605
|
+
"use strict";
|
|
6606
|
+
|
|
6607
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6608
|
+
exports.createVariableValueContainingReferencesFromString = exports.VariableValueContainingReferences = exports.VariableReference = exports.UnresolvableReference = void 0;
|
|
6609
|
+
class UnresolvableReference {
|
|
6610
|
+
constructor(reference) {
|
|
6611
|
+
this.reference = reference;
|
|
6612
|
+
}
|
|
6613
|
+
toString() {
|
|
6614
|
+
return `Unresolvable reference: ${this.reference.toString()}`;
|
|
6615
|
+
}
|
|
6616
|
+
}
|
|
6617
|
+
exports.UnresolvableReference = UnresolvableReference;
|
|
6618
|
+
class VariableReference {
|
|
6619
|
+
constructor(componentName, variableName) {
|
|
6620
|
+
this.componentName = componentName;
|
|
6621
|
+
this.variableName = variableName;
|
|
6622
|
+
}
|
|
6623
|
+
toString() {
|
|
6624
|
+
return `\${${this.componentName}:${this.variableName}}`;
|
|
6625
|
+
}
|
|
6626
|
+
}
|
|
6627
|
+
exports.VariableReference = VariableReference;
|
|
6628
|
+
class VariableValueContainingReferences {
|
|
6629
|
+
constructor(parts) {
|
|
6630
|
+
this.parts = (Array.isArray(parts) ? parts : [parts]).flatMap((part) => part instanceof VariableValueContainingReferences
|
|
6631
|
+
? part.parts
|
|
6632
|
+
: part === ""
|
|
6633
|
+
? []
|
|
6634
|
+
: [part]);
|
|
6635
|
+
}
|
|
6636
|
+
toString(options = { escapeQuotes: false }) {
|
|
6637
|
+
return this.parts
|
|
6638
|
+
.map((part) => {
|
|
6639
|
+
if (typeof part === "string") {
|
|
6640
|
+
return options.escapeQuotes ? part.replace(/"/g, '\\"') : part;
|
|
6641
|
+
}
|
|
6642
|
+
else {
|
|
6643
|
+
return part.toString();
|
|
6644
|
+
}
|
|
6645
|
+
})
|
|
6646
|
+
.join("");
|
|
6647
|
+
}
|
|
6648
|
+
}
|
|
6649
|
+
exports.VariableValueContainingReferences = VariableValueContainingReferences;
|
|
6650
|
+
// regex to resolve references in catladder variables
|
|
6651
|
+
// those expressions have the pattern ${componentName:variableName}
|
|
6652
|
+
const REGEX = /\$\{(([^:}]+):)?([^}]+)}/gm;
|
|
6653
|
+
const createVariableValueContainingReferencesFromString = (value, options) => {
|
|
6654
|
+
const parts = [];
|
|
6655
|
+
let match;
|
|
6656
|
+
let lastIndex = 0;
|
|
6657
|
+
while ((match = REGEX.exec(value)) !== null) {
|
|
6658
|
+
const [fullMatch, _, otherComponentName, variableName] = match;
|
|
6659
|
+
parts.push(value.slice(lastIndex, match.index));
|
|
6660
|
+
parts.push(new VariableReference(otherComponentName || options.componentName, variableName));
|
|
6661
|
+
lastIndex = REGEX.lastIndex;
|
|
6662
|
+
}
|
|
6663
|
+
parts.push(value.slice(lastIndex));
|
|
6664
|
+
return new VariableValueContainingReferences(parts);
|
|
6665
|
+
};
|
|
6666
|
+
exports.createVariableValueContainingReferencesFromString = createVariableValueContainingReferencesFromString;
|
|
6667
|
+
//# sourceMappingURL=VariableValueContainingReferences.js.map
|
|
6668
|
+
|
|
6669
|
+
/***/ }),
|
|
6670
|
+
|
|
6671
|
+
/***/ 4035:
|
|
6672
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
6673
|
+
|
|
6674
|
+
"use strict";
|
|
6675
|
+
|
|
6676
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6677
|
+
exports.replaceAllReferences = void 0;
|
|
6678
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(1592);
|
|
6679
|
+
const replaceAllReferencesOnce_1 = __nccwpck_require__(2726);
|
|
6680
|
+
const replaceAllReferences = async (values, getEnvVars) => {
|
|
6681
|
+
// replace until there aren't any references left
|
|
6682
|
+
let result = values;
|
|
6683
|
+
let i = 0;
|
|
6684
|
+
while (Object.values(result).some((value) => value.parts.some((part) => part instanceof VariableValueContainingReferences_1.VariableReference))) {
|
|
6685
|
+
const replaced = await (0, replaceAllReferencesOnce_1.replaceAllReferencesOnce)(result, getEnvVars);
|
|
6686
|
+
result = replaced;
|
|
6687
|
+
i++;
|
|
6688
|
+
if (i > 1000) {
|
|
6689
|
+
const unresolved = Object.entries(result).filter(([key, value]) => value.parts.some((part) => part instanceof VariableValueContainingReferences_1.VariableReference));
|
|
6690
|
+
throw new Error("Infinite loop detected in these variables: " +
|
|
6691
|
+
unresolved
|
|
6692
|
+
.map(([key, value]) => `${key} (last reference: ${value.parts.find((part) => part instanceof VariableValueContainingReferences_1.VariableReference)})`)
|
|
6693
|
+
.join(", "));
|
|
6694
|
+
}
|
|
6695
|
+
}
|
|
6696
|
+
return result;
|
|
6697
|
+
};
|
|
6698
|
+
exports.replaceAllReferences = replaceAllReferences;
|
|
6699
|
+
//# sourceMappingURL=replaceAllReferences.js.map
|
|
6700
|
+
|
|
6701
|
+
/***/ }),
|
|
6702
|
+
|
|
6703
|
+
/***/ 2726:
|
|
6704
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
6705
|
+
|
|
6706
|
+
"use strict";
|
|
6707
|
+
|
|
6708
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6709
|
+
exports.replaceAllReferencesOnce = void 0;
|
|
6710
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(1592);
|
|
6711
|
+
const replaceReferencesOnce_1 = __nccwpck_require__(8666);
|
|
6712
|
+
const replaceAllReferencesOnce = async (values, getEnvVars) => {
|
|
6713
|
+
const allReferences = Object.values(values).flatMap((value) => value === null || value === void 0 ? void 0 : value.parts.filter((part) => part instanceof VariableValueContainingReferences_1.VariableReference));
|
|
6714
|
+
const allComponentsUnique = Array.from(new Set(allReferences.map((reference) => reference.componentName)));
|
|
6715
|
+
const allEnvVarsInComponents = Object.fromEntries(await Promise.all(allComponentsUnique.map(async (componentName) => [
|
|
6716
|
+
componentName,
|
|
6717
|
+
await getEnvVars(componentName),
|
|
6718
|
+
])));
|
|
6719
|
+
return Object.fromEntries(Object.entries(values).map(([key, value]) => [
|
|
6720
|
+
key,
|
|
6721
|
+
value !== null && value !== undefined
|
|
6722
|
+
? (0, replaceReferencesOnce_1.replaceReferencesOnce)(value, ({ componentName, variableName }) => {
|
|
6723
|
+
return allEnvVarsInComponents[componentName][variableName];
|
|
6724
|
+
})
|
|
6725
|
+
: value,
|
|
6726
|
+
]));
|
|
6727
|
+
};
|
|
6728
|
+
exports.replaceAllReferencesOnce = replaceAllReferencesOnce;
|
|
6729
|
+
//# sourceMappingURL=replaceAllReferencesOnce.js.map
|
|
6730
|
+
|
|
6731
|
+
/***/ }),
|
|
6732
|
+
|
|
6733
|
+
/***/ 8666:
|
|
6734
|
+
/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
|
|
6735
|
+
|
|
6736
|
+
"use strict";
|
|
6737
|
+
|
|
6738
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
6739
|
+
exports.replaceReferencesOnce = void 0;
|
|
6740
|
+
const VariableValueContainingReferences_1 = __nccwpck_require__(1592);
|
|
6741
|
+
const replaceReferencesOnce = (value, replacer) => {
|
|
6742
|
+
const replacedParts = value.parts.map((part) => {
|
|
6743
|
+
if (part instanceof VariableValueContainingReferences_1.VariableReference) {
|
|
6744
|
+
const result = replacer({
|
|
6745
|
+
componentName: part.componentName,
|
|
6746
|
+
variableName: part.variableName,
|
|
6747
|
+
});
|
|
6748
|
+
return result !== null && result !== void 0 ? result : new VariableValueContainingReferences_1.UnresolvableReference(part);
|
|
6749
|
+
}
|
|
6750
|
+
else {
|
|
6751
|
+
return part;
|
|
6752
|
+
}
|
|
6753
|
+
});
|
|
6754
|
+
return new VariableValueContainingReferences_1.VariableValueContainingReferences(replacedParts);
|
|
6755
|
+
};
|
|
6756
|
+
exports.replaceReferencesOnce = replaceReferencesOnce;
|
|
6757
|
+
//# sourceMappingURL=replaceReferencesOnce.js.map
|
|
6758
|
+
|
|
6759
|
+
/***/ }),
|
|
6760
|
+
|
|
6654
6761
|
/***/ 5763:
|
|
6655
6762
|
/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => {
|
|
6656
6763
|
|
|
@@ -39770,7 +39877,7 @@ module.exports = safer
|
|
|
39770
39877
|
|
|
39771
39878
|
/***/ }),
|
|
39772
39879
|
|
|
39773
|
-
/***/
|
|
39880
|
+
/***/ 7548:
|
|
39774
39881
|
/***/ (function(module) {
|
|
39775
39882
|
|
|
39776
39883
|
|