@catladder/cli 0.0.0-next-9a3feef4 → 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 (50) hide show
  1. package/dist/bundles/catenv/index.js +131 -53
  2. package/dist/bundles/cli/index.js +131 -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/testJob.js +11 -10
  8. package/dist/pipeline/src/build/node/testJob.js.map +1 -1
  9. package/dist/pipeline/src/build/rails/build.js +1 -0
  10. package/dist/pipeline/src/build/rails/build.js.map +1 -1
  11. package/dist/pipeline/src/build/rails/test.js +8 -7
  12. package/dist/pipeline/src/build/rails/test.js.map +1 -1
  13. package/dist/pipeline/src/build/types.d.ts +10 -0
  14. package/dist/pipeline/src/build/types.js.map +1 -1
  15. package/dist/pipeline/src/context/createComponentContext.js +1 -0
  16. package/dist/pipeline/src/context/createComponentContext.js.map +1 -1
  17. package/dist/pipeline/src/context/getEnvironment.js +1 -0
  18. package/dist/pipeline/src/context/getEnvironment.js.map +1 -1
  19. package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +5 -2
  20. package/dist/pipeline/src/context/getEnvironmentVariables.js +19 -9
  21. package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
  22. package/dist/pipeline/src/context/resolveReferences.d.ts +3 -0
  23. package/dist/pipeline/src/context/resolveReferences.js +10 -1
  24. package/dist/pipeline/src/context/resolveReferences.js.map +1 -1
  25. package/dist/pipeline/src/deploy/base/deploy.js +4 -3
  26. package/dist/pipeline/src/deploy/base/deploy.js.map +1 -1
  27. package/dist/pipeline/src/deploy/cloudRun/index.js +2 -2
  28. package/dist/pipeline/src/deploy/cloudRun/index.js.map +1 -1
  29. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js +15 -3
  30. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
  31. package/dist/pipeline/src/deploy/kubernetes/deployJob.js +2 -0
  32. package/dist/pipeline/src/deploy/kubernetes/deployJob.js.map +1 -1
  33. package/dist/pipeline/src/deploy/kubernetes/index.js +2 -2
  34. package/dist/pipeline/src/deploy/kubernetes/index.js.map +1 -1
  35. package/dist/pipeline/src/deploy/kubernetes/kubeValues.d.ts +2 -1
  36. package/dist/pipeline/src/deploy/kubernetes/kubeValues.js +3 -2
  37. package/dist/pipeline/src/deploy/kubernetes/kubeValues.js.map +1 -1
  38. package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.d.ts +85 -0
  39. package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.js +27 -0
  40. package/dist/pipeline/src/deploy/kubernetes/processSecretsAsFiles.js.map +1 -0
  41. package/dist/pipeline/src/deploy/types/base.d.ts +6 -0
  42. package/dist/pipeline/src/deploy/types/kubernetes.d.ts +34 -1
  43. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js +4 -2
  44. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js.map +1 -1
  45. package/dist/pipeline/src/types/config.d.ts +8 -0
  46. package/dist/pipeline/src/types/context.d.ts +8 -0
  47. package/dist/pipeline/src/types/context.js.map +1 -1
  48. package/dist/pipeline/src/types/jobs.d.ts +8 -0
  49. package/dist/tsconfig.tsbuildinfo +1 -1
  50. 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);
@@ -2070,7 +2072,7 @@ const constants_1 = __nccwpck_require__(1765);
2070
2072
  const yarn_1 = __nccwpck_require__(5043);
2071
2073
  const createJobCache_1 = __nccwpck_require__(4372);
2072
2074
  const createNodeTestJobs = (context) => {
2073
- 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;
2074
2076
  // don't run tests after release
2075
2077
  // TODO: this will be replaced by using rules
2076
2078
  if (context.trigger === "taggedRelease") {
@@ -2088,6 +2090,7 @@ const createNodeTestJobs = (context) => {
2088
2090
  ...(context.type === "component"
2089
2091
  ? {
2090
2092
  ...context.environment.jobOnlyVars.build.envVars,
2093
+ ...((_a = context.build.config.extraVars) !== null && _a !== void 0 ? _a : {}),
2091
2094
  }
2092
2095
  : {}),
2093
2096
  },
@@ -2102,48 +2105,48 @@ const createNodeTestJobs = (context) => {
2102
2105
  ? {
2103
2106
  name: "🛡 audit",
2104
2107
  ...base,
2105
- 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,
2106
2109
  cache: undefined, // audit does not need yarn install and no cache
2107
2110
  script: [
2108
2111
  `cd ${context.build.dir}`,
2109
- ...((_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 : [
2110
2113
  context.packageManagerInfo.isClassic
2111
2114
  ? "yarn audit"
2112
2115
  : "yarn npm audit --environment production", // yarn 2
2113
2116
  ]),
2114
2117
  ],
2115
2118
  allow_failure: true,
2116
- ...(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),
2117
2120
  }
2118
2121
  : null;
2119
2122
  const lintJob = buildConfig.lint !== false
2120
2123
  ? {
2121
2124
  name: "👮 lint",
2122
2125
  ...base,
2123
- 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,
2124
2127
  cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
2125
2128
  script: [
2126
2129
  ...(0, yarn_1.ensureNodeVersion)(context),
2127
2130
  `cd ${context.build.dir}`,
2128
2131
  ...yarnInstall,
2129
- ...((_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"]),
2130
2133
  ],
2131
- ...(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),
2132
2135
  }
2133
2136
  : null;
2134
2137
  const testJob = buildConfig.test !== false
2135
2138
  ? {
2136
2139
  name: "🧪 test",
2137
2140
  ...base,
2138
- 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"),
2139
2142
  cache: (0, createJobCache_1.createJobCacheFromCacheConfigs)(context, (0, cache_1.getNodeCache)(context)),
2140
2143
  script: [
2141
2144
  ...(0, yarn_1.ensureNodeVersion)(context),
2142
2145
  `cd ${context.build.dir}`,
2143
2146
  ...yarnInstall,
2144
- ...((_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"]),
2145
2148
  ],
2146
- ...(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),
2147
2150
  }
2148
2151
  : null;
2149
2152
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
@@ -2259,6 +2262,7 @@ const createRailsBuildJobs = (context) => {
2259
2262
  dockerBuild: {
2260
2263
  variables: {
2261
2264
  ...context.environment.jobOnlyVars.build.envVars,
2265
+ ...context.build.config.extraVars,
2262
2266
  },
2263
2267
  // custom script
2264
2268
  script: [
@@ -2306,7 +2310,7 @@ exports.createRailsTestJobs = void 0;
2306
2310
  const __1 = __nccwpck_require__(603);
2307
2311
  const utils_1 = __nccwpck_require__(2497);
2308
2312
  const createRailsTestJobs = (context) => {
2309
- 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;
2310
2314
  // don't run tests after release
2311
2315
  // TODO: this will be replaced by using rules
2312
2316
  if (context.trigger === "taggedRelease") {
@@ -2320,6 +2324,7 @@ const createRailsTestJobs = (context) => {
2320
2324
  const base = {
2321
2325
  variables: {
2322
2326
  ...context.environment.jobOnlyVars.build.envVars,
2327
+ ...((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {}),
2323
2328
  },
2324
2329
  stage: "test",
2325
2330
  needs: [],
@@ -2343,10 +2348,10 @@ const createRailsTestJobs = (context) => {
2343
2348
  name: "🛡 audit",
2344
2349
  ...base,
2345
2350
  cache: undefined, // audit does not need bundle install and no cache
2346
- 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,
2347
2352
  script: [
2348
2353
  `cd ${context.build.dir}`,
2349
- ...((_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 : [
2350
2355
  "gem install bundler-audit",
2351
2356
  "bundle audit check",
2352
2357
  ]),
@@ -2359,11 +2364,11 @@ const createRailsTestJobs = (context) => {
2359
2364
  name: "👮 lint",
2360
2365
  ...base,
2361
2366
  cache: bundlerCache,
2362
- 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,
2363
2368
  script: [
2364
2369
  `cd ${context.build.dir}`,
2365
2370
  ...bundlerInstall,
2366
- ...((_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 : [
2367
2372
  "bundle exec rubocop",
2368
2373
  ]),
2369
2374
  ],
@@ -2374,11 +2379,11 @@ const createRailsTestJobs = (context) => {
2374
2379
  name: "🧪 test",
2375
2380
  ...base,
2376
2381
  cache: bundlerCache,
2377
- 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,
2378
2383
  script: [
2379
2384
  `cd ${context.build.dir}`,
2380
2385
  ...bundlerInstall,
2381
- ...((_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 : [
2382
2387
  "bundle exec rspec",
2383
2388
  ]),
2384
2389
  ],
@@ -2695,6 +2700,7 @@ const createComponentContext = async (ctx) => {
2695
2700
  const context = {
2696
2701
  type: "component",
2697
2702
  name: ctx.componentName,
2703
+ componentName: ctx.componentName,
2698
2704
  env: ctx.env,
2699
2705
  fullConfig: ctx.config,
2700
2706
  componentConfig,
@@ -2867,6 +2873,7 @@ const getEnvironment = async (ctx) => {
2867
2873
  slugPrefix: envContext.environmentSlugPrefix,
2868
2874
  reviewSlug: envContext.reviewSlug,
2869
2875
  slug: envContext.environmentSlug,
2876
+ shortName: env,
2870
2877
  ...variables,
2871
2878
  };
2872
2879
  };
@@ -2926,6 +2933,7 @@ exports.getEnvironmentContext = getEnvironmentContext;
2926
2933
 
2927
2934
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2928
2935
  exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvironmentVariables = void 0;
2936
+ const lodash_1 = __nccwpck_require__(3255);
2929
2937
  const deploy_1 = __nccwpck_require__(8483);
2930
2938
  const BashExpression_1 = __nccwpck_require__(2376);
2931
2939
  const types_1 = __nccwpck_require__(4466);
@@ -2943,7 +2951,7 @@ const getBasePredefinedVariables = (ctx) => {
2943
2951
  };
2944
2952
  };
2945
2953
  const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
2946
- var _a, _b, _c, _d, _e, _f, _g;
2954
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
2947
2955
  const environmentContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
2948
2956
  const { config, env, componentName } = ctx;
2949
2957
  const { envConfigRaw, deployConfigRaw, buildConfigRaw, envType } = environmentContext;
@@ -2960,8 +2968,12 @@ const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
2960
2968
  ...basePredefinedVariables,
2961
2969
  ENV_SHORT: "local",
2962
2970
  ROOT_URL: url,
2963
- HOSTNAME: host,
2964
- 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,
2965
2977
  ROOT_URL_INTERNAL: "http://" + host,
2966
2978
  PORT: port.toString(),
2967
2979
  };
@@ -2970,8 +2982,8 @@ const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
2970
2982
  const additionalEnvVars = deployConfigRaw
2971
2983
  ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext)
2972
2984
  : {};
2973
- const HOSTNAME_INTERNAL = (_b = additionalEnvVars.HOSTNAME_INTERNAL) !== null && _b !== void 0 ? _b : "unknown-host.example.com";
2974
- 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;
2975
2987
  url = (0, BashExpression_1.joinBashExpressions)(["https://", host]);
2976
2988
  predefinedVariables = {
2977
2989
  ...basePredefinedVariables,
@@ -2979,10 +2991,12 @@ const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
2979
2991
  ...((0, types_1.isStandaloneBuildConfig)(buildConfigRaw) &&
2980
2992
  buildConfigRaw.type === "rails"
2981
2993
  ? {}
2982
- : { HOSTNAME: host }),
2994
+ : { HOST: host }),
2983
2995
  ROOT_URL: url,
2984
- HOSTNAME_INTERNAL,
2985
- 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]),
2986
3000
  ...additionalEnvVars,
2987
3001
  };
2988
3002
  }
@@ -2995,7 +3009,10 @@ const getEnvironmentVariables = async (ctx, alreadyVisited = {}) => {
2995
3009
  ...additionalSecretKeys,
2996
3010
  ];
2997
3011
  const secretEnvVars = (0, envVars_1.makeSecretEnvVarMapping)(env, componentName, secretEnvVarKeys);
2998
- 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);
2999
3016
  const envVarsRaw = addIndexVar({
3000
3017
  ...predefinedVariables,
3001
3018
  ...secretEnvVars,
@@ -3134,7 +3151,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3134
3151
  return (mod && mod.__esModule) ? mod : { "default": mod };
3135
3152
  };
3136
3153
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3137
- exports.resolveReferences = void 0;
3154
+ exports.translateLegacyFromComponents = exports.resolveReferences = void 0;
3138
3155
  const lodash_1 = __nccwpck_require__(3255);
3139
3156
  const replaceAsync_1 = __importDefault(__nccwpck_require__(2233));
3140
3157
  // regex to resolve references in catladder variables
@@ -3184,6 +3201,15 @@ const resolveReferences = async (vars, getOtherVariables, alreadyVisitedBase = {
3184
3201
  })));
3185
3202
  };
3186
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;
3187
3213
  //# sourceMappingURL=resolveReferences.js.map
3188
3214
 
3189
3215
  /***/ }),
@@ -3289,7 +3315,7 @@ const stop_1 = __nccwpck_require__(2846);
3289
3315
  const variables_1 = __nccwpck_require__(2422);
3290
3316
  exports.DEPLOY_JOB_NAME = "🚀 Deploy";
3291
3317
  const createDeployJob = (context, jobDefinition) => {
3292
- var _a, _b, _c, _d, _e, _f;
3318
+ var _a, _b, _c, _d, _e, _f, _g;
3293
3319
  const hasDocker = (0, docker_1.requiresDockerBuild)(context);
3294
3320
  const isStoppable = (0, utils_1.contextIsStoppable)(context);
3295
3321
  const autoStop = context.environment.envType === "review"
@@ -3368,12 +3394,13 @@ const createDeployJob = (context, jobDefinition) => {
3368
3394
  ...context.environment.envVars,
3369
3395
  ...(hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {}),
3370
3396
  ...context.environment.jobOnlyVars.deploy.envVars,
3397
+ ...(deployConfig ? (_e = deployConfig.extraVars) !== null && _e !== void 0 ? _e : {} : {}),
3371
3398
  ...jobDefinition.variables,
3372
3399
  },
3373
3400
  runnerVariables: {
3374
3401
  ...variables_1.DEPLOY_RUNNER_VARIABLES,
3375
- ...((_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {}),
3376
- ...(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 : {} : {}),
3377
3404
  },
3378
3405
  environment: isStoppable
3379
3406
  ? {
@@ -4222,7 +4249,7 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
4222
4249
  ],
4223
4250
  getAdditionalEnvVars: (ctx) => {
4224
4251
  const { fullName, env, componentName, deployConfigRaw } = ctx;
4225
- const HOSTNAME_INTERNAL = (0, BashExpression_1.joinBashExpressions)([
4252
+ const HOST_INTERNAL = (0, BashExpression_1.joinBashExpressions)([
4226
4253
  fullName,
4227
4254
  (0, BashExpression_1.getBashVariable)((0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)),
4228
4255
  ], "-").toLowerCase();
@@ -4233,7 +4260,7 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
4233
4260
  ]))
4234
4261
  : {};
4235
4262
  return {
4236
- HOSTNAME_INTERNAL,
4263
+ HOST_INTERNAL,
4237
4264
  ...getCloudSqlVariables(ctx),
4238
4265
  ...jobTriggers,
4239
4266
  DEPLOY_CLOUD_RUN_PROJECT_ID: deployConfigRaw
@@ -4645,7 +4672,7 @@ const hasKubernetesCloudSQL = (context) => {
4645
4672
  };
4646
4673
  exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
4647
4674
  const createKubernetesCloudsqlBaseValues = (context) => {
4648
- var _a, _b, _c;
4675
+ var _a, _b, _c, _d, _e, _f, _g;
4649
4676
  const deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
4650
4677
  if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
4651
4678
  throw new Error("cannot get cloud sql config");
@@ -4655,11 +4682,23 @@ const createKubernetesCloudsqlBaseValues = (context) => {
4655
4682
  throw new Error("cannot get cloud sql config");
4656
4683
  }
4657
4684
  const proxyCredentials = `$${(0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials")}`;
4658
- 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}`;
4659
4687
  return {
4660
4688
  cloudsql: {
4661
4689
  enabled: config.enabled,
4662
- 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",
4663
4702
  instanceConnectionName: config.instanceConnectionName,
4664
4703
  proxyCredentials,
4665
4704
  fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.name),
@@ -4721,6 +4760,8 @@ const createKubernetesDeployJobs = (context) => {
4721
4760
  ...((_c = deployConfig.additionalHelmArgs) !== null && _c !== void 0 ? _c : []),
4722
4761
  ].join(" "),
4723
4762
  COMPONENT_NAME: context.name,
4763
+ /** @deprecated */
4764
+ BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID,
4724
4765
  },
4725
4766
  };
4726
4767
  const clusterName = `kube-${context.environment.fullName}`;
@@ -4804,7 +4845,7 @@ exports.KUBERNETES_DEPLOY_TYPE = {
4804
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
4805
4846
  fullConfig.domainCanonical ||
4806
4847
  "panter.cloud";
4807
- const HOSTNAME_INTERNAL = (0, BashExpression_1.joinBashExpressions)([
4848
+ const HOST_INTERNAL = (0, BashExpression_1.joinBashExpressions)([
4808
4849
  componentSlug,
4809
4850
  ...(envType === "review" && reviewSlug ? [reviewSlug] : []),
4810
4851
  env,
@@ -4816,7 +4857,7 @@ exports.KUBERNETES_DEPLOY_TYPE = {
4816
4857
  KUBE_NAMESPACE,
4817
4858
  KUBE_APP_NAME,
4818
4859
  KUBE_APP_NAME_PREFIX,
4819
- HOSTNAME_INTERNAL,
4860
+ HOST_INTERNAL,
4820
4861
  };
4821
4862
  },
4822
4863
  };
@@ -4889,6 +4930,7 @@ const types_1 = __nccwpck_require__(5781);
4889
4930
  const cloudSql_1 = __nccwpck_require__(5129);
4890
4931
  const kubeEnv_1 = __nccwpck_require__(6769);
4891
4932
  const mongodb_1 = __nccwpck_require__(4139);
4933
+ const processSecretsAsFiles_1 = __nccwpck_require__(6089);
4892
4934
  const createAppConfig = (context, application) => {
4893
4935
  if (application === false) {
4894
4936
  return {
@@ -4945,11 +4987,11 @@ const createKubeValues = (context) => {
4945
4987
  : {}, ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled)
4946
4988
  ? (0, mongodb_1.createMongodbBaseConfig)(context)
4947
4989
  : {});
4948
- const kubeValues = (0, utils_1.mergeWithMergingArrays)(defaultKubeValues, {
4990
+ const kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, {
4949
4991
  jobs: removeFalsy(jobs),
4950
4992
  cronjobs: removeFalsy(cronjobs),
4951
4993
  ...rest,
4952
- });
4994
+ }));
4953
4995
  return kubeValues;
4954
4996
  };
4955
4997
  exports.createKubeValues = createKubeValues;
@@ -5068,6 +5110,40 @@ exports.createMongodbBaseConfig = createMongodbBaseConfig;
5068
5110
 
5069
5111
  /***/ }),
5070
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
+
5071
5147
  /***/ 4986:
5072
5148
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
5073
5149
 
@@ -5644,7 +5720,7 @@ const getFullReferencedJobNameFromWorkspace = (referencedJobName, workspaceName,
5644
5720
  const getJobName = (need) => (0, lodash_1.isObject)(need) ? need.job : need;
5645
5721
  const makeGitlabJob = (context, job, allJobs, baseRules) => {
5646
5722
  var _a, _b;
5647
- 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;
5648
5724
  const stage = envMode === "stagePerEnv" ? `${job.stage} ${context.env}` : job.stage;
5649
5725
  const deduplicatedGitlabNeeds = getGitlabNeeds(context, job, allJobs);
5650
5726
  const fullJobName = getFullJobName({
@@ -5768,7 +5844,7 @@ function deduplicateNeeds(needs) {
5768
5844
  ? [...new Map(needs.map((n) => [(0, lodash_1.isObject)(n) ? n.job : n, n])).values()]
5769
5845
  : undefined;
5770
5846
  }
5771
- function getGitlabNeedsForComponentJob(context, { needsStages, needs }, allJobs) {
5847
+ function getGitlabNeedsForComponentJob(context, { needsStages, needs, needsOtherComponent }, allJobs) {
5772
5848
  const needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap((n) => {
5773
5849
  var _a, _b, _c, _d, _e, _f, _g, _h;
5774
5850
  const componentName = context.name;
@@ -5802,6 +5878,8 @@ function getGitlabNeedsForComponentJob(context, { needsStages, needs }, allJobs)
5802
5878
  const cleanedNeeds = [
5803
5879
  ...(needsFromStages !== null && needsFromStages !== void 0 ? needsFromStages : []),
5804
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 : []),
5805
5883
  ];
5806
5884
  return cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map((n) => {
5807
5885
  var _a;