@catladder/cli 0.0.0-refactor-cache-1b2d6c36 → 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.
Files changed (48) hide show
  1. package/dist/bundles/catenv/index.js +228 -121
  2. package/dist/bundles/cli/index.js +224 -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 +23 -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,30 @@ 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" + indentNewlinesInBashExpression(node.value, ctx.indent);
4043
4051
  },
4044
4052
  identify: (v) => v instanceof BashExpression_1.BashExpression,
4045
4053
  };
4054
+ const indentNewlinesInBashExpression = (expression, indent) => {
4055
+ return expression.transformWithCommand(`sed 's/^/${indent}/'`);
4056
+ };
4057
+ const variableContainingReferences = {
4058
+ tag: "",
4059
+ resolve: (str) => {
4060
+ // not really needed,but let's make typescript happy
4061
+ return new VariableValueContainingReferences_1.VariableValueContainingReferences(str);
4062
+ },
4063
+ stringify(node, ctx) {
4064
+ const value = node.value;
4065
+ const stringified = value.parts
4066
+ .map((part) => part instanceof BashExpression_1.BashExpression
4067
+ ? indentNewlinesInBashExpression(part, ctx.indent)
4068
+ : part.toString())
4069
+ .join("");
4070
+ return "|-\n" + ctx.indent + stringified;
4071
+ },
4072
+ identify: (v) => v instanceof VariableValueContainingReferences_1.VariableValueContainingReferences,
4073
+ };
4046
4074
  /***
4047
4075
  * creates a yaml string that can be used in bash scripts
4048
4076
  * it handles BashExpressions correctly so that they can be evaluated in bash
@@ -4051,7 +4079,7 @@ const yamlBashString = (value) => {
4051
4079
  return (0, yaml_1.stringify)(value, {
4052
4080
  defaultStringType: "BLOCK_LITERAL",
4053
4081
  defaultKeyType: "PLAIN",
4054
- customTags: [bashExpressionType],
4082
+ customTags: [bashExpressionType, variableContainingReferences],
4055
4083
  aliasDuplicateObjects: false,
4056
4084
  lineWidth: 0,
4057
4085
  });
@@ -4096,50 +4124,6 @@ exports.getInjectVarsScript = getInjectVarsScript;
4096
4124
 
4097
4125
  /***/ }),
4098
4126
 
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
4127
  /***/ 43397:
4144
4128
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
4145
4129
 
@@ -4465,14 +4449,18 @@ exports.componentContextNeedsBuildTimeDotEnv = componentContextNeedsBuildTimeDot
4465
4449
  /***/ }),
4466
4450
 
4467
4451
  /***/ 10340:
4468
- /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
4452
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
4469
4453
 
4470
4454
  "use strict";
4471
4455
 
4456
+ var __importDefault = (this && this.__importDefault) || function (mod) {
4457
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4458
+ };
4472
4459
  Object.defineProperty(exports, "__esModule", ({ value: true }));
4473
4460
  exports.createJobCacheFromConfig = exports.createJobCacheFromCacheConfigs = void 0;
4474
4461
  const path_1 = __nccwpck_require__(71017);
4475
4462
  const getAllCacheConfigsFromConfig_1 = __nccwpck_require__(30673);
4463
+ const slugify_1 = __importDefault(__nccwpck_require__(44035));
4476
4464
  const createJobCacheFromCacheConfigs = (context, caches) => {
4477
4465
  if (caches.length === 0)
4478
4466
  return undefined;
@@ -4501,7 +4489,7 @@ const createJobCacheFromCacheConfigs = (context, caches) => {
4501
4489
  ? key
4502
4490
  : typeof key === "string"
4503
4491
  ? (scope === "buildDir" // really edge case...
4504
- ? baseDir
4492
+ ? (0, slugify_1.default)(baseDir)
4505
4493
  : context.name) +
4506
4494
  "-" +
4507
4495
  key
@@ -4810,7 +4798,7 @@ const getDockerJobBaseProps = () => {
4810
4798
  services: [
4811
4799
  {
4812
4800
  name: "docker:24.0.6-dind", // see see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27300#note_466755332
4813
- command: ["--tls=false"],
4801
+ command: ["--tls=false", "--registry-mirror=https://mirror.gcr.io"],
4814
4802
  },
4815
4803
  ],
4816
4804
  variables: {},
@@ -6108,7 +6096,9 @@ const getBuildInfoVariables_1 = __nccwpck_require__(17827);
6108
6096
  const getEnvironmentContext_1 = __nccwpck_require__(13663);
6109
6097
  const resolveReferences_1 = __nccwpck_require__(43115);
6110
6098
  const transformJobOnlyVars_1 = __nccwpck_require__(1552);
6099
+ const replaceAllReferences_1 = __nccwpck_require__(4035);
6111
6100
  const envVars_1 = __nccwpck_require__(16296);
6101
+ const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
6112
6102
  const getBasePredefinedVariables = (ctx) => {
6113
6103
  return {
6114
6104
  ENV_SHORT: ctx.env,
@@ -6117,7 +6107,7 @@ const getBasePredefinedVariables = (ctx) => {
6117
6107
  ...(ctx.envType !== "local" ? (0, getBuildInfoVariables_1.getBuildInfoVariables)(ctx) : {}),
6118
6108
  };
6119
6109
  };
6120
- const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
6110
+ const getEnvironmentVariables = async (ctx, shouldResolveReferences = true) => {
6121
6111
  var _a, _b, _c, _d, _e, _f, _g, _h, _j;
6122
6112
  const environmentContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
6123
6113
  const { config, env, componentName } = ctx;
@@ -6180,18 +6170,26 @@ const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
6180
6170
  const legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
6181
6171
  const publicEnvVarsRawWithLegacyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
6182
6172
  const publicEnvVarsRawSanitized = (0, envVars_1.stringifyValues)(publicEnvVarsRawWithLegacyFromComponents);
6183
- const envVarsRaw = addIndexVar({
6173
+ const publicEnvVarsUnresolved = Object.fromEntries(Object.entries(publicEnvVarsRawSanitized).map(([key, value]) => [
6174
+ key,
6175
+ (0, VariableValueContainingReferences_1.createVariableValueContainingReferencesFromString)(value, {
6176
+ componentName: ctx.componentName,
6177
+ }),
6178
+ ]));
6179
+ const publicEnvVars = shouldResolveReferences
6180
+ ? await (0, replaceAllReferences_1.replaceAllReferences)(publicEnvVarsUnresolved, async (otherComponentName) => {
6181
+ const { envVars: otherEnvVars } = await (0, exports.getEnvironmentVariables)({
6182
+ ...ctx,
6183
+ componentName: otherComponentName,
6184
+ }, false);
6185
+ return otherEnvVars;
6186
+ })
6187
+ : publicEnvVarsUnresolved;
6188
+ const envVars = addIndexVar({
6184
6189
  ...predefinedVariables,
6185
6190
  ...secretEnvVars,
6186
- ...publicEnvVarsRawSanitized,
6191
+ ...publicEnvVars,
6187
6192
  });
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
6193
  return {
6196
6194
  envVars,
6197
6195
  secretEnvVarKeys,
@@ -6310,64 +6308,12 @@ __exportStar(__nccwpck_require__(45133), exports);
6310
6308
  /***/ }),
6311
6309
 
6312
6310
  /***/ 43115:
6313
- /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
6311
+ /***/ ((__unused_webpack_module, exports) => {
6314
6312
 
6315
6313
  "use strict";
6316
6314
 
6317
- var __importDefault = (this && this.__importDefault) || function (mod) {
6318
- return (mod && mod.__esModule) ? mod : { "default": mod };
6319
- };
6320
6315
  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;
6316
+ exports.translateLegacyFromComponents = void 0;
6371
6317
  const translateLegacyFromComponents = (fromComponents) => {
6372
6318
  return Object.fromEntries(Object.entries(fromComponents).flatMap(([componentName, variables]) => {
6373
6319
  return Object.entries(variables).map(([ourName, otherName]) => [
@@ -7103,6 +7049,8 @@ const getServiceDeployScript = (context, service, nameSuffix) => {
7103
7049
  timeout: customConfig === null || customConfig === void 0 ? void 0 : customConfig.timeout,
7104
7050
  "vpc-connector": customConfig === null || customConfig === void 0 ? void 0 : customConfig.vpcConnector,
7105
7051
  "vpc-egress": customConfig === null || customConfig === void 0 ? void 0 : customConfig.vpcEgress,
7052
+ network: customConfig === null || customConfig === void 0 ? void 0 : customConfig.network,
7053
+ subnet: customConfig === null || customConfig === void 0 ? void 0 : customConfig.subnet,
7106
7054
  "use-http2": customConfig === null || customConfig === void 0 ? void 0 : customConfig.http2,
7107
7055
  "allow-unauthenticated": (_d = customConfig === null || customConfig === void 0 ? void 0 : customConfig.allowUnauthenticated) !== null && _d !== void 0 ? _d : true,
7108
7056
  ingress: (_e = customConfig === null || customConfig === void 0 ? void 0 : customConfig.ingress) !== null && _e !== void 0 ? _e : "all",
@@ -9819,6 +9767,165 @@ exports.writeYamlfile = writeYamlfile;
9819
9767
 
9820
9768
  /***/ }),
9821
9769
 
9770
+ /***/ 84474:
9771
+ /***/ ((__unused_webpack_module, exports) => {
9772
+
9773
+ "use strict";
9774
+
9775
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9776
+ exports.createVariableValueContainingReferencesFromString = exports.VariableValueContainingReferences = exports.VariableReference = exports.UnresolvableReference = void 0;
9777
+ class UnresolvableReference {
9778
+ constructor(reference) {
9779
+ this.reference = reference;
9780
+ }
9781
+ toString() {
9782
+ return `Unresolvable reference: ${this.reference.toString()}`;
9783
+ }
9784
+ }
9785
+ exports.UnresolvableReference = UnresolvableReference;
9786
+ class VariableReference {
9787
+ constructor(componentName, variableName) {
9788
+ this.componentName = componentName;
9789
+ this.variableName = variableName;
9790
+ }
9791
+ toString() {
9792
+ return `\${${this.componentName}:${this.variableName}}`;
9793
+ }
9794
+ }
9795
+ exports.VariableReference = VariableReference;
9796
+ class VariableValueContainingReferences {
9797
+ constructor(parts) {
9798
+ this.parts = (Array.isArray(parts) ? parts : [parts]).flatMap((part) => part instanceof VariableValueContainingReferences
9799
+ ? part.parts
9800
+ : part === ""
9801
+ ? []
9802
+ : [part]);
9803
+ }
9804
+ toString(options = { escapeQuotes: false }) {
9805
+ return this.parts
9806
+ .map((part) => {
9807
+ if (typeof part === "string") {
9808
+ return options.escapeQuotes ? part.replace(/"/g, '\\"') : part;
9809
+ }
9810
+ else {
9811
+ return part.toString();
9812
+ }
9813
+ })
9814
+ .join("");
9815
+ }
9816
+ }
9817
+ exports.VariableValueContainingReferences = VariableValueContainingReferences;
9818
+ // regex to resolve references in catladder variables
9819
+ // those expressions have the pattern ${componentName:variableName}
9820
+ const REGEX = /\$\{(([^:}]+):)?([^}]+)}/gm;
9821
+ const createVariableValueContainingReferencesFromString = (value, options) => {
9822
+ const parts = [];
9823
+ let match;
9824
+ let lastIndex = 0;
9825
+ while ((match = REGEX.exec(value)) !== null) {
9826
+ const [fullMatch, _, otherComponentName, variableName] = match;
9827
+ parts.push(value.slice(lastIndex, match.index));
9828
+ parts.push(new VariableReference(otherComponentName || options.componentName, variableName));
9829
+ lastIndex = REGEX.lastIndex;
9830
+ }
9831
+ parts.push(value.slice(lastIndex));
9832
+ return new VariableValueContainingReferences(parts);
9833
+ };
9834
+ exports.createVariableValueContainingReferencesFromString = createVariableValueContainingReferencesFromString;
9835
+ //# sourceMappingURL=VariableValueContainingReferences.js.map
9836
+
9837
+ /***/ }),
9838
+
9839
+ /***/ 4035:
9840
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
9841
+
9842
+ "use strict";
9843
+
9844
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9845
+ exports.replaceAllReferences = void 0;
9846
+ const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
9847
+ const replaceAllReferencesOnce_1 = __nccwpck_require__(62726);
9848
+ const replaceAllReferences = async (values, getEnvVars) => {
9849
+ // replace until there aren't any references left
9850
+ let result = values;
9851
+ let i = 0;
9852
+ while (Object.values(result).some((value) => value.parts.some((part) => part instanceof VariableValueContainingReferences_1.VariableReference))) {
9853
+ const replaced = await (0, replaceAllReferencesOnce_1.replaceAllReferencesOnce)(result, getEnvVars);
9854
+ result = replaced;
9855
+ i++;
9856
+ if (i > 1000) {
9857
+ const unresolved = Object.entries(result).filter(([key, value]) => value.parts.some((part) => part instanceof VariableValueContainingReferences_1.VariableReference));
9858
+ throw new Error("Infinite loop detected in these variables: " +
9859
+ unresolved
9860
+ .map(([key, value]) => `${key} (last reference: ${value.parts.find((part) => part instanceof VariableValueContainingReferences_1.VariableReference)})`)
9861
+ .join(", "));
9862
+ }
9863
+ }
9864
+ return result;
9865
+ };
9866
+ exports.replaceAllReferences = replaceAllReferences;
9867
+ //# sourceMappingURL=replaceAllReferences.js.map
9868
+
9869
+ /***/ }),
9870
+
9871
+ /***/ 62726:
9872
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
9873
+
9874
+ "use strict";
9875
+
9876
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9877
+ exports.replaceAllReferencesOnce = void 0;
9878
+ const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
9879
+ const replaceReferencesOnce_1 = __nccwpck_require__(78666);
9880
+ const replaceAllReferencesOnce = async (values, getEnvVars) => {
9881
+ const allReferences = Object.values(values).flatMap((value) => value === null || value === void 0 ? void 0 : value.parts.filter((part) => part instanceof VariableValueContainingReferences_1.VariableReference));
9882
+ const allComponentsUnique = Array.from(new Set(allReferences.map((reference) => reference.componentName)));
9883
+ const allEnvVarsInComponents = Object.fromEntries(await Promise.all(allComponentsUnique.map(async (componentName) => [
9884
+ componentName,
9885
+ await getEnvVars(componentName),
9886
+ ])));
9887
+ return Object.fromEntries(Object.entries(values).map(([key, value]) => [
9888
+ key,
9889
+ value !== null && value !== undefined
9890
+ ? (0, replaceReferencesOnce_1.replaceReferencesOnce)(value, ({ componentName, variableName }) => {
9891
+ return allEnvVarsInComponents[componentName][variableName];
9892
+ })
9893
+ : value,
9894
+ ]));
9895
+ };
9896
+ exports.replaceAllReferencesOnce = replaceAllReferencesOnce;
9897
+ //# sourceMappingURL=replaceAllReferencesOnce.js.map
9898
+
9899
+ /***/ }),
9900
+
9901
+ /***/ 78666:
9902
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
9903
+
9904
+ "use strict";
9905
+
9906
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9907
+ exports.replaceReferencesOnce = void 0;
9908
+ const VariableValueContainingReferences_1 = __nccwpck_require__(84474);
9909
+ const replaceReferencesOnce = (value, replacer) => {
9910
+ const replacedParts = value.parts.map((part) => {
9911
+ if (part instanceof VariableValueContainingReferences_1.VariableReference) {
9912
+ const result = replacer({
9913
+ componentName: part.componentName,
9914
+ variableName: part.variableName,
9915
+ });
9916
+ return result !== null && result !== void 0 ? result : new VariableValueContainingReferences_1.UnresolvableReference(part);
9917
+ }
9918
+ else {
9919
+ return part;
9920
+ }
9921
+ });
9922
+ return new VariableValueContainingReferences_1.VariableValueContainingReferences(replacedParts);
9923
+ };
9924
+ exports.replaceReferencesOnce = replaceReferencesOnce;
9925
+ //# sourceMappingURL=replaceReferencesOnce.js.map
9926
+
9927
+ /***/ }),
9928
+
9822
9929
  /***/ 93090:
9823
9930
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
9824
9931
 
@@ -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,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,YAAY,cAAc,C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AAC,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,30 @@ 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" + indentNewlinesInBashExpression(node.value, ctx.indent);
17
18
  },
18
19
  identify: (v) => v instanceof BashExpression_1.BashExpression,
19
20
  };
21
+ const indentNewlinesInBashExpression = (expression, indent) => {
22
+ return expression.transformWithCommand(`sed 's/^/${indent}/'`);
23
+ };
24
+ const variableContainingReferences = {
25
+ tag: "",
26
+ resolve: (str) => {
27
+ // not really needed,but let's make typescript happy
28
+ return new VariableValueContainingReferences_1.VariableValueContainingReferences(str);
29
+ },
30
+ stringify(node, ctx) {
31
+ const value = node.value;
32
+ const stringified = value.parts
33
+ .map((part) => part instanceof BashExpression_1.BashExpression
34
+ ? indentNewlinesInBashExpression(part, ctx.indent)
35
+ : part.toString())
36
+ .join("");
37
+ return "|-\n" + ctx.indent + stringified;
38
+ },
39
+ identify: (v) => v instanceof VariableValueContainingReferences_1.VariableValueContainingReferences,
40
+ };
20
41
  /***
21
42
  * creates a yaml string that can be used in bash scripts
22
43
  * it handles BashExpressions correctly so that they can be evaluated in bash
@@ -25,7 +46,7 @@ const yamlBashString = (value) => {
25
46
  return (0, yaml_1.stringify)(value, {
26
47
  defaultStringType: "BLOCK_LITERAL",
27
48
  defaultKeyType: "PLAIN",
28
- customTags: [bashExpressionType],
49
+ customTags: [bashExpressionType, variableContainingReferences],
29
50
  aliasDuplicateObjects: false,
30
51
  lineWidth: 0,
31
52
  });
@@ -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,+BAAc;CAClD,CAAC;AAEF;;;GAGG;AACI,MAAM,cAAc,GAAG,CAAC,KAAU,EAAE,EAAE;IAC3C,OAAO,IAAA,gBAAS,EA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E;QACf,oDAAoD;QACpD,OAAO,IAAI,qEAAiC,CAAC,GAAG,CAAC,CAAC;IACpD,CAAC;IACD,SAAS,CAAC,IAAS,EAAE,GAAQ;QAC3B,MAAM,KAAK,GAAsC,IAAI,CAAC,KAAK,CAAC;QAC5D,MAAM,WAAW,GAAG,KAAK,CAAC,KAAK;aAC5B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CACZ,IAAI,YAAY,+BAAc;YAC5B,CAAC,CAAC,8BAA8B,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC;YAClD,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CACpB;aACA,IAAI,CAAC,EAAE,CAAC,CAAC;QACZ,OAAO,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,WAAW,CAAC;IAC3C,CAAC;IAED,QAAQ,EAAE,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,YAAY,qEAAiC;CACrE,CAAC;AAEF;;;GAGG;AACI,MAAM,cAAc,GAAG,CAAC,KAAU,EAAE,EAAE;IAC3C,OAAO,IAAA,gBAAS,EAAC,KAAK,EAAE;QACtB,iBAAiB,EAAE,eAAe;QAClC,cAAc,EAAE,OAAO;QACvB,UAAU,EAAE,CAAC,kBAAkB,EAAE,4BAA4B,CAAC;QAC9D,qBAAqB,EAAE,KAAK;QAC5B,SAAS,EAAE,CAAC;KACb,CAAC,CAAC;AACL,CAAC,CAAC;AARW,QAAA,cAAc,kBAQzB;AAEF;;;GAGG;AACI,MAAM,yBAAyB,GAAG,CAAC,KAAU,EAAE,QAAgB,EAAE,EAAE;IACxE,OAAO;QACL,SAAS,QAAQ;EACnB,IAAA,sBAAc,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,CAAC,CAAC;YACE;gBACE,GAAG,EAAE,OAAO,CAAC,IAAI,GAAG,UAAU;gBAC9B,MAAM,EAAE,WAAW;gBACnB,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CACnC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CA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AN,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,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,CAAC,CAAC;YACE;gBACE,GA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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"}
@@ -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: {},