@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.
Files changed (48) hide show
  1. package/dist/bundles/catenv/index.js +230 -121
  2. package/dist/bundles/cli/index.js +226 -117
  3. package/dist/pipeline/src/bash/BashExpression.d.ts +3 -1
  4. package/dist/pipeline/src/bash/BashExpression.js +10 -3
  5. package/dist/pipeline/src/bash/BashExpression.js.map +1 -1
  6. package/dist/pipeline/src/bash/bashYaml.js +25 -2
  7. package/dist/pipeline/src/bash/bashYaml.js.map +1 -1
  8. package/dist/pipeline/src/build/cache/createJobCache.js +5 -1
  9. package/dist/pipeline/src/build/cache/createJobCache.js.map +1 -1
  10. package/dist/pipeline/src/build/docker.js +1 -1
  11. package/dist/pipeline/src/build/docker.js.map +1 -1
  12. package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +1 -1
  13. package/dist/pipeline/src/context/getEnvironmentVariables.js +20 -10
  14. package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
  15. package/dist/pipeline/src/context/resolveReferences.d.ts +0 -3
  16. package/dist/pipeline/src/context/resolveReferences.js +1 -53
  17. package/dist/pipeline/src/context/resolveReferences.js.map +1 -1
  18. package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js +2 -0
  19. package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js.map +1 -1
  20. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.d.ts +2 -2
  21. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
  22. package/dist/pipeline/src/deploy/kubernetes/kubeEnv.d.ts +3 -3
  23. package/dist/pipeline/src/deploy/kubernetes/kubeValues.d.ts +2 -2
  24. package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.d.ts +2 -2
  25. package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.js.map +1 -1
  26. package/dist/pipeline/src/deploy/types/googleCloudRun.d.ts +7 -2
  27. package/dist/pipeline/src/types/context.d.ts +2 -1
  28. package/dist/pipeline/src/types/context.js.map +1 -1
  29. package/dist/pipeline/src/variables/VariableValue.d.ts +3 -0
  30. package/dist/pipeline/src/variables/VariableValue.js +3 -0
  31. package/dist/pipeline/src/variables/VariableValue.js.map +1 -0
  32. package/dist/pipeline/src/variables/VariableValueContainingReferences.d.ts +25 -0
  33. package/dist/pipeline/src/variables/VariableValueContainingReferences.js +62 -0
  34. package/dist/pipeline/src/variables/VariableValueContainingReferences.js.map +1 -0
  35. package/dist/pipeline/src/variables/replaceAllReferences.d.ts +3 -0
  36. package/dist/pipeline/src/variables/replaceAllReferences.js +25 -0
  37. package/dist/pipeline/src/variables/replaceAllReferences.js.map +1 -0
  38. package/dist/pipeline/src/variables/replaceAllReferencesOnce.d.ts +5 -0
  39. package/dist/pipeline/src/variables/replaceAllReferencesOnce.js +23 -0
  40. package/dist/pipeline/src/variables/replaceAllReferencesOnce.js.map +1 -0
  41. package/dist/pipeline/src/variables/replaceReferencesOnce.d.ts +8 -0
  42. package/dist/pipeline/src/variables/replaceReferencesOnce.js +21 -0
  43. package/dist/pipeline/src/variables/replaceReferencesOnce.js.map +1 -0
  44. package/dist/tsconfig.tsbuildinfo +1 -1
  45. package/package.json +1 -1
  46. package/dist/pipeline/src/bash/replaceAsync.d.ts +0 -2
  47. package/dist/pipeline/src/bash/replaceAsync.js +0 -37
  48. package/dist/pipeline/src/bash/replaceAsync.js.map +0 -1
@@ -3919,12 +3919,13 @@ exports.getShell = getShell;
3919
3919
  /***/ }),
3920
3920
 
3921
3921
  /***/ 42376:
3922
- /***/ ((__unused_webpack_module, exports) => {
3922
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
3923
3923
 
3924
3924
  "use strict";
3925
3925
 
3926
3926
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3927
3927
  exports.bashEscape = exports.joinBashExpressions = exports.getBashVariable = exports.BashExpression = void 0;
3928
+ const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
3928
3929
  /**
3929
3930
  * this class represents a string that can be evaluated in bash scripts.
3930
3931
  *
@@ -3940,6 +3941,9 @@ class BashExpression {
3940
3941
  toString() {
3941
3942
  return this.value.toString();
3942
3943
  }
3944
+ replace(searchValue, replacer) {
3945
+ return new BashExpression(this.value.toString().replace(searchValue, replacer));
3946
+ }
3943
3947
  /**
3944
3948
  *
3945
3949
  * @returns a bash expression to lowercase the string
@@ -3993,10 +3997,13 @@ const bashEscape = (value) => {
3993
3997
  if (value instanceof BashExpression) {
3994
3998
  return value.toString(); // no need to escape bash expressions, as we want them to evaluate
3995
3999
  }
4000
+ if (value instanceof VariableValueContainingReferences_1.VariableValueContainingReferences) {
4001
+ return value.toString({
4002
+ escapeQuotes: true,
4003
+ });
4004
+ }
3996
4005
  // we wrap it in double quotes, so we need to escape them
3997
- if (typeof value === "string")
3998
- return value.replace(/"/g, '\\"');
3999
- return value;
4006
+ return value === null || value === void 0 ? void 0 : value.toString().replace(/"/g, '\\"');
4000
4007
  };
4001
4008
  exports.bashEscape = bashEscape;
4002
4009
  //# sourceMappingURL=BashExpression.js.map
@@ -4029,6 +4036,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
4029
4036
  exports.writeBashYamlToFileScript = exports.yamlBashString = void 0;
4030
4037
  const yaml_1 = __nccwpck_require__(68033);
4031
4038
  const BashExpression_1 = __nccwpck_require__(42376);
4039
+ const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
4032
4040
  const bashExpressionType = {
4033
4041
  tag: "",
4034
4042
  resolve: (str) => {
@@ -4039,10 +4047,32 @@ const bashExpressionType = {
4039
4047
  // we create a BLOCK_LITERAL
4040
4048
  // but because bash will interpret the value, it may resolve to a multiline string
4041
4049
  // so we need to indent every line using sed
4042
- return "|-\n" + node.value.transformWithCommand(`sed 's/^/${ctx.indent}/'`);
4050
+ return ("|-\n" +
4051
+ ctx.indent +
4052
+ indentNewlinesInBashExpression(node.value, ctx.indent));
4043
4053
  },
4044
4054
  identify: (v) => v instanceof BashExpression_1.BashExpression,
4045
4055
  };
4056
+ const indentNewlinesInBashExpression = (expression, indent) => {
4057
+ return expression.transformWithCommand(`sed '1!s/^/${indent}/'`);
4058
+ };
4059
+ const variableContainingReferences = {
4060
+ tag: "",
4061
+ resolve: (str) => {
4062
+ // not really needed,but let's make typescript happy
4063
+ return new VariableValueContainingReferences_1.VariableValueContainingReferences(str);
4064
+ },
4065
+ stringify(node, ctx) {
4066
+ const value = node.value;
4067
+ const stringified = value.parts
4068
+ .map((part) => part instanceof BashExpression_1.BashExpression
4069
+ ? indentNewlinesInBashExpression(part, ctx.indent)
4070
+ : part.toString().replace(/\n/g, `\n${ctx.indent}`))
4071
+ .join("");
4072
+ return "|-\n" + ctx.indent + stringified;
4073
+ },
4074
+ identify: (v) => v instanceof VariableValueContainingReferences_1.VariableValueContainingReferences,
4075
+ };
4046
4076
  /***
4047
4077
  * creates a yaml string that can be used in bash scripts
4048
4078
  * it handles BashExpressions correctly so that they can be evaluated in bash
@@ -4051,7 +4081,7 @@ const yamlBashString = (value) => {
4051
4081
  return (0, yaml_1.stringify)(value, {
4052
4082
  defaultStringType: "BLOCK_LITERAL",
4053
4083
  defaultKeyType: "PLAIN",
4054
- customTags: [bashExpressionType],
4084
+ customTags: [bashExpressionType, variableContainingReferences],
4055
4085
  aliasDuplicateObjects: false,
4056
4086
  lineWidth: 0,
4057
4087
  });
@@ -4096,50 +4126,6 @@ exports.getInjectVarsScript = getInjectVarsScript;
4096
4126
 
4097
4127
  /***/ }),
4098
4128
 
4099
- /***/ 72233:
4100
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
4101
-
4102
- "use strict";
4103
-
4104
- Object.defineProperty(exports, "__esModule", ({ value: true }));
4105
- const BashExpression_1 = __nccwpck_require__(42376);
4106
- // from https://github.com/dsblv/string-replace-async/blob/main/index.js
4107
- // and adjusted a bit
4108
- async function replaceAsync(string, searchValue, replacer) {
4109
- const wasBashExpression = string instanceof BashExpression_1.BashExpression;
4110
- try {
4111
- // 1. Run fake pass of `replace`, collect values from `replacer` calls
4112
- // 2. Resolve them with `Promise.all`
4113
- // 3. Run `replace` with resolved values
4114
- const values = [];
4115
- String.prototype.replace.call(string.toString(), searchValue, function (...args) {
4116
- // eslint-disable-next-line prefer-spread
4117
- const result = replacer.apply(undefined, args);
4118
- values.push(result);
4119
- return "";
4120
- });
4121
- const resolvedValues = await Promise.all(values);
4122
- const containsBashExpression = resolvedValues.some((value) => value instanceof BashExpression_1.BashExpression);
4123
- const result = String.prototype.replace.call(string.toString(), searchValue, function () {
4124
- var _a, _b;
4125
- return (_b = (_a = resolvedValues.shift()) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : "";
4126
- });
4127
- if (wasBashExpression || containsBashExpression) {
4128
- return new BashExpression_1.BashExpression(result);
4129
- }
4130
- else {
4131
- return result;
4132
- }
4133
- }
4134
- catch (error) {
4135
- return Promise.reject(error);
4136
- }
4137
- }
4138
- exports["default"] = replaceAsync;
4139
- //# sourceMappingURL=replaceAsync.js.map
4140
-
4141
- /***/ }),
4142
-
4143
4129
  /***/ 43397:
4144
4130
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
4145
4131
 
@@ -4465,14 +4451,18 @@ exports.componentContextNeedsBuildTimeDotEnv = componentContextNeedsBuildTimeDot
4465
4451
  /***/ }),
4466
4452
 
4467
4453
  /***/ 10340:
4468
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
4454
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
4469
4455
 
4470
4456
  "use strict";
4471
4457
 
4458
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4459
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4460
+ };
4472
4461
  Object.defineProperty(exports, "__esModule", ({ value: true }));
4473
4462
  exports.createJobCacheFromConfig = exports.createJobCacheFromCacheConfigs = void 0;
4474
4463
  const path_1 = __nccwpck_require__(71017);
4475
4464
  const getAllCacheConfigsFromConfig_1 = __nccwpck_require__(30673);
4465
+ const slugify_1 = __importDefault(__nccwpck_require__(44035));
4476
4466
  const createJobCacheFromCacheConfigs = (context, caches) => {
4477
4467
  if (caches.length === 0)
4478
4468
  return undefined;
@@ -4501,7 +4491,7 @@ const createJobCacheFromCacheConfigs = (context, caches) => {
4501
4491
  ? key
4502
4492
  : typeof key === "string"
4503
4493
  ? (scope === "buildDir" // really edge case...
4504
- ? baseDir
4494
+ ? (0, slugify_1.default)(baseDir)
4505
4495
  : context.name) +
4506
4496
  "-" +
4507
4497
  key
@@ -4810,7 +4800,7 @@ const getDockerJobBaseProps = () => {
4810
4800
  services: [
4811
4801
  {
4812
4802
  name: "docker:24.0.6-dind", // see see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27300#note_466755332
4813
- command: ["--tls=false"],
4803
+ command: ["--tls=false", "--registry-mirror=https://mirror.gcr.io"],
4814
4804
  },
4815
4805
  ],
4816
4806
  variables: {},
@@ -6108,7 +6098,9 @@ const getBuildInfoVariables_1 = __nccwpck_require__(17827);
6108
6098
  const getEnvironmentContext_1 = __nccwpck_require__(13663);
6109
6099
  const resolveReferences_1 = __nccwpck_require__(43115);
6110
6100
  const transformJobOnlyVars_1 = __nccwpck_require__(1552);
6101
+ const replaceAllReferences_1 = __nccwpck_require__(4035);
6111
6102
  const envVars_1 = __nccwpck_require__(16296);
6103
+ const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
6112
6104
  const getBasePredefinedVariables = (ctx) => {
6113
6105
  return {
6114
6106
  ENV_SHORT: ctx.env,
@@ -6117,7 +6109,7 @@ const getBasePredefinedVariables = (ctx) => {
6117
6109
  ...(ctx.envType !== "local" ? (0, getBuildInfoVariables_1.getBuildInfoVariables)(ctx) : {}),
6118
6110
  };
6119
6111
  };
6120
- const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
6112
+ const getEnvironmentVariables = async (ctx, shouldResolveReferences = true) => {
6121
6113
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
6122
6114
  const environmentContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
6123
6115
  const { config, env, componentName } = ctx;
@@ -6180,18 +6172,26 @@ const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
6180
6172
  const legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
6181
6173
  const publicEnvVarsRawWithLegacyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
6182
6174
  const publicEnvVarsRawSanitized = (0, envVars_1.stringifyValues)(publicEnvVarsRawWithLegacyFromComponents);
6183
- const envVarsRaw = addIndexVar({
6175
+ const publicEnvVarsUnresolved = Object.fromEntries(Object.entries(publicEnvVarsRawSanitized).map(([key, value]) => [
6176
+ key,
6177
+ (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)(value, {
6178
+ componentName: ctx.componentName,
6179
+ }),
6180
+ ]));
6181
+ const publicEnvVars = shouldResolveReferences
6182
+ ? await (0, replaceAllReferences_1.replaceAllReferences)(publicEnvVarsUnresolved, async (otherComponentName) => {
6183
+ const { envVars: otherEnvVars } = await (0, exports.getEnvironmentVariables)({
6184
+ ...ctx,
6185
+ componentName: otherComponentName,
6186
+ }, false);
6187
+ return otherEnvVars;
6188
+ })
6189
+ : publicEnvVarsUnresolved;
6190
+ const envVars = addIndexVar({
6184
6191
  ...predefinedVariables,
6185
6192
  ...secretEnvVars,
6186
- ...publicEnvVarsRawSanitized,
6193
+ ...publicEnvVars,
6187
6194
  });
6188
- const envVars = (await (0, resolveReferences_1.resolveReferences)(envVarsRaw, async (otherComponentName, alreadyVisited) => {
6189
- const { envVars: otherEnvVars } = await (0, exports.getEnvironmentVariables)({
6190
- ...ctx,
6191
- componentName: otherComponentName,
6192
- }, alreadyVisited);
6193
- return otherEnvVars;
6194
- }, alreadyVisited));
6195
6195
  return {
6196
6196
  envVars,
6197
6197
  secretEnvVarKeys,
@@ -6310,64 +6310,12 @@ __exportStar(__nccwpck_require__(45133), exports);
6310
6310
  /***/ }),
6311
6311
 
6312
6312
  /***/ 43115:
6313
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
6313
+ /***/ ((__unused_webpack_module, exports) => {
6314
6314
 
6315
6315
  "use strict";
6316
6316
 
6317
- var __importDefault = (this && this.__importDefault) || function (mod) {
6318
- return (mod && mod.__esModule) ? mod : { "default": mod };
6319
- };
6320
6317
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6321
- exports.translateLegacyFromComponents = exports.resolveReferences = void 0;
6322
- const lodash_1 = __nccwpck_require__(23255);
6323
- const replaceAsync_1 = __importDefault(__nccwpck_require__(72233));
6324
- // regex to resolve references in catladder variables
6325
- // those expressions have the pattern ${componentName:variableName}
6326
- const REGEX = /\$\{(([^:}]+):)?([^}]+)}/gm;
6327
- const resolveReferences = async (vars, getOtherVariables, alreadyVisitedBase = {}) => {
6328
- /**
6329
- *
6330
- * replace referenced variables with their values in a value string
6331
- */
6332
- const replaceSingleValue = async (value, alreadyVisited = alreadyVisitedBase) => {
6333
- if (REGEX.test(value.toString())) {
6334
- // we consider variables that got references in it BashExpressions, because the replacement may be one
6335
- return await (0, replaceAsync_1.default)(value, REGEX, async (match, _, componentName, variableName) => {
6336
- var _a, _b;
6337
- if ((_a = alreadyVisited[componentName]) === null || _a === void 0 ? void 0 : _a[variableName]) {
6338
- return match; // prevent endless loop
6339
- }
6340
- const newAlreadyVisited = (0, lodash_1.merge)({}, alreadyVisited, {
6341
- [componentName]: {
6342
- [variableName]: true,
6343
- },
6344
- });
6345
- const result = componentName
6346
- ? (_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
6347
- : vars[variableName]; // is self reference
6348
- const replaced = result !== null && result !== undefined
6349
- ? await replaceSingleValue(result, newAlreadyVisited)
6350
- : match;
6351
- return replaced;
6352
- });
6353
- }
6354
- else {
6355
- return value;
6356
- }
6357
- };
6358
- return Object.fromEntries(await Promise.all(Object.entries(vars).map(async ([key, value]) => {
6359
- if (value === null || value === undefined) {
6360
- return [key, null];
6361
- }
6362
- return [
6363
- key,
6364
- value !== null && value !== undefined
6365
- ? await replaceSingleValue(value)
6366
- : null,
6367
- ];
6368
- })));
6369
- };
6370
- exports.resolveReferences = resolveReferences;
6318
+ exports.translateLegacyFromComponents = void 0;
6371
6319
  const translateLegacyFromComponents = (fromComponents) => {
6372
6320
  return Object.fromEntries(Object.entries(fromComponents).flatMap(([componentName, variables]) => {
6373
6321
  return Object.entries(variables).map(([ourName, otherName]) => [
@@ -7103,6 +7051,8 @@ const getServiceDeployScript = (context, service, nameSuffix) => {
7103
7051
  timeout: customConfig === null || customConfig === void 0 ? void 0 : customConfig.timeout,
7104
7052
  "vpc-connector": customConfig === null || customConfig === void 0 ? void 0 : customConfig.vpcConnector,
7105
7053
  "vpc-egress": customConfig === null || customConfig === void 0 ? void 0 : customConfig.vpcEgress,
7054
+ network: customConfig === null || customConfig === void 0 ? void 0 : customConfig.network,
7055
+ subnet: customConfig === null || customConfig === void 0 ? void 0 : customConfig.subnet,
7106
7056
  "use-http2": customConfig === null || customConfig === void 0 ? void 0 : customConfig.http2,
7107
7057
  "allow-unauthenticated": (_d = customConfig === null || customConfig === void 0 ? void 0 : customConfig.allowUnauthenticated) !== null && _d !== void 0 ? _d : true,
7108
7058
  ingress: (_e = customConfig === null || customConfig === void 0 ? void 0 : customConfig.ingress) !== null && _e !== void 0 ? _e : "all",
@@ -9819,6 +9769,165 @@ exports.writeYamlfile = writeYamlfile;
9819
9769
 
9820
9770
  /***/ }),
9821
9771
 
9772
+ /***/ 84474:
9773
+ /***/ ((__unused_webpack_module, exports) => {
9774
+
9775
+ "use strict";
9776
+
9777
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9778
+ exports.createVariableValueContainingReferencesFromString = exports.VariableValueContainingReferences = exports.VariableReference = exports.UnresolvableReference = void 0;
9779
+ class UnresolvableReference {
9780
+ constructor(reference) {
9781
+ this.reference = reference;
9782
+ }
9783
+ toString() {
9784
+ return `Unresolvable reference: ${this.reference.toString()}`;
9785
+ }
9786
+ }
9787
+ exports.UnresolvableReference = UnresolvableReference;
9788
+ class VariableReference {
9789
+ constructor(componentName, variableName) {
9790
+ this.componentName = componentName;
9791
+ this.variableName = variableName;
9792
+ }
9793
+ toString() {
9794
+ return `\${${this.componentName}:${this.variableName}}`;
9795
+ }
9796
+ }
9797
+ exports.VariableReference = VariableReference;
9798
+ class VariableValueContainingReferences {
9799
+ constructor(parts) {
9800
+ this.parts = (Array.isArray(parts) ? parts : [parts]).flatMap((part) => part instanceof VariableValueContainingReferences
9801
+ ? part.parts
9802
+ : part === ""
9803
+ ? []
9804
+ : [part]);
9805
+ }
9806
+ toString(options = { escapeQuotes: false }) {
9807
+ return this.parts
9808
+ .map((part) => {
9809
+ if (typeof part === "string") {
9810
+ return options.escapeQuotes ? part.replace(/"/g, '\\"') : part;
9811
+ }
9812
+ else {
9813
+ return part.toString();
9814
+ }
9815
+ })
9816
+ .join("");
9817
+ }
9818
+ }
9819
+ exports.VariableValueContainingReferences = VariableValueContainingReferences;
9820
+ // regex to resolve references in catladder variables
9821
+ // those expressions have the pattern ${componentName:variableName}
9822
+ const REGEX = /\$\{(([^:}]+):)?([^}]+)}/gm;
9823
+ const createVariableValueContainingReferencesFromString = (value, options) => {
9824
+ const parts = [];
9825
+ let match;
9826
+ let lastIndex = 0;
9827
+ while ((match = REGEX.exec(value)) !== null) {
9828
+ const [fullMatch, _, otherComponentName, variableName] = match;
9829
+ parts.push(value.slice(lastIndex, match.index));
9830
+ parts.push(new VariableReference(otherComponentName || options.componentName, variableName));
9831
+ lastIndex = REGEX.lastIndex;
9832
+ }
9833
+ parts.push(value.slice(lastIndex));
9834
+ return new VariableValueContainingReferences(parts);
9835
+ };
9836
+ exports.createVariableValueContainingReferencesFromString = createVariableValueContainingReferencesFromString;
9837
+ //# sourceMappingURL=VariableValueContainingReferences.js.map
9838
+
9839
+ /***/ }),
9840
+
9841
+ /***/ 4035:
9842
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
9843
+
9844
+ "use strict";
9845
+
9846
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9847
+ exports.replaceAllReferences = void 0;
9848
+ const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
9849
+ const replaceAllReferencesOnce_1 = __nccwpck_require__(62726);
9850
+ const replaceAllReferences = async (values, getEnvVars) => {
9851
+ // replace until there aren't any references left
9852
+ let result = values;
9853
+ let i = 0;
9854
+ while (Object.values(result).some((value) => value.parts.some((part) => part instanceof VariableValueContainingReferences_1.VariableReference))) {
9855
+ const replaced = await (0, replaceAllReferencesOnce_1.replaceAllReferencesOnce)(result, getEnvVars);
9856
+ result = replaced;
9857
+ i++;
9858
+ if (i > 1000) {
9859
+ const unresolved = Object.entries(result).filter(([key, value]) => value.parts.some((part) => part instanceof VariableValueContainingReferences_1.VariableReference));
9860
+ throw new Error("Infinite loop detected in these variables: " +
9861
+ unresolved
9862
+ .map(([key, value]) => `${key} (last reference: ${value.parts.find((part) => part instanceof VariableValueContainingReferences_1.VariableReference)})`)
9863
+ .join(", "));
9864
+ }
9865
+ }
9866
+ return result;
9867
+ };
9868
+ exports.replaceAllReferences = replaceAllReferences;
9869
+ //# sourceMappingURL=replaceAllReferences.js.map
9870
+
9871
+ /***/ }),
9872
+
9873
+ /***/ 62726:
9874
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
9875
+
9876
+ "use strict";
9877
+
9878
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9879
+ exports.replaceAllReferencesOnce = void 0;
9880
+ const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
9881
+ const replaceReferencesOnce_1 = __nccwpck_require__(78666);
9882
+ const replaceAllReferencesOnce = async (values, getEnvVars) => {
9883
+ const allReferences = Object.values(values).flatMap((value) => value === null || value === void 0 ? void 0 : value.parts.filter((part) => part instanceof VariableValueContainingReferences_1.VariableReference));
9884
+ const allComponentsUnique = Array.from(new Set(allReferences.map((reference) => reference.componentName)));
9885
+ const allEnvVarsInComponents = Object.fromEntries(await Promise.all(allComponentsUnique.map(async (componentName) => [
9886
+ componentName,
9887
+ await getEnvVars(componentName),
9888
+ ])));
9889
+ return Object.fromEntries(Object.entries(values).map(([key, value]) => [
9890
+ key,
9891
+ value !== null && value !== undefined
9892
+ ? (0, replaceReferencesOnce_1.replaceReferencesOnce)(value, ({ componentName, variableName }) => {
9893
+ return allEnvVarsInComponents[componentName][variableName];
9894
+ })
9895
+ : value,
9896
+ ]));
9897
+ };
9898
+ exports.replaceAllReferencesOnce = replaceAllReferencesOnce;
9899
+ //# sourceMappingURL=replaceAllReferencesOnce.js.map
9900
+
9901
+ /***/ }),
9902
+
9903
+ /***/ 78666:
9904
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
9905
+
9906
+ "use strict";
9907
+
9908
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9909
+ exports.replaceReferencesOnce = void 0;
9910
+ const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
9911
+ const replaceReferencesOnce = (value, replacer) => {
9912
+ const replacedParts = value.parts.map((part) => {
9913
+ if (part instanceof VariableValueContainingReferences_1.VariableReference) {
9914
+ const result = replacer({
9915
+ componentName: part.componentName,
9916
+ variableName: part.variableName,
9917
+ });
9918
+ return result !== null && result !== void 0 ? result : new VariableValueContainingReferences_1.UnresolvableReference(part);
9919
+ }
9920
+ else {
9921
+ return part;
9922
+ }
9923
+ });
9924
+ return new VariableValueContainingReferences_1.VariableValueContainingReferences(replacedParts);
9925
+ };
9926
+ exports.replaceReferencesOnce = replaceReferencesOnce;
9927
+ //# sourceMappingURL=replaceReferencesOnce.js.map
9928
+
9929
+ /***/ }),
9930
+
9822
9931
  /***/ 93090:
9823
9932
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
9824
9933
 
@@ -1,3 +1,4 @@
1
+ import type { VariableValue } from "../variables/VariableValue";
1
2
  /**
2
3
  * this class represents a string that can be evaluated in bash scripts.
3
4
  *
@@ -8,6 +9,7 @@ export declare class BashExpression {
8
9
  constructor(value: string | BashExpression);
9
10
  toJSON(): string;
10
11
  toString(): string;
12
+ replace(searchValue: any, replacer: (substring: string, ...args: any[]) => string): BashExpression;
11
13
  /**
12
14
  *
13
15
  * @returns a bash expression to lowercase the string
@@ -37,4 +39,4 @@ export declare const joinBashExpressions: (parts: Array<StringOrBashExpression>,
37
39
  * escapes a string or bash expression for bash
38
40
  * it mainly escapes double quotes
39
41
  */
40
- export declare const bashEscape: (value: StringOrBashExpression | any) => any;
42
+ export declare const bashEscape: (value: VariableValue | any) => any;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.bashEscape = exports.joinBashExpressions = exports.getBashVariable = exports.BashExpression = void 0;
4
+ const VariableValueContainingReferences_1 = require("../variables/VariableValueContainingReferences");
4
5
  /**
5
6
  * this class represents a string that can be evaluated in bash scripts.
6
7
  *
@@ -16,6 +17,9 @@ class BashExpression {
16
17
  toString() {
17
18
  return this.value.toString();
18
19
  }
20
+ replace(searchValue, replacer) {
21
+ return new BashExpression(this.value.toString().replace(searchValue, replacer));
22
+ }
19
23
  /**
20
24
  *
21
25
  * @returns a bash expression to lowercase the string
@@ -69,10 +73,13 @@ const bashEscape = (value) => {
69
73
  if (value instanceof BashExpression) {
70
74
  return value.toString(); // no need to escape bash expressions, as we want them to evaluate
71
75
  }
76
+ if (value instanceof VariableValueContainingReferences_1.VariableValueContainingReferences) {
77
+ return value.toString({
78
+ escapeQuotes: true,
79
+ });
80
+ }
72
81
  // we wrap it in double quotes, so we need to escape them
73
- if (typeof value === "string")
74
- return value.replace(/"/g, '\\"');
75
- return value;
82
+ return value === null || value === void 0 ? void 0 : value.toString().replace(/"/g, '\\"');
76
83
  };
77
84
  exports.bashEscape = bashEscape;
78
85
  //# sourceMappingURL=BashExpression.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BashExpression.js","sourceRoot":"","sources":["../../../../../pipeline/src/bash/BashExpression.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,MAAa,cAAc;IACzB,YAAoB,KAA8B;QAA9B,UAAK,GAAL,KAAK,CAAyB;IAAG,CAAC;IAC/C,MAAM;QACX,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IACM,QAAQ;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACI,WAAW;QAChB,OAAO,IAAI,CAAC,oBAAoB,CAAC,2BAA2B,CAAC,CAAC;IAChE,CAAC;IACD;;;;OAIG;IACI,MAAM,CAAC,GAAG,MAAsC;QACrD,OAAO,IAAI,cAAc,CACvB,IAAI,CAAC,QAAQ,EAAE,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAC3D,CAAC;IACJ,CAAC;IAEM,oBAAoB,CAAC,OAAe;QACzC,OAAO,IAAI,cAAc;QACvB,0CAA0C;QAC1C,gBAAgB,IAAI,CAAC,QAAQ,EAAE,OAAO,OAAO,GAAG,CACjD,CAAC;IACJ,CAAC;CACF;AAjCD,wCAiCC;AAIM,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,cAAc,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;AAAnE,QAAA,eAAe,mBAAoD;AAEhF;;;;;;;;GAQG;AACI,MAAM,mBAAmB,GAAG,CACjC,KAAoC,EACpC,MAAM,GAAG,EAAE,EACa,EAAE;IAC1B,MAAM,mBAAmB,GAAG,KAAK,CAAC,IAAI,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;SAAM,CAAC;QACN,OAAO,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC5B,CAAC;AACH,CAAC,CAAC;AAdW,QAAA,mBAAmB,uBAc9B;AAEF;;;GAGG;AACI,MAAM,UAAU,GAAG,CAAC,KAA0B,EAAE,EAAE;IACvD,IAAI,KAAK,YAAY,cAAc,EAAE,CAAC;QACpC,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,kEAAkE;IAC7F,CAAC;IACD,IAAI,KAAK,YAAY,qEAAiC,EAAE,CAAC;QACvD,OAAO,KAAK,CAAC,QAAQ,CAAC;YACpB,YAAY,EAAE,IAAI;SACnB,CAAC,CAAC;IACL,CAAC;IACD,yDAAyD;IACzD,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAChD,CAAC,CAAC;AAXW,QAAA,UAAU,cAWrB"}
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.writeBashYamlToFileScript = exports.yamlBashString = void 0;
4
4
  const yaml_1 = require("yaml");
5
5
  const BashExpression_1 = require("./BashExpression");
6
+ const VariableValueContainingReferences_1 = require("../variables/VariableValueContainingReferences");
6
7
  const bashExpressionType = {
7
8
  tag: "",
8
9
  resolve: (str) => {
@@ -13,10 +14,32 @@ const bashExpressionType = {
13
14
  // we create a BLOCK_LITERAL
14
15
  // but because bash will interpret the value, it may resolve to a multiline string
15
16
  // so we need to indent every line using sed
16
- return "|-\n" + node.value.transformWithCommand(`sed 's/^/${ctx.indent}/'`);
17
+ return ("|-\n" +
18
+ ctx.indent +
19
+ indentNewlinesInBashExpression(node.value, ctx.indent));
17
20
  },
18
21
  identify: (v) => v instanceof BashExpression_1.BashExpression,
19
22
  };
23
+ const indentNewlinesInBashExpression = (expression, indent) => {
24
+ return expression.transformWithCommand(`sed '1!s/^/${indent}/'`);
25
+ };
26
+ const variableContainingReferences = {
27
+ tag: "",
28
+ resolve: (str) => {
29
+ // not really needed,but let's make typescript happy
30
+ return new VariableValueContainingReferences_1.VariableValueContainingReferences(str);
31
+ },
32
+ stringify(node, ctx) {
33
+ const value = node.value;
34
+ const stringified = value.parts
35
+ .map((part) => part instanceof BashExpression_1.BashExpression
36
+ ? indentNewlinesInBashExpression(part, ctx.indent)
37
+ : part.toString().replace(/\n/g, `\n${ctx.indent}`))
38
+ .join("");
39
+ return "|-\n" + ctx.indent + stringified;
40
+ },
41
+ identify: (v) => v instanceof VariableValueContainingReferences_1.VariableValueContainingReferences,
42
+ };
20
43
  /***
21
44
  * creates a yaml string that can be used in bash scripts
22
45
  * it handles BashExpressions correctly so that they can be evaluated in bash
@@ -25,7 +48,7 @@ const yamlBashString = (value) => {
25
48
  return (0, yaml_1.stringify)(value, {
26
49
  defaultStringType: "BLOCK_LITERAL",
27
50
  defaultKeyType: "PLAIN",
28
- customTags: [bashExpressionType],
51
+ customTags: [bashExpressionType, variableContainingReferences],
29
52
  aliasDuplicateObjects: false,
30
53
  lineWidth: 0,
31
54
  });
@@ -1 +1 @@
1
- {"version":3,"file":"bashYaml.js","sourceRoot":"","sources":["../../../../../pipeline/src/bash/bashYaml.ts"],"names":[],"mappings":";;;AACA,+BAAiC;AACjC,qDAAkD;AAElD,MAAM,kBAAkB,GAAc;IACpC,GAAG,EAAE,EAAE;IACP,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACf,oDAAoD;QACpD,OAAO,IAAI,+BAAc,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IACD,SAAS,CAAC,IAAS,EAAE,GAAQ;QAC3B,4BAA4B;QAC5B,kFAAkF;QAClF,4CAA4C;QAC5C,OAAO,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,oBAAoB,CAAC,YAAY,GAAG,CAAC,MAAM,IAAI,CAAC,CAAC;IAC9E,CAAC;IAED,QAAQ,EAAE,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,YAAY,+BA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AAc,EAAC,KAAK,CAAC;;CAEtB;KACE,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,yBAAyB,6BAOpC"}
@@ -1,8 +1,12 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.createJobCacheFromConfig = exports.createJobCacheFromCacheConfigs = void 0;
4
7
  const path_1 = require("path");
5
8
  const getAllCacheConfigsFromConfig_1 = require("./getAllCacheConfigsFromConfig");
9
+ const slugify_1 = __importDefault(require("slugify"));
6
10
  const createJobCacheFromCacheConfigs = (context, caches) => {
7
11
  if (caches.length === 0)
8
12
  return undefined;
@@ -31,7 +35,7 @@ const createJobCacheFromCacheConfigs = (context, caches) => {
31
35
  ? key
32
36
  : typeof key === "string"
33
37
  ? (scope === "buildDir" // really edge case...
34
- ? baseDir
38
+ ? (0, slugify_1.default)(baseDir)
35
39
  : context.name) +
36
40
  "-" +
37
41
  key
@@ -1 +1 @@
1
- {"version":3,"file":"createJobCache.js","sourceRoot":"","sources":["../../../../../../pipeline/src/build/cache/createJobCache.ts"],"names":[],"mappings":";;;AAAA,+BAA4B;AAK5B,iFAA8E;AAEvE,MAAM,8BAA8B,GAAG,CAC5C,OAAgB,EAChB,MAAqB,EACY,EAAE;IACnC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAE1C,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CACnC,CAAC,CAAC,EAA0B,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAC7C,CAAC;IACF,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CACrC,CAAC,CAAC,EAA4B,EAAE,CAAC,KAAK,IAAI,CAAC,CAC5C,CAAC;IACF,4JAA4J;IAC5J,MAAM,YAAY,GAChB,eAAe,CAAC,MAAM,GAAG,CAAC;QACxB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,CAC1B,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,WAAI,EAAC,OAAO,EAAE,CAAC,CAAC,CAC/C;iBACF,CAAC;QAEV,OAAO;YACL,GAAG,EAAE,cAAc;YACnB,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,WAAW;YAC7B,KAAK,EACH,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,WAAI,EAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACvE,GAAG,IAAI;SACR,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,OAAO,CAAC,GAAG,cAAc,EAAE,GAAG,YAAY,CAAC,CAAC;AAC9C,CAAC,CAAC;AA/DW,QAAA,8BAA8B,kCA+DzC;AAEF,yCAAyC;AAClC,MAAM,wBAAwB,GAAG,CACtC,OAAgB,EAChB,eAAgC,EAChC,EAAE;IACF,OAAO,IAAA,sCAA8B,EACnC,OAAO,EACP,IAAA,2DAA4B,EAAC,OAAO,EAAE,eAAe,CAAC,CACvD,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,wBAAwB,4BAQnC"}
1
+ {"version":3,"file":"createJobCache.js","sourceRoot":"","sources":["../../../../../../pipeline/src/build/cache/createJobCache.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA4B;AAK5B,iFAA8E;AAC9E,sDAA8B;AAEvB,MAAM,8BAA8B,GAAG,CAC5C,OAAgB,EAChB,MAAqB,EACY,EAAE;IACnC,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,SAAS,CAAC;IAE1C,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CACnC,CAAC,CAAC,EAA0B,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAC7C,CAAC;IACF,MA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AC,OAAO,CAAC;oBAClB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;oBACjB,GAAG;oBACH,GAAG;gBACL,CAAC,CAAC;oBACE,GAAG,GAAG;oBACN,KAAK,EAAE,MAAA,GAAG,CAAC,KAAK,0CAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAC1B,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAA,WAAI,EAAC,OAAO,EAAE,CAAC,CAAC,CAC/C;iBACF,CAAC;QAEV,OAAO;YACL,GAAG,EAAE,cAAc;YACnB,MAAM,EAAE,MAAM,aAAN,MAAM,cAAN,MAAM,GAAI,WAAW;YAC7B,KAAK,EACH,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,WAAI,EAAC,OAAO,EAAE,CAAC,CAAC,CAAC;YACvE,GAAG,IAAI;SACR,CAAC;IACJ,CAAC,CACF,CAAC;IAEF,OAAO,CAAC,GAAG,cAAc,EAAE,GAAG,YAAY,CAAC,CAAC;AAC9C,CAAC,CAAC;AA/DW,QAAA,8BAA8B,kCA+DzC;AAEF,yCAAyC;AAClC,MAAM,wBAAwB,GAAG,CACtC,OAAgB,EAChB,eAAgC,EAChC,EAAE;IACF,OAAO,IAAA,sCAA8B,EACnC,OAAO,EACP,IAAA,2DAA4B,EAAC,OAAO,EAAE,eAAe,CAAC,CACvD,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,wBAAwB,4BAQnC"}
@@ -94,7 +94,7 @@ const getDockerJobBaseProps = () => {
94
94
  services: [
95
95
  {
96
96
  name: "docker:24.0.6-dind", // see see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27300#note_466755332
97
- command: ["--tls=false"],
97
+ command: ["--tls=false", "--registry-mirror=https://mirror.gcr.io"],
98
98
  },
99
99
  ],
100
100
  variables: {},