@catladder/cli 0.0.0-next-84c974cd → 0.0.0-next-e2e4f00a

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 (52) hide show
  1. package/dist/bundles/catenv/index.js +132 -53
  2. package/dist/bundles/cli/index.js +132 -53
  3. package/dist/pipeline/src/build/base/createAppBuildJob.js +3 -2
  4. package/dist/pipeline/src/build/base/createAppBuildJob.js.map +1 -1
  5. package/dist/pipeline/src/build/custom/testJob.js +11 -10
  6. package/dist/pipeline/src/build/custom/testJob.js.map +1 -1
  7. package/dist/pipeline/src/build/node/cache.js +1 -0
  8. package/dist/pipeline/src/build/node/cache.js.map +1 -1
  9. package/dist/pipeline/src/build/node/testJob.js +11 -10
  10. package/dist/pipeline/src/build/node/testJob.js.map +1 -1
  11. package/dist/pipeline/src/build/rails/build.js +1 -0
  12. package/dist/pipeline/src/build/rails/build.js.map +1 -1
  13. package/dist/pipeline/src/build/rails/test.js +8 -7
  14. package/dist/pipeline/src/build/rails/test.js.map +1 -1
  15. package/dist/pipeline/src/build/types.d.ts +10 -0
  16. package/dist/pipeline/src/build/types.js.map +1 -1
  17. package/dist/pipeline/src/context/createComponentContext.js +1 -0
  18. package/dist/pipeline/src/context/createComponentContext.js.map +1 -1
  19. package/dist/pipeline/src/context/getEnvironment.js +1 -0
  20. package/dist/pipeline/src/context/getEnvironment.js.map +1 -1
  21. package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +5 -2
  22. package/dist/pipeline/src/context/getEnvironmentVariables.js +19 -9
  23. package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
  24. package/dist/pipeline/src/context/resolveReferences.d.ts +3 -0
  25. package/dist/pipeline/src/context/resolveReferences.js +10 -1
  26. package/dist/pipeline/src/context/resolveReferences.js.map +1 -1
  27. package/dist/pipeline/src/deploy/base/deploy.js +4 -3
  28. package/dist/pipeline/src/deploy/base/deploy.js.map +1 -1
  29. package/dist/pipeline/src/deploy/cloudRun/index.js +2 -2
  30. package/dist/pipeline/src/deploy/cloudRun/index.js.map +1 -1
  31. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js +15 -3
  32. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
  33. package/dist/pipeline/src/deploy/kubernetes/deployJob.js +2 -0
  34. package/dist/pipeline/src/deploy/kubernetes/deployJob.js.map +1 -1
  35. package/dist/pipeline/src/deploy/kubernetes/index.js +2 -2
  36. package/dist/pipeline/src/deploy/kubernetes/index.js.map +1 -1
  37. package/dist/pipeline/src/deploy/kubernetes/kubeValues.d.ts +2 -1
  38. package/dist/pipeline/src/deploy/kubernetes/kubeValues.js +3 -2
  39. package/dist/pipeline/src/deploy/kubernetes/kubeValues.js.map +1 -1
  40. package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.d.ts +85 -0
  41. package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.js +27 -0
  42. package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.js.map +1 -0
  43. package/dist/pipeline/src/deploy/types/base.d.ts +6 -0
  44. package/dist/pipeline/src/deploy/types/kubernetes.d.ts +34 -1
  45. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js +4 -2
  46. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js.map +1 -1
  47. package/dist/pipeline/src/types/config.d.ts +8 -0
  48. package/dist/pipeline/src/types/context.d.ts +8 -0
  49. package/dist/pipeline/src/types/context.js.map +1 -1
  50. package/dist/pipeline/src/types/jobs.d.ts +8 -0
  51. package/dist/tsconfig.tsbuildinfo +1 -1
  52. package/package.json +1 -1
@@ -1063,7 +1063,7 @@ const constants_1 = __nccwpck_require__(2786);
1063
1063
  const writeBuildInfo_1 = __nccwpck_require__(9578);
1064
1064
  const writeDotEnv_1 = __nccwpck_require__(8052);
1065
1065
  const createAppBuildJob = (context, { script, variables, runnerVariables, cache, ...def }) => {
1066
- var _a;
1066
+ var _a, _b;
1067
1067
  return (0, lodash_1.merge)({
1068
1068
  name: constants_1.APP_BUILD_JOB_NAME,
1069
1069
  envMode: "jobPerEnv",
@@ -1077,13 +1077,14 @@ const createAppBuildJob = (context, { script, variables, runnerVariables, cache,
1077
1077
  ? {
1078
1078
  ...context.environment.envVars,
1079
1079
  ...context.environment.jobOnlyVars.build.envVars,
1080
+ ...((_a = context.build.config.extraVars) !== null && _a !== void 0 ? _a : {}),
1080
1081
  }
1081
1082
  : {}),
1082
1083
  },
1083
1084
  runnerVariables: {
1084
1085
  ...constants_1.RUNNER_BUILD_RESOURCE_VARIABLES,
1085
1086
  ...(runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {}),
1086
- ...((_a = context.build.config.runnerVariables) !== null && _a !== void 0 ? _a : {}),
1087
+ ...((_b = context.build.config.runnerVariables) !== null && _b !== void 0 ? _b : {}),
1087
1088
  },
1088
1089
  script: [
1089
1090
  ...(context.type === "component"
@@ -1483,7 +1484,7 @@ const RUNNER_CUSTOM_TEST_VARIABLES = {
1483
1484
  KUBERNETES_MEMORY_LIMIT: "4Gi",
1484
1485
  };
1485
1486
  const createCustomTestJobs = (context) => {
1486
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
1487
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
1487
1488
  // don't run tests after release
1488
1489
  // TODO: this will be replaced by using rules
1489
1490
  if (context.trigger === "taggedRelease") {
@@ -1497,6 +1498,7 @@ const createCustomTestJobs = (context) => {
1497
1498
  variables: {
1498
1499
  APP_PATH: context.build.dir,
1499
1500
  ...context.environment.jobOnlyVars.build.envVars,
1501
+ ...((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {}),
1500
1502
  },
1501
1503
  runnerVariables: RUNNER_CUSTOM_TEST_VARIABLES,
1502
1504
  services: buildConfig.jobServices,
@@ -1509,29 +1511,29 @@ const createCustomTestJobs = (context) => {
1509
1511
  ? {
1510
1512
  name: "🛡 audit",
1511
1513
  ...base,
1512
- image: (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : buildConfig.jobImage,
1514
+ image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage,
1513
1515
  cache: undefined,
1514
- script: [...(0, utils_1.ensureArray)((_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.command)],
1516
+ script: [...(0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)],
1515
1517
  allow_failure: true,
1516
- ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.artifactsReports, (_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.artifacts),
1518
+ ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.artifactsReports, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifacts),
1517
1519
  }
1518
1520
  : null;
1519
1521
  const lintJob = buildConfig.lint
1520
1522
  ? {
1521
1523
  name: "👮 lint",
1522
1524
  ...base,
1523
- image: (_g = (_f = buildConfig.lint) === null || _f === void 0 ? void 0 : _f.jobImage) !== null && _g !== void 0 ? _g : buildConfig.jobImage,
1524
- script: [...(0, utils_1.ensureArray)((_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.command)],
1525
- ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.artifactsReports, (_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.artifacts),
1525
+ image: (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : buildConfig.jobImage,
1526
+ script: [...(0, utils_1.ensureArray)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)],
1527
+ ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.artifactsReports, (_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.artifacts),
1526
1528
  }
1527
1529
  : null;
1528
1530
  const testJob = buildConfig.test
1529
1531
  ? {
1530
1532
  name: "🧪 test",
1531
1533
  ...base,
1532
- image: (_m = (_l = buildConfig.test) === null || _l === void 0 ? void 0 : _l.jobImage) !== null && _m !== void 0 ? _m : buildConfig.jobImage,
1533
- script: [...(0, utils_1.ensureArray)((_o = buildConfig.test) === null || _o === void 0 ? void 0 : _o.command)],
1534
- ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.artifactsReports, (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.artifacts),
1534
+ image: (_o = (_m = buildConfig.test) === null || _m === void 0 ? void 0 : _m.jobImage) !== null && _o !== void 0 ? _o : buildConfig.jobImage,
1535
+ script: [...(0, utils_1.ensureArray)((_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.command)],
1536
+ ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.artifactsReports, (_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.artifacts),
1535
1537
  }
1536
1538
  : null;
1537
1539
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
@@ -1878,6 +1880,7 @@ const getYarnCache = (context, policy = "pull-push") => {
1878
1880
  return [
1879
1881
  {
1880
1882
  scope: componentIsInWorkspace ? "global" : "buildDir",
1883
+ pathMode: componentIsInWorkspace ? "absolute" : "relative",
1881
1884
  key: "yarn",
1882
1885
  policy,
1883
1886
  paths: [".yarn"],
@@ -2069,7 +2072,7 @@ const constants_1 = __nccwpck_require__(1765);
2069
2072
  const yarn_1 = __nccwpck_require__(5043);
2070
2073
  const createJobCache_1 = __nccwpck_require__(4372);
2071
2074
  const createNodeTestJobs = (context) => {
2072
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
2075
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
2073
2076
  // don't run tests after release
2074
2077
  // TODO: this will be replaced by using rules
2075
2078
  if (context.trigger === "taggedRelease") {
@@ -2087,6 +2090,7 @@ const createNodeTestJobs = (context) => {
2087
2090
  ...(context.type === "component"
2088
2091
  ? {
2089
2092
  ...context.environment.jobOnlyVars.build.envVars,
2093
+ ...((_a = context.build.config.extraVars) !== null && _a !== void 0 ? _a : {}),
2090
2094
  }
2091
2095
  : {}),
2092
2096
  },
@@ -2101,48 +2105,48 @@ const createNodeTestJobs = (context) => {
2101
2105
  ? {
2102
2106
  name: "🛡 audit",
2103
2107
  ...base,
2104
- image: (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : defaultImage,
2108
+ image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage,
2105
2109
  cache: undefined, // audit does not need yarn install and no cache
2106
2110
  script: [
2107
2111
  `cd ${context.build.dir}`,
2108
- ...((_d = (0, utils_1.ensureArrayOrNull)((_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : [
2112
+ ...((_e = (0, utils_1.ensureArrayOrNull)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [
2109
2113
  context.packageManagerInfo.isClassic
2110
2114
  ? "yarn audit"
2111
2115
  : "yarn npm audit --environment production", // yarn 2
2112
2116
  ]),
2113
2117
  ],
2114
2118
  allow_failure: true,
2115
- ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.artifactsReports, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifacts),
2119
+ ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifactsReports, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifacts),
2116
2120
  }
2117
2121
  : null;
2118
2122
  const lintJob = buildConfig.lint !== false
2119
2123
  ? {
2120
2124
  name: "👮 lint",
2121
2125
  ...base,
2122
- image: (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : defaultImage,
2126
+ image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : defaultImage,
2123
2127
  cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
2124
2128
  script: [
2125
2129
  ...(0, yarn_1.ensureNodeVersion)(context),
2126
2130
  `cd ${context.build.dir}`,
2127
2131
  ...yarnInstall,
2128
- ...((_k = (0, utils_1.ensureArrayOrNull)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)) !== null && _k !== void 0 ? _k : ["yarn lint"]),
2132
+ ...((_l = (0, utils_1.ensureArrayOrNull)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : ["yarn lint"]),
2129
2133
  ],
2130
- ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.artifactsReports, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifacts),
2134
+ ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifactsReports, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifacts),
2131
2135
  }
2132
2136
  : null;
2133
2137
  const testJob = buildConfig.test !== false
2134
2138
  ? {
2135
2139
  name: "🧪 test",
2136
2140
  ...base,
2137
- image: (_p = (_o = buildConfig.test) === null || _o === void 0 ? void 0 : _o.jobImage) !== null && _p !== void 0 ? _p : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
2141
+ image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
2138
2142
  cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
2139
2143
  script: [
2140
2144
  ...(0, yarn_1.ensureNodeVersion)(context),
2141
2145
  `cd ${context.build.dir}`,
2142
2146
  ...yarnInstall,
2143
- ...((_r = (0, utils_1.ensureArrayOrNull)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : ["yarn test"]),
2147
+ ...((_s = (0, utils_1.ensureArrayOrNull)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : ["yarn test"]),
2144
2148
  ],
2145
- ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.artifactsReports, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifacts),
2149
+ ...(0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifacts),
2146
2150
  }
2147
2151
  : null;
2148
2152
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
@@ -2258,6 +2262,7 @@ const createRailsBuildJobs = (context) => {
2258
2262
  dockerBuild: {
2259
2263
  variables: {
2260
2264
  ...context.environment.jobOnlyVars.build.envVars,
2265
+ ...context.build.config.extraVars,
2261
2266
  },
2262
2267
  // custom script
2263
2268
  script: [
@@ -2305,7 +2310,7 @@ exports.createRailsTestJobs = void 0;
2305
2310
  const __1 = __nccwpck_require__(603);
2306
2311
  const utils_1 = __nccwpck_require__(2497);
2307
2312
  const createRailsTestJobs = (context) => {
2308
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
2313
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
2309
2314
  // don't run tests after release
2310
2315
  // TODO: this will be replaced by using rules
2311
2316
  if (context.trigger === "taggedRelease") {
@@ -2319,6 +2324,7 @@ const createRailsTestJobs = (context) => {
2319
2324
  const base = {
2320
2325
  variables: {
2321
2326
  ...context.environment.jobOnlyVars.build.envVars,
2327
+ ...((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {}),
2322
2328
  },
2323
2329
  stage: "test",
2324
2330
  needs: [],
@@ -2342,10 +2348,10 @@ const createRailsTestJobs = (context) => {
2342
2348
  name: "🛡 audit",
2343
2349
  ...base,
2344
2350
  cache: undefined, // audit does not need bundle install and no cache
2345
- image: (_c = (_b = (_a = buildConfig.audit) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : buildConfig.jobImage) !== null && _c !== void 0 ? _c : defaultImage,
2351
+ image: (_d = (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage) !== null && _d !== void 0 ? _d : defaultImage,
2346
2352
  script: [
2347
2353
  `cd ${context.build.dir}`,
2348
- ...((_e = (0, utils_1.ensureArrayOrNull)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [
2354
+ ...((_f = (0, utils_1.ensureArrayOrNull)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
2349
2355
  "gem install bundler-audit",
2350
2356
  "bundle audit check",
2351
2357
  ]),
@@ -2358,11 +2364,11 @@ const createRailsTestJobs = (context) => {
2358
2364
  name: "👮 lint",
2359
2365
  ...base,
2360
2366
  cache: bundlerCache,
2361
- image: (_h = (_g = (_f = buildConfig.lint) === null || _f === void 0 ? void 0 : _f.jobImage) !== null && _g !== void 0 ? _g : buildConfig.jobImage) !== null && _h !== void 0 ? _h : defaultImage,
2367
+ image: (_j = (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : buildConfig.jobImage) !== null && _j !== void 0 ? _j : defaultImage,
2362
2368
  script: [
2363
2369
  `cd ${context.build.dir}`,
2364
2370
  ...bundlerInstall,
2365
- ...((_k = (0, utils_1.ensureArrayOrNull)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)) !== null && _k !== void 0 ? _k : [
2371
+ ...((_l = (0, utils_1.ensureArrayOrNull)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : [
2366
2372
  "bundle exec rubocop",
2367
2373
  ]),
2368
2374
  ],
@@ -2373,11 +2379,11 @@ const createRailsTestJobs = (context) => {
2373
2379
  name: "🧪 test",
2374
2380
  ...base,
2375
2381
  cache: bundlerCache,
2376
- image: (_o = (_m = (_l = buildConfig.test) === null || _l === void 0 ? void 0 : _l.jobImage) !== null && _m !== void 0 ? _m : buildConfig.jobImage) !== null && _o !== void 0 ? _o : defaultImage,
2382
+ image: (_p = (_o = (_m = buildConfig.test) === null || _m === void 0 ? void 0 : _m.jobImage) !== null && _o !== void 0 ? _o : buildConfig.jobImage) !== null && _p !== void 0 ? _p : defaultImage,
2377
2383
  script: [
2378
2384
  `cd ${context.build.dir}`,
2379
2385
  ...bundlerInstall,
2380
- ...((_q = (0, utils_1.ensureArrayOrNull)((_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.command)) !== null && _q !== void 0 ? _q : [
2386
+ ...((_r = (0, utils_1.ensureArrayOrNull)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : [
2381
2387
  "bundle exec rspec",
2382
2388
  ]),
2383
2389
  ],
@@ -2694,6 +2700,7 @@ const createComponentContext = async (ctx) => {
2694
2700
  const context = {
2695
2701
  type: "component",
2696
2702
  name: ctx.componentName,
2703
+ componentName: ctx.componentName,
2697
2704
  env: ctx.env,
2698
2705
  fullConfig: ctx.config,
2699
2706
  componentConfig,
@@ -2866,6 +2873,7 @@ const getEnvironment = async (ctx) => {
2866
2873
  slugPrefix: envContext.environmentSlugPrefix,
2867
2874
  reviewSlug: envContext.reviewSlug,
2868
2875
  slug: envContext.environmentSlug,
2876
+ shortName: env,
2869
2877
  ...variables,
2870
2878
  };
2871
2879
  };
@@ -2925,6 +2933,7 @@ exports.getEnvironmentContext = getEnvironmentContext;
2925
2933
 
2926
2934
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2927
2935
  exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvironmentVariables = void 0;
2936
+ const lodash_1 = __nccwpck_require__(3255);
2928
2937
  const deploy_1 = __nccwpck_require__(8483);
2929
2938
  const BashExpression_1 = __nccwpck_require__(2376);
2930
2939
  const types_1 = __nccwpck_require__(4466);
@@ -2942,7 +2951,7 @@ const getBasePredefinedVariables = (ctx) => {
2942
2951
  };
2943
2952
  };
2944
2953
  const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
2945
- var _a, _b, _c, _d, _e, _f, _g;
2954
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2946
2955
  const environmentContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
2947
2956
  const { config, env, componentName } = ctx;
2948
2957
  const { envConfigRaw, deployConfigRaw, buildConfigRaw, envType } = environmentContext;
@@ -2959,8 +2968,12 @@ const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
2959
2968
  ...basePredefinedVariables,
2960
2969
  ENV_SHORT: "local",
2961
2970
  ROOT_URL: url,
2962
- HOSTNAME: host,
2963
- HOSTNAME_INTERNAL: host,
2971
+ // Rails before 6.1 (mis)uses the `HOST` environment variable to specify the IP to bind to
2972
+ ...((0, types_1.isStandaloneBuildConfig)(buildConfigRaw) &&
2973
+ buildConfigRaw.type === "rails"
2974
+ ? {}
2975
+ : { HOST: host }),
2976
+ HOST_INTERNAL: host,
2964
2977
  ROOT_URL_INTERNAL: "http://" + host,
2965
2978
  PORT: port.toString(),
2966
2979
  };
@@ -2969,8 +2982,8 @@ const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
2969
2982
  const additionalEnvVars = deployConfigRaw
2970
2983
  ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext)
2971
2984
  : {};
2972
- const HOSTNAME_INTERNAL = (_b = additionalEnvVars.HOSTNAME_INTERNAL) !== null && _b !== void 0 ? _b : "unknown-host.example.com";
2973
- host = (_c = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _c !== void 0 ? _c : HOSTNAME_INTERNAL;
2985
+ const HOST_INTERNAL = (_b = additionalEnvVars.HOST_INTERNAL) !== null && _b !== void 0 ? _b : "unknown-host.example.com";
2986
+ host = (_c = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _c !== void 0 ? _c : HOST_INTERNAL;
2974
2987
  url = (0, BashExpression_1.joinBashExpressions)(["https://", host]);
2975
2988
  predefinedVariables = {
2976
2989
  ...basePredefinedVariables,
@@ -2978,10 +2991,12 @@ const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
2978
2991
  ...((0, types_1.isStandaloneBuildConfig)(buildConfigRaw) &&
2979
2992
  buildConfigRaw.type === "rails"
2980
2993
  ? {}
2981
- : { HOSTNAME: host }),
2994
+ : { HOST: host }),
2982
2995
  ROOT_URL: url,
2983
- HOSTNAME_INTERNAL,
2984
- ROOT_URL_INTERNAL: (0, BashExpression_1.joinBashExpressions)(["https://", HOSTNAME_INTERNAL]),
2996
+ HOST_INTERNAL,
2997
+ /**@deprecated */
2998
+ HOST_CANONICAL: HOST_INTERNAL, // legacy alias for HOST_INTERNAL
2999
+ ROOT_URL_INTERNAL: (0, BashExpression_1.joinBashExpressions)(["https://", HOST_INTERNAL]),
2985
3000
  ...additionalEnvVars,
2986
3001
  };
2987
3002
  }
@@ -2994,7 +3009,10 @@ const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
2994
3009
  ...additionalSecretKeys,
2995
3010
  ];
2996
3011
  const secretEnvVars = (0, envVars_1.makeSecretEnvVarMapping)(env, componentName, secretEnvVarKeys);
2997
- const publicEnvVarsRawSanitized = (0, envVars_1.stringifyValues)(publicEnvVarsRaw);
3012
+ // this is deprecated, we now support: $componentname:FOO
3013
+ const legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
3014
+ const publicEnvVarsRawWithLegacyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
3015
+ const publicEnvVarsRawSanitized = (0, envVars_1.stringifyValues)(publicEnvVarsRawWithLegacyFromComponents);
2998
3016
  const envVarsRaw = addIndexVar({
2999
3017
  ...predefinedVariables,
3000
3018
  ...secretEnvVars,
@@ -3133,7 +3151,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3133
3151
  return (mod && mod.__esModule) ? mod : { "default": mod };
3134
3152
  };
3135
3153
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3136
- exports.resolveReferences = void 0;
3154
+ exports.translateLegacyFromComponents = exports.resolveReferences = void 0;
3137
3155
  const lodash_1 = __nccwpck_require__(3255);
3138
3156
  const replaceAsync_1 = __importDefault(__nccwpck_require__(2233));
3139
3157
  // regex to resolve references in catladder variables
@@ -3183,6 +3201,15 @@ const resolveReferences = async (vars, getOtherVariables, alreadyVisitedBase = {
3183
3201
  })));
3184
3202
  };
3185
3203
  exports.resolveReferences = resolveReferences;
3204
+ const translateLegacyFromComponents = (fromComponents) => {
3205
+ return Object.fromEntries(Object.entries(fromComponents).flatMap(([componentName, variables]) => {
3206
+ return Object.entries(variables).map(([ourName, otherName]) => [
3207
+ ourName,
3208
+ "${" + componentName + ":" + otherName + "}",
3209
+ ]);
3210
+ }));
3211
+ };
3212
+ exports.translateLegacyFromComponents = translateLegacyFromComponents;
3186
3213
  //# sourceMappingURL=resolveReferences.js.map
3187
3214
 
3188
3215
  /***/ }),
@@ -3288,7 +3315,7 @@ const stop_1 = __nccwpck_require__(2846);
3288
3315
  const variables_1 = __nccwpck_require__(2422);
3289
3316
  exports.DEPLOY_JOB_NAME = "🚀 Deploy";
3290
3317
  const createDeployJob = (context, jobDefinition) => {
3291
- var _a, _b, _c, _d, _e, _f;
3318
+ var _a, _b, _c, _d, _e, _f, _g;
3292
3319
  const hasDocker = (0, docker_1.requiresDockerBuild)(context);
3293
3320
  const isStoppable = (0, utils_1.contextIsStoppable)(context);
3294
3321
  const autoStop = context.environment.envType === "review"
@@ -3367,12 +3394,13 @@ const createDeployJob = (context, jobDefinition) => {
3367
3394
  ...context.environment.envVars,
3368
3395
  ...(hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {}),
3369
3396
  ...context.environment.jobOnlyVars.deploy.envVars,
3397
+ ...(deployConfig ? (_e = deployConfig.extraVars) !== null && _e !== void 0 ? _e : {} : {}),
3370
3398
  ...jobDefinition.variables,
3371
3399
  },
3372
3400
  runnerVariables: {
3373
3401
  ...variables_1.DEPLOY_RUNNER_VARIABLES,
3374
- ...((_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {}),
3375
- ...(deployConfig ? (_f = deployConfig.runnerVariables) !== null && _f !== void 0 ? _f : {} : {}),
3402
+ ...((_f = jobDefinition.runnerVariables) !== null && _f !== void 0 ? _f : {}),
3403
+ ...(deployConfig ? (_g = deployConfig.runnerVariables) !== null && _g !== void 0 ? _g : {} : {}),
3376
3404
  },
3377
3405
  environment: isStoppable
3378
3406
  ? {
@@ -4221,7 +4249,7 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
4221
4249
  ],
4222
4250
  getAdditionalEnvVars: (ctx) => {
4223
4251
  const { fullName, env, componentName, deployConfigRaw } = ctx;
4224
- const HOSTNAME_INTERNAL = (0, BashExpression_1.joinBashExpressions)([
4252
+ const HOST_INTERNAL = (0, BashExpression_1.joinBashExpressions)([
4225
4253
  fullName,
4226
4254
  (0, BashExpression_1.getBashVariable)((0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)),
4227
4255
  ], "-").toLowerCase();
@@ -4232,7 +4260,7 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
4232
4260
  ]))
4233
4261
  : {};
4234
4262
  return {
4235
- HOSTNAME_INTERNAL,
4263
+ HOST_INTERNAL,
4236
4264
  ...getCloudSqlVariables(ctx),
4237
4265
  ...jobTriggers,
4238
4266
  DEPLOY_CLOUD_RUN_PROJECT_ID: deployConfigRaw
@@ -4644,7 +4672,7 @@ const hasKubernetesCloudSQL = (context) => {
4644
4672
  };
4645
4673
  exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
4646
4674
  const createKubernetesCloudsqlBaseValues = (context) => {
4647
- var _a, _b, _c;
4675
+ var _a, _b, _c, _d, _e, _f, _g;
4648
4676
  const deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
4649
4677
  if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
4650
4678
  throw new Error("cannot get cloud sql config");
@@ -4654,11 +4682,23 @@ const createKubernetesCloudsqlBaseValues = (context) => {
4654
4682
  throw new Error("cannot get cloud sql config");
4655
4683
  }
4656
4684
  const proxyCredentials = `$${(0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials")}`;
4657
- if (config.type === "unmanaged") {
4685
+ if ((config === null || config === void 0 ? void 0 : config.type) !== "unmanaged") {
4686
+ const instanceConnectionName = `${(_c = config.projectId) !== null && _c !== void 0 ? _c : "skynet-164509"}:${(_d = config.region) !== null && _d !== void 0 ? _d : "europe-west6"}:${(_e = config.instanceId) !== null && _e !== void 0 ? _e : context.environment.envVars.KUBE_NAMESPACE}`;
4658
4687
  return {
4659
4688
  cloudsql: {
4660
4689
  enabled: config.enabled,
4661
- dbUser: (_c = config.dbUser) !== null && _c !== void 0 ? _c : "postgres",
4690
+ dbUser: "postgres",
4691
+ instanceConnectionName,
4692
+ proxyCredentials,
4693
+ fullDbName: (_f = context.environment.envVars.KUBE_APP_NAME) !== null && _f !== void 0 ? _f : "",
4694
+ },
4695
+ };
4696
+ }
4697
+ else if (config.type === "unmanaged") {
4698
+ return {
4699
+ cloudsql: {
4700
+ enabled: config.enabled,
4701
+ dbUser: (_g = config.dbUser) !== null && _g !== void 0 ? _g : "postgres",
4662
4702
  instanceConnectionName: config.instanceConnectionName,
4663
4703
  proxyCredentials,
4664
4704
  fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.name),
@@ -4720,6 +4760,8 @@ const createKubernetesDeployJobs = (context) => {
4720
4760
  ...((_c = deployConfig.additionalHelmArgs) !== null && _c !== void 0 ? _c : []),
4721
4761
  ].join(" "),
4722
4762
  COMPONENT_NAME: context.name,
4763
+ /** @deprecated */
4764
+ BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID,
4723
4765
  },
4724
4766
  };
4725
4767
  const clusterName = `kube-${context.environment.fullName}`;
@@ -4803,7 +4845,7 @@ exports.KUBERNETES_DEPLOY_TYPE = {
4803
4845
  const domainCanonical = (deployConfigRaw && ((_a = deployConfigRaw.cluster) === null || _a === void 0 ? void 0 : _a.domainCanonical)) || // for convenience, we allow clusters to define a canonical domain, because a cluster has a fixed ip and you will usually have a domain pointing to that cluster
4804
4846
  fullConfig.domainCanonical ||
4805
4847
  "panter.cloud";
4806
- const HOSTNAME_INTERNAL = (0, BashExpression_1.joinBashExpressions)([
4848
+ const HOST_INTERNAL = (0, BashExpression_1.joinBashExpressions)([
4807
4849
  componentSlug,
4808
4850
  ...(envType === "review" && reviewSlug ? [reviewSlug] : []),
4809
4851
  env,
@@ -4815,7 +4857,7 @@ exports.KUBERNETES_DEPLOY_TYPE = {
4815
4857
  KUBE_NAMESPACE,
4816
4858
  KUBE_APP_NAME,
4817
4859
  KUBE_APP_NAME_PREFIX,
4818
- HOSTNAME_INTERNAL,
4860
+ HOST_INTERNAL,
4819
4861
  };
4820
4862
  },
4821
4863
  };
@@ -4888,6 +4930,7 @@ const types_1 = __nccwpck_require__(5781);
4888
4930
  const cloudSql_1 = __nccwpck_require__(5129);
4889
4931
  const kubeEnv_1 = __nccwpck_require__(6769);
4890
4932
  const mongodb_1 = __nccwpck_require__(4139);
4933
+ const processSecretsAsFiles_1 = __nccwpck_require__(6089);
4891
4934
  const createAppConfig = (context, application) => {
4892
4935
  if (application === false) {
4893
4936
  return {
@@ -4944,11 +4987,11 @@ const createKubeValues = (context) => {
4944
4987
  : {}, ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled)
4945
4988
  ? (0, mongodb_1.createMongodbBaseConfig)(context)
4946
4989
  : {});
4947
- const kubeValues = (0, utils_1.mergeWithMergingArrays)(defaultKubeValues, {
4990
+ const kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, {
4948
4991
  jobs: removeFalsy(jobs),
4949
4992
  cronjobs: removeFalsy(cronjobs),
4950
4993
  ...rest,
4951
- });
4994
+ }));
4952
4995
  return kubeValues;
4953
4996
  };
4954
4997
  exports.createKubeValues = createKubeValues;
@@ -5067,6 +5110,40 @@ exports.createMongodbBaseConfig = createMongodbBaseConfig;
5067
5110
 
5068
5111
  /***/ }),
5069
5112
 
5113
+ /***/ 6089:
5114
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
5115
+
5116
+ "use strict";
5117
+
5118
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
5119
+ exports.processSecretsAsFiles = void 0;
5120
+ const lodash_1 = __nccwpck_require__(3255);
5121
+ const processSecretsAsFiles = (values) => {
5122
+ if (!values.secretsAsFile || values.secretsAsFile.length === 0) {
5123
+ return values;
5124
+ }
5125
+ // the initial idea was that we "shadow" secrets that we mount as files,
5126
+ // but there is a weird kubernetes issue with that (https://github.com/kubernetes/kubernetes/issues/46861),
5127
+ // so instead we rename the secrets and append _content, so that inside kuberentes, we can use the original name to contain the path and name+_content as the actual content
5128
+ return {
5129
+ ...values,
5130
+ env: {
5131
+ ...values.env,
5132
+ secret: {
5133
+ ...(0, lodash_1.omit)(values.env.secret, values.secretsAsFile),
5134
+ ...Object.fromEntries(values.secretsAsFile.map((key) => [
5135
+ key + "_content",
5136
+ values.env.secret[key],
5137
+ ])),
5138
+ },
5139
+ },
5140
+ };
5141
+ };
5142
+ exports.processSecretsAsFiles = processSecretsAsFiles;
5143
+ //# sourceMappingURL=processSecretsAsFiles.js.map
5144
+
5145
+ /***/ }),
5146
+
5070
5147
  /***/ 4986:
5071
5148
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
5072
5149
 
@@ -5643,7 +5720,7 @@ const getFullReferencedJobNameFromWorkspace = (referencedJobName, workspaceName,
5643
5720
  const getJobName = (need) => (0, lodash_1.isObject)(need) ? need.job : need;
5644
5721
  const makeGitlabJob = (context, job, allJobs, baseRules) => {
5645
5722
  var _a, _b;
5646
- const { environment, envMode, needsStages, name, needs, jobTags, script, variables, runnerVariables, when, ...rest } = job;
5723
+ const { environment, envMode, needsStages, needsOtherComponent, name, needs, jobTags, script, variables, runnerVariables, when, ...rest } = job;
5647
5724
  const stage = envMode === "stagePerEnv" ? `${job.stage} ${context.env}` : job.stage;
5648
5725
  const deduplicatedGitlabNeeds = getGitlabNeeds(context, job, allJobs);
5649
5726
  const fullJobName = getFullJobName({
@@ -5767,7 +5844,7 @@ function deduplicateNeeds(needs) {
5767
5844
  ? [...new Map(needs.map((n) => [(0, lodash_1.isObject)(n) ? n.job : n, n])).values()]
5768
5845
  : undefined;
5769
5846
  }
5770
- function getGitlabNeedsForComponentJob(context, { needsStages, needs }, allJobs) {
5847
+ function getGitlabNeedsForComponentJob(context, { needsStages, needs, needsOtherComponent }, allJobs) {
5771
5848
  const needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap((n) => {
5772
5849
  var _a, _b, _c, _d, _e, _f, _g, _h;
5773
5850
  const componentName = context.name;
@@ -5801,6 +5878,8 @@ function getGitlabNeedsForComponentJob(context, { needsStages, needs }, allJobs)
5801
5878
  const cleanedNeeds = [
5802
5879
  ...(needsFromStages !== null && needsFromStages !== void 0 ? needsFromStages : []),
5803
5880
  ...(needs !== null && needs !== void 0 ? needs : []),
5881
+ // pull in legacy needs from other component, which is now identical to needs
5882
+ ...(needsOtherComponent !== null && needsOtherComponent !== void 0 ? needsOtherComponent : []),
5804
5883
  ];
5805
5884
  return cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map((n) => {
5806
5885
  var _a;