@catladder/cli 0.0.0-refactor-docker-427f63d6 → 0.0.0-refactor-docker-45f6e733

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 (183) hide show
  1. package/dist/bundles/catenv/index.js +212 -193
  2. package/dist/bundles/cli/index.js +330 -298
  3. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js +22 -19
  4. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
  5. package/dist/cli/src/apps/cli/commands/project/commandOpenDashboard.js +10 -9
  6. package/dist/cli/src/apps/cli/commands/project/commandOpenDashboard.js.map +1 -1
  7. package/dist/cli/src/apps/cli/commands/project/commandPortForward.js +18 -16
  8. package/dist/cli/src/apps/cli/commands/project/commandPortForward.js.map +1 -1
  9. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.d.ts +2 -2
  10. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js +10 -9
  11. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
  12. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.d.ts +2 -2
  13. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js +9 -8
  14. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js.map +1 -1
  15. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.d.ts +2 -2
  16. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js +23 -22
  17. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
  18. package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js +10 -9
  19. package/dist/cli/src/apps/cli/commands/project/utils/ensureCluster.js.map +1 -1
  20. package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.d.ts +2 -2
  21. package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
  22. package/dist/cli/src/config/getProjectConfig.d.ts +2 -2
  23. package/dist/cli/src/config/getProjectConfig.js +1 -1
  24. package/dist/cli/src/config/getProjectConfig.js.map +1 -1
  25. package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.d.ts +2 -2
  26. package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.js +6 -5
  27. package/dist/cli/src/gcloud/cloudRun/openCloudRunDashboards.js.map +1 -1
  28. package/dist/cli/src/gcloud/serviceAccounts.d.ts +2 -2
  29. package/dist/cli/src/gcloud/serviceAccounts.js.map +1 -1
  30. package/dist/cli/src/kubernetes/openKubernetesDashboards.d.ts +3 -3
  31. package/dist/cli/src/kubernetes/openKubernetesDashboards.js +10 -8
  32. package/dist/cli/src/kubernetes/openKubernetesDashboards.js.map +1 -1
  33. package/dist/pipeline/src/build/base/createAppBuildJob.d.ts +2 -2
  34. package/dist/pipeline/src/build/base/createAppBuildJob.js +8 -6
  35. package/dist/pipeline/src/build/base/createAppBuildJob.js.map +1 -1
  36. package/dist/pipeline/src/build/base/index.d.ts +2 -2
  37. package/dist/pipeline/src/build/base/index.js.map +1 -1
  38. package/dist/pipeline/src/build/base/writeBuildInfo.d.ts +2 -2
  39. package/dist/pipeline/src/build/base/writeBuildInfo.js +1 -1
  40. package/dist/pipeline/src/build/base/writeBuildInfo.js.map +1 -1
  41. package/dist/pipeline/src/build/base/writeDotEnv.d.ts +2 -2
  42. package/dist/pipeline/src/build/base/writeDotEnv.js +1 -1
  43. package/dist/pipeline/src/build/base/writeDotEnv.js.map +1 -1
  44. package/dist/pipeline/src/build/custom/buildJob.d.ts +2 -2
  45. package/dist/pipeline/src/build/custom/buildJob.js +4 -4
  46. package/dist/pipeline/src/build/custom/buildJob.js.map +1 -1
  47. package/dist/pipeline/src/build/custom/index.d.ts +2 -2
  48. package/dist/pipeline/src/build/custom/index.js.map +1 -1
  49. package/dist/pipeline/src/build/custom/testJob.d.ts +2 -2
  50. package/dist/pipeline/src/build/custom/testJob.js +5 -5
  51. package/dist/pipeline/src/build/custom/testJob.js.map +1 -1
  52. package/dist/pipeline/src/build/docker.d.ts +11 -11
  53. package/dist/pipeline/src/build/docker.js +17 -14
  54. package/dist/pipeline/src/build/docker.js.map +1 -1
  55. package/dist/pipeline/src/build/index.d.ts +2 -2
  56. package/dist/pipeline/src/build/node/buildJob.d.ts +2 -2
  57. package/dist/pipeline/src/build/node/buildJob.js +8 -8
  58. package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
  59. package/dist/pipeline/src/build/node/cache.d.ts +5 -5
  60. package/dist/pipeline/src/build/node/cache.js +5 -5
  61. package/dist/pipeline/src/build/node/cache.js.map +1 -1
  62. package/dist/pipeline/src/build/node/index.d.ts +4 -4
  63. package/dist/pipeline/src/build/node/index.js.map +1 -1
  64. package/dist/pipeline/src/build/node/meteor.d.ts +2 -2
  65. package/dist/pipeline/src/build/node/meteor.js +9 -9
  66. package/dist/pipeline/src/build/node/meteor.js.map +1 -1
  67. package/dist/pipeline/src/build/node/testJob.d.ts +2 -2
  68. package/dist/pipeline/src/build/node/testJob.js +12 -12
  69. package/dist/pipeline/src/build/node/testJob.js.map +1 -1
  70. package/dist/pipeline/src/build/node/yarn.d.ts +4 -4
  71. package/dist/pipeline/src/build/node/yarn.js +1 -3
  72. package/dist/pipeline/src/build/node/yarn.js.map +1 -1
  73. package/dist/pipeline/src/build/rails/build.d.ts +2 -2
  74. package/dist/pipeline/src/build/rails/build.js +3 -3
  75. package/dist/pipeline/src/build/rails/build.js.map +1 -1
  76. package/dist/pipeline/src/build/rails/index.d.ts +2 -2
  77. package/dist/pipeline/src/build/rails/index.js.map +1 -1
  78. package/dist/pipeline/src/build/rails/test.d.ts +2 -2
  79. package/dist/pipeline/src/build/rails/test.js +4 -4
  80. package/dist/pipeline/src/build/rails/test.js.map +1 -1
  81. package/dist/pipeline/src/build/sbom.d.ts +2 -2
  82. package/dist/pipeline/src/build/sbom.js +3 -3
  83. package/dist/pipeline/src/build/sbom.js.map +1 -1
  84. package/dist/pipeline/src/context/getEnvironment.d.ts +2 -2
  85. package/dist/pipeline/src/context/getEnvironment.js.map +1 -1
  86. package/dist/pipeline/src/context/getEnvironmentContext.d.ts +2 -2
  87. package/dist/pipeline/src/context/getEnvironmentContext.js.map +1 -1
  88. package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +4 -4
  89. package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
  90. package/dist/pipeline/src/context/getLabels.d.ts +2 -2
  91. package/dist/pipeline/src/context/getLabels.js +1 -1
  92. package/dist/pipeline/src/context/getLabels.js.map +1 -1
  93. package/dist/pipeline/src/context/index.d.ts +7 -3
  94. package/dist/pipeline/src/context/index.js +46 -15
  95. package/dist/pipeline/src/context/index.js.map +1 -1
  96. package/dist/pipeline/src/deploy/base/deploy.d.ts +2 -2
  97. package/dist/pipeline/src/deploy/base/deploy.js +10 -17
  98. package/dist/pipeline/src/deploy/base/deploy.js.map +1 -1
  99. package/dist/pipeline/src/deploy/base/index.d.ts +2 -2
  100. package/dist/pipeline/src/deploy/base/index.js.map +1 -1
  101. package/dist/pipeline/src/deploy/base/rollback.d.ts +2 -2
  102. package/dist/pipeline/src/deploy/base/rollback.js.map +1 -1
  103. package/dist/pipeline/src/deploy/base/stop.d.ts +2 -2
  104. package/dist/pipeline/src/deploy/base/stop.js.map +1 -1
  105. package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.d.ts +7 -7
  106. package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js +8 -9
  107. package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js.map +1 -1
  108. package/dist/pipeline/src/deploy/cloudRun/cleanup.d.ts +2 -2
  109. package/dist/pipeline/src/deploy/cloudRun/cleanup.js.map +1 -1
  110. package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.d.ts +2 -2
  111. package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.js +4 -5
  112. package/dist/pipeline/src/deploy/cloudRun/cloudRunRevisions.js.map +1 -1
  113. package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunJobs.d.ts +6 -6
  114. package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunJobs.js.map +1 -1
  115. package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.d.ts +3 -3
  116. package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js +1 -1
  117. package/dist/pipeline/src/deploy/cloudRun/createJobs/cloudRunServices.js.map +1 -1
  118. package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js +2 -1
  119. package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js.map +1 -1
  120. package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.d.ts +2 -2
  121. package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js.map +1 -1
  122. package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.d.ts +2 -2
  123. package/dist/pipeline/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.js.map +1 -1
  124. package/dist/pipeline/src/deploy/cloudRun/createJobs/index.d.ts +2 -2
  125. package/dist/pipeline/src/deploy/cloudRun/createJobs/index.js +2 -4
  126. package/dist/pipeline/src/deploy/cloudRun/createJobs/index.js.map +1 -1
  127. package/dist/pipeline/src/deploy/cloudRun/utils/database.d.ts +3 -3
  128. package/dist/pipeline/src/deploy/cloudRun/utils/database.js.map +1 -1
  129. package/dist/pipeline/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.d.ts +2 -2
  130. package/dist/pipeline/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js.map +1 -1
  131. package/dist/pipeline/src/deploy/cloudRun/utils/getServiceName.d.ts +2 -2
  132. package/dist/pipeline/src/deploy/cloudRun/utils/getServiceName.js.map +1 -1
  133. package/dist/pipeline/src/deploy/custom/deployJob.d.ts +2 -2
  134. package/dist/pipeline/src/deploy/custom/deployJob.js +9 -10
  135. package/dist/pipeline/src/deploy/custom/deployJob.js.map +1 -1
  136. package/dist/pipeline/src/deploy/dockerTag/deployJob.d.ts +2 -2
  137. package/dist/pipeline/src/deploy/dockerTag/deployJob.js +3 -5
  138. package/dist/pipeline/src/deploy/dockerTag/deployJob.js.map +1 -1
  139. package/dist/pipeline/src/deploy/index.d.ts +2 -2
  140. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.d.ts +3 -3
  141. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js +11 -9
  142. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
  143. package/dist/pipeline/src/deploy/kubernetes/deployJob.d.ts +2 -2
  144. package/dist/pipeline/src/deploy/kubernetes/deployJob.js +3 -6
  145. package/dist/pipeline/src/deploy/kubernetes/deployJob.js.map +1 -1
  146. package/dist/pipeline/src/deploy/kubernetes/kubeEnv.d.ts +2 -2
  147. package/dist/pipeline/src/deploy/kubernetes/kubeEnv.js +2 -1
  148. package/dist/pipeline/src/deploy/kubernetes/kubeEnv.js.map +1 -1
  149. package/dist/pipeline/src/deploy/kubernetes/kubeValues.d.ts +2 -2
  150. package/dist/pipeline/src/deploy/kubernetes/kubeValues.js +6 -6
  151. package/dist/pipeline/src/deploy/kubernetes/kubeValues.js.map +1 -1
  152. package/dist/pipeline/src/deploy/kubernetes/mongodb.d.ts +2 -2
  153. package/dist/pipeline/src/deploy/kubernetes/mongodb.js +11 -11
  154. package/dist/pipeline/src/deploy/kubernetes/mongodb.js.map +1 -1
  155. package/dist/pipeline/src/deploy/sbom.d.ts +4 -4
  156. package/dist/pipeline/src/deploy/sbom.js +1 -2
  157. package/dist/pipeline/src/deploy/sbom.js.map +1 -1
  158. package/dist/pipeline/src/deploy/types/index.d.ts +1 -1
  159. package/dist/pipeline/src/deploy/types/index.js +1 -1
  160. package/dist/pipeline/src/deploy/types/index.js.map +1 -1
  161. package/dist/pipeline/src/deploy/utils.d.ts +2 -2
  162. package/dist/pipeline/src/deploy/utils.js +2 -1
  163. package/dist/pipeline/src/deploy/utils.js.map +1 -1
  164. package/dist/pipeline/src/pipeline/createJobsForComponent.d.ts +2 -2
  165. package/dist/pipeline/src/pipeline/createJobsForComponent.js +7 -9
  166. package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
  167. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js.map +1 -1
  168. package/dist/pipeline/src/types/config.d.ts +2 -2
  169. package/dist/pipeline/src/types/context.d.ts +28 -2
  170. package/dist/tsconfig.tsbuildinfo +1 -1
  171. package/package.json +1 -1
  172. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +9 -12
  173. package/src/apps/cli/commands/project/commandOpenDashboard.ts +2 -2
  174. package/src/apps/cli/commands/project/commandPortForward.ts +9 -6
  175. package/src/apps/cli/commands/project/setup/setupCloudRun.ts +4 -4
  176. package/src/apps/cli/commands/project/setup/setupContext.ts +4 -4
  177. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +3 -3
  178. package/src/apps/cli/commands/project/utils/ensureCluster.ts +2 -4
  179. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +2 -2
  180. package/src/config/getProjectConfig.ts +2 -2
  181. package/src/gcloud/cloudRun/openCloudRunDashboards.ts +4 -4
  182. package/src/gcloud/serviceAccounts.ts +3 -3
  183. package/src/kubernetes/openKubernetesDashboards.ts +5 -5
@@ -2011,9 +2011,10 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
2011
2011
  .action(function (_a) {
2012
2012
  return __awaiter(this, arguments, void 0, function (_b) {
2013
2013
  var _c, env, componentName, context, proxyInfo, DB_PASSWORD, DB_NAME, DB_USER, instanceName, localPort;
2014
+ var _d, _e;
2014
2015
  var envComponent = _b.envComponent;
2015
- return __generator(this, function (_d) {
2016
- switch (_d.label) {
2016
+ return __generator(this, function (_f) {
2017
+ switch (_f.label) {
2017
2018
  case 0:
2018
2019
  _c = (0, getProjectConfig_1.parseChoice)(envComponent), env = _c.env, componentName = _c.componentName;
2019
2020
  if (!componentName) {
@@ -2022,20 +2023,20 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
2022
2023
  }
2023
2024
  return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(env, componentName)];
2024
2025
  case 1:
2025
- context = _d.sent();
2026
+ context = _f.sent();
2026
2027
  if (env === "review") {
2027
2028
  vorpal.log("⚠️ connection string does not include mr information on review environments");
2028
2029
  }
2029
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) return [3 /*break*/, 3];
2030
+ if (!(0, pipeline_1.isOfDeployType)((_d = context.deploy) === null || _d === void 0 ? void 0 : _d.config, "kubernetes")) return [3 /*break*/, 3];
2030
2031
  return [4 /*yield*/, getProxyInfoForKubernetes(this, context)];
2031
2032
  case 2:
2032
- proxyInfo = _d.sent();
2033
+ proxyInfo = _f.sent();
2033
2034
  return [3 /*break*/, 6];
2034
2035
  case 3:
2035
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) return [3 /*break*/, 5];
2036
+ if (!(0, pipeline_1.isOfDeployType)((_e = context.deploy) === null || _e === void 0 ? void 0 : _e.config, "google-cloudrun")) return [3 /*break*/, 5];
2036
2037
  return [4 /*yield*/, getProxyInfoForCloudRun(this, context)];
2037
2038
  case 4:
2038
- proxyInfo = _d.sent();
2039
+ proxyInfo = _f.sent();
2039
2040
  return [3 /*break*/, 6];
2040
2041
  case 5: throw new Error("unsupported environment");
2041
2042
  case 6:
@@ -2047,7 +2048,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
2047
2048
  message: "Local port: ",
2048
2049
  })];
2049
2050
  case 7:
2050
- localPort = (_d.sent()).localPort;
2051
+ localPort = (_f.sent()).localPort;
2051
2052
  this.log("");
2052
2053
  this.log("postgres-PW: ".concat(DB_PASSWORD));
2053
2054
  this.log("");
@@ -2062,7 +2063,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
2062
2063
  localPort: localPort,
2063
2064
  })];
2064
2065
  case 8:
2065
- _d.sent();
2066
+ _f.sent();
2066
2067
  return [2 /*return*/];
2067
2068
  }
2068
2069
  });
@@ -2073,15 +2074,16 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
2073
2074
  }); });
2074
2075
  var getProxyInfoForKubernetes = function (vorpal, context) { return __awaiter(void 0, void 0, void 0, function () {
2075
2076
  var envVars, cloudSqlValues, DB_PASSWORD, DB_NAME, instanceName;
2076
- return __generator(this, function (_a) {
2077
- switch (_a.label) {
2077
+ var _a;
2078
+ return __generator(this, function (_b) {
2079
+ switch (_b.label) {
2078
2080
  case 0:
2079
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
2081
+ if (!(0, pipeline_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
2080
2082
  throw new Error("unsupported");
2081
2083
  }
2082
2084
  return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.environment.shortName, context.componentName)];
2083
2085
  case 1:
2084
- envVars = _a.sent();
2086
+ envVars = _b.sent();
2085
2087
  cloudSqlValues = (0, pipeline_1.createKubernetesCloudsqlBaseValues)(context);
2086
2088
  DB_PASSWORD = (envVars === null || envVars === void 0 ? void 0 : envVars.DB_PASSWORD) || (envVars === null || envVars === void 0 ? void 0 : envVars.POSTGRESQL_PASSWORD);
2087
2089
  DB_NAME = cloudSqlValues.cloudsql.fullDbName.toString();
@@ -2097,21 +2099,22 @@ var getProxyInfoForKubernetes = function (vorpal, context) { return __awaiter(vo
2097
2099
  }); };
2098
2100
  var getProxyInfoForCloudRun = function (vorpal, context) { return __awaiter(void 0, void 0, void 0, function () {
2099
2101
  var envVars, DB_PASSWORD, DB_USER, DB_NAME;
2100
- return __generator(this, function (_a) {
2101
- switch (_a.label) {
2102
+ var _a, _b, _c;
2103
+ return __generator(this, function (_d) {
2104
+ switch (_d.label) {
2102
2105
  case 0:
2103
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ||
2104
- !context.componentConfig.deploy.cloudSql) {
2106
+ if (!(0, pipeline_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "google-cloudrun") ||
2107
+ !((_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.cloudSql)) {
2105
2108
  throw new Error("unsupported");
2106
2109
  }
2107
2110
  return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.environment.shortName, context.componentName)];
2108
2111
  case 1:
2109
- envVars = _a.sent();
2112
+ envVars = _d.sent();
2110
2113
  DB_PASSWORD = envVars === null || envVars === void 0 ? void 0 : envVars.DB_PASSWORD;
2111
2114
  DB_USER = envVars === null || envVars === void 0 ? void 0 : envVars.DB_USER;
2112
2115
  DB_NAME = context.environment.envVars.DB_NAME.toString();
2113
2116
  return [2 /*return*/, {
2114
- instanceName: context.componentConfig.deploy.cloudSql.instanceConnectionName,
2117
+ instanceName: (_c = context.deploy) === null || _c === void 0 ? void 0 : _c.config.cloudSql.instanceConnectionName,
2115
2118
  DB_PASSWORD: DB_PASSWORD,
2116
2119
  DB_NAME: DB_NAME,
2117
2120
  DB_USER: DB_USER,
@@ -3694,25 +3697,26 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
3694
3697
  .action(function (_a) {
3695
3698
  return __awaiter(this, arguments, void 0, function (_b) {
3696
3699
  var _c, env, componentName, context;
3700
+ var _d, _e;
3697
3701
  var envComponent = _b.envComponent;
3698
- return __generator(this, function (_d) {
3699
- switch (_d.label) {
3702
+ return __generator(this, function (_f) {
3703
+ switch (_f.label) {
3700
3704
  case 0:
3701
3705
  _c = (0, getProjectConfig_1.parseChoice)(envComponent), env = _c.env, componentName = _c.componentName;
3702
3706
  return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(env, componentName)];
3703
3707
  case 1:
3704
- context = _d.sent();
3705
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) return [3 /*break*/, 3];
3708
+ context = _f.sent();
3709
+ if (!(0, pipeline_1.isOfDeployType)((_d = context.deploy) === null || _d === void 0 ? void 0 : _d.config, "kubernetes")) return [3 /*break*/, 3];
3706
3710
  return [4 /*yield*/, (0, openKubernetesDashboards_1.openGoogleCloudKubernetesDashboard)(this, context)];
3707
3711
  case 2:
3708
- _d.sent();
3709
- _d.label = 3;
3712
+ _f.sent();
3713
+ _f.label = 3;
3710
3714
  case 3:
3711
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) return [3 /*break*/, 5];
3715
+ if (!(0, pipeline_1.isOfDeployType)((_e = context.deploy) === null || _e === void 0 ? void 0 : _e.config, "google-cloudrun")) return [3 /*break*/, 5];
3712
3716
  return [4 /*yield*/, (0, openCloudRunDashboards_1.openGoogleCloudRunDashboard)(this, context)];
3713
3717
  case 4:
3714
- _d.sent();
3715
- _d.label = 5;
3718
+ _f.sent();
3719
+ _f.label = 5;
3716
3720
  case 5: return [2 /*return*/];
3717
3721
  }
3718
3722
  });
@@ -4358,10 +4362,11 @@ var kubePortForward = function (cmd, envComponent) { return __awaiter(void 0, vo
4358
4362
  }); };
4359
4363
  var cloudRunPortForward = function (cmd, context) { return __awaiter(void 0, void 0, void 0, function () {
4360
4364
  var fullName, serviceName, mr, _a, projectId, region, command;
4361
- return __generator(this, function (_b) {
4362
- switch (_b.label) {
4365
+ var _b;
4366
+ return __generator(this, function (_c) {
4367
+ switch (_c.label) {
4363
4368
  case 0:
4364
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) {
4369
+ if (!(0, pipeline_1.isOfDeployType)((_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config, "google-cloudrun")) {
4365
4370
  throw new Error("not cloud run");
4366
4371
  }
4367
4372
  fullName = context.environment.fullName;
@@ -4373,18 +4378,18 @@ var cloudRunPortForward = function (cmd, context) { return __awaiter(void 0, voi
4373
4378
  message: "Which mr 🤔 ",
4374
4379
  })];
4375
4380
  case 1:
4376
- mr = (_b.sent()).mr;
4381
+ mr = (_c.sent()).mr;
4377
4382
  // poor mans solution
4378
4383
  serviceName = serviceName
4379
4384
  .toString()
4380
4385
  .replace("-review-", "-review-mr" + mr + "-");
4381
- _b.label = 2;
4386
+ _c.label = 2;
4382
4387
  case 2:
4383
- _a = context.componentConfig.deploy, projectId = _a.projectId, region = _a.region;
4388
+ _a = context.deploy.config, projectId = _a.projectId, region = _a.region;
4384
4389
  command = "gcloud beta run services proxy ".concat(serviceName, " --project ").concat(projectId, " --region ").concat(region);
4385
4390
  return [4 /*yield*/, (0, portForwards_1.startPortForwardCommand)("cloudRun/".concat(serviceName), command)];
4386
4391
  case 3:
4387
- _b.sent();
4392
+ _c.sent();
4388
4393
  (0, open_1.default)("http://localhost:8080");
4389
4394
  return [2 /*return*/];
4390
4395
  }
@@ -4403,25 +4408,26 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
4403
4408
  .action(function (_a) {
4404
4409
  return __awaiter(this, arguments, void 0, function (_b) {
4405
4410
  var _c, env, componentName, context;
4411
+ var _d, _e;
4406
4412
  var envComponent = _b.envComponent;
4407
- return __generator(this, function (_d) {
4408
- switch (_d.label) {
4413
+ return __generator(this, function (_f) {
4414
+ switch (_f.label) {
4409
4415
  case 0:
4410
4416
  _c = (0, parseChoice_1.parseChoice)(envComponent), env = _c.env, componentName = _c.componentName;
4411
4417
  return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(env, componentName)];
4412
4418
  case 1:
4413
- context = _d.sent();
4414
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) return [3 /*break*/, 3];
4419
+ context = _f.sent();
4420
+ if (!(0, pipeline_1.isOfDeployType)((_d = context.deploy) === null || _d === void 0 ? void 0 : _d.config, "kubernetes")) return [3 /*break*/, 3];
4415
4421
  return [4 /*yield*/, kubePortForward(this, envComponent)];
4416
4422
  case 2:
4417
- _d.sent();
4418
- _d.label = 3;
4423
+ _f.sent();
4424
+ _f.label = 3;
4419
4425
  case 3:
4420
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) return [3 /*break*/, 5];
4426
+ if (!(0, pipeline_1.isOfDeployType)((_e = context.deploy) === null || _e === void 0 ? void 0 : _e.config, "google-cloudrun")) return [3 /*break*/, 5];
4421
4427
  return [4 /*yield*/, cloudRunPortForward(this, context)];
4422
4428
  case 4:
4423
- _d.sent();
4424
- _d.label = 5;
4429
+ _f.sent();
4430
+ _f.label = 5;
4425
4431
  case 5: return [2 /*return*/];
4426
4432
  }
4427
4433
  });
@@ -5284,13 +5290,14 @@ var gitlab_1 = __nccwpck_require__(12927);
5284
5290
  var setupCloudRun = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
5285
5291
  var config, suffix;
5286
5292
  var _a;
5287
- return __generator(this, function (_b) {
5288
- switch (_b.label) {
5293
+ var _b, _c;
5294
+ return __generator(this, function (_d) {
5295
+ switch (_d.label) {
5289
5296
  case 0:
5290
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) {
5297
+ if (!(0, pipeline_1.isOfDeployType)((_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config, "google-cloudrun")) {
5291
5298
  throw new Error("deploy config is not of type 'google-cloudrun'");
5292
5299
  }
5293
- config = context.componentConfig.deploy;
5300
+ config = (_c = context.deploy) === null || _c === void 0 ? void 0 : _c.config;
5294
5301
  // enable services
5295
5302
  instance.log("enable required services...");
5296
5303
  return [4 /*yield*/, (0, enableServices_1.enableGCloudServices)(__spreadArray([
@@ -5302,11 +5309,11 @@ var setupCloudRun = function (instance, context) { return __awaiter(void 0, void
5302
5309
  ? ["sqladmin.googleapis.com", "sql-component.googleapis.com"]
5303
5310
  : [])), false), config)];
5304
5311
  case 1:
5305
- _b.sent();
5312
+ _d.sent();
5306
5313
  instance.log("upsert artifacts registry...");
5307
5314
  return [4 /*yield*/, (0, artifactsRegistry_1.upsertGcloudArtifactsRegistry)(config)];
5308
5315
  case 2:
5309
- _b.sent();
5316
+ _d.sent();
5310
5317
  instance.log("upsert deploy service account...");
5311
5318
  return [4 /*yield*/, (0, serviceAccounts_1.upsertGcloudServiceAccountAndSaveSecret)(instance, context, {
5312
5319
  projectId: config.projectId,
@@ -5322,7 +5329,7 @@ var setupCloudRun = function (instance, context) { return __awaiter(void 0, void
5322
5329
  ], __read((config.cloudSql ? ["roles/cloudsql.admin"] : [])), false),
5323
5330
  }, pipeline_1.GCLOUD_DEPLOY_CREDENTIALS_KEY)];
5324
5331
  case 3:
5325
- _b.sent();
5332
+ _d.sent();
5326
5333
  // gcloud run automatically gives us a hostname
5327
5334
  // but the pipeline need to know it before deployment
5328
5335
  // so we get this through some magic and add this as a ci/cd variable
@@ -5330,14 +5337,14 @@ var setupCloudRun = function (instance, context) { return __awaiter(void 0, void
5330
5337
  instance.log("get service domain suffix... that might take a while initially");
5331
5338
  return [4 /*yield*/, (0, getCloudRunDomainSuffix_1.getCloudRunDomainSuffix)(config)];
5332
5339
  case 4:
5333
- suffix = _b.sent();
5340
+ suffix = _d.sent();
5334
5341
  instance.log("domain suffix: " + suffix);
5335
5342
  return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, (_a = {},
5336
5343
  _a[pipeline_1.GCLOUD_RUN_CANONICAL_HOST_SUFFIX] = suffix,
5337
5344
  _a), context.environment.shortName, context.componentName, false, // backup
5338
5345
  false)];
5339
5346
  case 5:
5340
- _b.sent();
5347
+ _d.sent();
5341
5348
  return [2 /*return*/];
5342
5349
  }
5343
5350
  });
@@ -5395,8 +5402,9 @@ var setupCloudRun_1 = __nccwpck_require__(1082);
5395
5402
  var setupKubernetes_1 = __nccwpck_require__(88412);
5396
5403
  var setupContext = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
5397
5404
  var deployConfig;
5398
- return __generator(this, function (_a) {
5399
- switch (_a.label) {
5405
+ var _a, _b;
5406
+ return __generator(this, function (_c) {
5407
+ switch (_c.label) {
5400
5408
  case 0:
5401
5409
  instance.log("");
5402
5410
  instance.log("==================================================================================");
@@ -5406,18 +5414,18 @@ var setupContext = function (instance, context) { return __awaiter(void 0, void
5406
5414
  context.componentName +
5407
5415
  "...");
5408
5416
  instance.log("");
5409
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) return [3 /*break*/, 2];
5417
+ if (!(0, pipeline_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "google-cloudrun")) return [3 /*break*/, 2];
5410
5418
  return [4 /*yield*/, (0, setupCloudRun_1.setupCloudRun)(instance, context)];
5411
5419
  case 1:
5412
- _a.sent();
5413
- _a.label = 2;
5420
+ _c.sent();
5421
+ _c.label = 2;
5414
5422
  case 2:
5415
- deployConfig = context.componentConfig.deploy;
5423
+ deployConfig = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config;
5416
5424
  if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) return [3 /*break*/, 4];
5417
5425
  return [4 /*yield*/, (0, setupKubernetes_1.setupKubernetes)(instance, context)];
5418
5426
  case 3:
5419
- _a.sent();
5420
- _a.label = 4;
5427
+ _c.sent();
5428
+ _c.label = 4;
5421
5429
  case 4:
5422
5430
  instance.log("");
5423
5431
  instance.log("✅ " +
@@ -5488,19 +5496,20 @@ var gitlab_1 = __nccwpck_require__(12927);
5488
5496
  var ensureNamespace_1 = __importDefault(__nccwpck_require__(81349));
5489
5497
  var setupKubernetes = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
5490
5498
  var deployConfig, projectId, deploy_tokens, fullName, namespace, serviceAccountName, KUBE_URL, e_1, secretName, KUBE_CA_PEM, KUBE_TOKEN, vars, missing;
5491
- return __generator(this, function (_a) {
5492
- switch (_a.label) {
5499
+ var _a;
5500
+ return __generator(this, function (_b) {
5501
+ switch (_b.label) {
5493
5502
  case 0:
5494
- deployConfig = context.componentConfig.deploy;
5503
+ deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
5495
5504
  if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) {
5496
5505
  throw new Error("cannot run setupKubernetes on non-kubernetes deployments");
5497
5506
  }
5498
5507
  return [4 /*yield*/, (0, gitlab_1.getProjectInfo)(instance)];
5499
5508
  case 1:
5500
- projectId = (_a.sent()).id;
5509
+ projectId = (_b.sent()).id;
5501
5510
  return [4 /*yield*/, (0, gitlab_1.doGitlabRequest)(instance, "projects/".concat(projectId, "/deploy_tokens"))];
5502
5511
  case 2:
5503
- deploy_tokens = _a.sent();
5512
+ deploy_tokens = _b.sent();
5504
5513
  if (!!deploy_tokens.find(function (v) { return v.name === "gitlab-deploy-token"; })) return [3 /*break*/, 4];
5505
5514
  instance.log("I will setup the 'GitLab Deploy Token', so Kubernetes can pull images from this project.");
5506
5515
  return [4 /*yield*/, (0, gitlab_1.doGitlabRequest)(instance, "projects/".concat(projectId, "/deploy_tokens"), {
@@ -5509,19 +5518,19 @@ var setupKubernetes = function (instance, context) { return __awaiter(void 0, vo
5509
5518
  scopes: ["read_registry"],
5510
5519
  }, "POST")];
5511
5520
  case 3:
5512
- _a.sent();
5513
- _a.label = 4;
5521
+ _b.sent();
5522
+ _b.label = 4;
5514
5523
  case 4:
5515
5524
  fullName = (0, pipeline_1.getFullKubernetesClusterName)(deployConfig.cluster);
5516
5525
  instance.log("cluster: ".concat(fullName));
5517
5526
  return [4 /*yield*/, (0, cluster_1.connectToCluster)(fullName)];
5518
5527
  case 5:
5519
- _a.sent();
5528
+ _b.sent();
5520
5529
  instance.log("");
5521
5530
  instance.log("ensuring namespace ...");
5522
5531
  return [4 /*yield*/, (0, ensureNamespace_1.default)(context)];
5523
5532
  case 6:
5524
- namespace = _a.sent();
5533
+ namespace = _b.sent();
5525
5534
  instance.log("Namespace " + namespace + " created / updated!");
5526
5535
  instance.log("");
5527
5536
  //$.verbose = true;
@@ -5531,43 +5540,43 @@ var setupKubernetes = function (instance, context) { return __awaiter(void 0, vo
5531
5540
  serviceAccountName = "cl-".concat(context.componentName, "-deploy");
5532
5541
  return [4 /*yield*/, (0, child_process_promise_1.exec)("TERM=dumb kubectl cluster-info | grep -E 'Kubernetes master|Kubernetes control plane' | awk '/http/ {print $NF}'").then(function (s) { return s.stdout.trim(); })];
5533
5542
  case 7:
5534
- KUBE_URL = _a.sent();
5535
- _a.label = 8;
5543
+ KUBE_URL = _b.sent();
5544
+ _b.label = 8;
5536
5545
  case 8:
5537
- _a.trys.push([8, 12, , 13]);
5546
+ _b.trys.push([8, 12, , 13]);
5538
5547
  return [4 /*yield*/, (0, child_process_promise_1.exec)("kubectl delete serviceaccount --namespace ".concat(namespace, " ").concat(serviceAccountName))];
5539
5548
  case 9:
5540
- _a.sent();
5549
+ _b.sent();
5541
5550
  return [4 /*yield*/, (0, child_process_promise_1.exec)("kubectl delete rolebinding --namespace ".concat(namespace, " ").concat(serviceAccountName))];
5542
5551
  case 10:
5543
- _a.sent();
5552
+ _b.sent();
5544
5553
  return [4 /*yield*/, (0, child_process_promise_1.exec)("kubectl delete role --namespace ".concat(namespace, " ").concat(serviceAccountName))];
5545
5554
  case 11:
5546
- _a.sent();
5555
+ _b.sent();
5547
5556
  return [3 /*break*/, 13];
5548
5557
  case 12:
5549
- e_1 = _a.sent();
5558
+ e_1 = _b.sent();
5550
5559
  return [3 /*break*/, 13];
5551
5560
  case 13: return [4 /*yield*/, (0, child_process_promise_1.exec)("kubectl create serviceaccount --namespace ".concat(namespace, " ").concat(serviceAccountName))];
5552
5561
  case 14:
5553
- _a.sent();
5562
+ _b.sent();
5554
5563
  // upsert role in the ns
5555
5564
  return [4 /*yield*/, (0, child_process_promise_1.exec)("cat <<EOF | kubectl apply -f -\nkind: Role\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n namespace: ".concat(namespace, "\n name: ").concat(serviceAccountName, "\nrules:\n- apiGroups: [\"\", \"extensions\", \"apps\", \"networking.k8s.io\", \"batch\", \"autoscaling\", \"rbac.authorization.k8s.io\",\"snapshot.storage.k8s.io\"]\n resources: [\"deployments\", \"replicasets\", \"statefulsets\", \"pods\", \"secrets\", \"configmaps\", \"services\", \"ingresses\", \"serviceaccounts\", \"roles\", \"rolebindings\", \"jobs\", \"cronjobs\", \"horizontalpodautoscalers\", \"persistentvolumeclaims\", \"volumesnapshots\"]\n verbs: [\"*\"]\n---\nkind: RoleBinding\napiVersion: rbac.authorization.k8s.io/v1\nmetadata:\n name: ").concat(serviceAccountName, "\n namespace: ").concat(namespace, "\nsubjects:\n - kind: ServiceAccount\n name: ").concat(serviceAccountName, "\n namespace: ").concat(namespace, "\nroleRef:\n kind: Role\n name: ").concat(serviceAccountName, "\n apiGroup: rbac.authorization.k8s.io\nEOF\n"))];
5556
5565
  case 15:
5557
5566
  // upsert role in the ns
5558
- _a.sent();
5567
+ _b.sent();
5559
5568
  secretName = "".concat(serviceAccountName, "-secret");
5560
5569
  // create token for the service account
5561
5570
  return [4 /*yield*/, (0, child_process_promise_1.exec)("\nkubectl apply -f - <<EOF\napiVersion: v1\nkind: Secret\nmetadata:\n name: ".concat(secretName, "\n namespace: ").concat(namespace, "\n annotations:\n kubernetes.io/service-account.name: ").concat(serviceAccountName, "\ntype: kubernetes.io/service-account-token\nEOF\n "))];
5562
5571
  case 16:
5563
5572
  // create token for the service account
5564
- _a.sent();
5573
+ _b.sent();
5565
5574
  return [4 /*yield*/, (0, child_process_promise_1.exec)("kubectl get secret ".concat(secretName, " --namespace ").concat(namespace, " -o jsonpath=\"{['data']['ca\\.crt']}\"")).then(function (c) { return c.stdout.trim(); })];
5566
5575
  case 17:
5567
- KUBE_CA_PEM = _a.sent();
5576
+ KUBE_CA_PEM = _b.sent();
5568
5577
  return [4 /*yield*/, (0, child_process_promise_1.exec)("kubectl get secret ".concat(secretName, " --namespace ").concat(namespace, " -o jsonpath=\"{['data']['token']}\" | base64 --decode")).then(function (c) { return c.stdout.trim(); })];
5569
5578
  case 18:
5570
- KUBE_TOKEN = _a.sent();
5579
+ KUBE_TOKEN = _b.sent();
5571
5580
  vars = {
5572
5581
  KUBE_TOKEN: KUBE_TOKEN,
5573
5582
  KUBE_CA_PEM: KUBE_CA_PEM,
@@ -5586,7 +5595,7 @@ var setupKubernetes = function (instance, context) { return __awaiter(void 0, vo
5586
5595
  instance.log("pusing secrets to gitlab...");
5587
5596
  return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, vars, context.environment.shortName, context.componentName, false)];
5588
5597
  case 19:
5589
- _a.sent();
5598
+ _b.sent();
5590
5599
  instance.log("done!");
5591
5600
  return [2 /*return*/];
5592
5601
  }
@@ -5856,20 +5865,21 @@ var cluster_1 = __nccwpck_require__(62774);
5856
5865
  function default_1(envComponent) {
5857
5866
  return __awaiter(this, void 0, void 0, function () {
5858
5867
  var _a, env, componentName, context, cluster, connectedClusterName, shouldContinue;
5859
- return __generator(this, function (_b) {
5860
- switch (_b.label) {
5868
+ var _b, _c;
5869
+ return __generator(this, function (_d) {
5870
+ switch (_d.label) {
5861
5871
  case 0:
5862
5872
  _a = (0, getProjectConfig_1.parseChoice)(envComponent), env = _a.env, componentName = _a.componentName;
5863
5873
  return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(env, componentName)];
5864
5874
  case 1:
5865
- context = _b.sent();
5866
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
5875
+ context = _d.sent();
5876
+ if (!(0, pipeline_1.isOfDeployType)((_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config, "kubernetes")) {
5867
5877
  throw new Error("can't ensure cluster for non-kubernetes deployments");
5868
5878
  }
5869
- cluster = (0, pipeline_1.getFullKubernetesClusterName)(context.componentConfig.deploy.cluster);
5879
+ cluster = (0, pipeline_1.getFullKubernetesClusterName)((_c = context.deploy) === null || _c === void 0 ? void 0 : _c.config.cluster);
5870
5880
  return [4 /*yield*/, (0, cluster_1.getCurrentConnectedClusterName)()];
5871
5881
  case 2:
5872
- connectedClusterName = _b.sent();
5882
+ connectedClusterName = _d.sent();
5873
5883
  if (!(cluster !== connectedClusterName)) return [3 /*break*/, 6];
5874
5884
  this.log("you are currently connected to cluster '".concat(connectedClusterName, "'"));
5875
5885
  this.log("but the project requires cluster '".concat(cluster, "'"));
@@ -5880,15 +5890,15 @@ function default_1(envComponent) {
5880
5890
  message: "Do you want to connect to '".concat(cluster, "'?"),
5881
5891
  })];
5882
5892
  case 3:
5883
- shouldContinue = (_b.sent()).shouldContinue;
5893
+ shouldContinue = (_d.sent()).shouldContinue;
5884
5894
  if (!!shouldContinue) return [3 /*break*/, 4];
5885
5895
  this.log("abort");
5886
5896
  return [3 /*break*/, 6];
5887
5897
  case 4: return [4 /*yield*/, (0, cluster_1.connectToCluster)(cluster)];
5888
5898
  case 5:
5889
- _b.sent();
5899
+ _d.sent();
5890
5900
  this.log("connected to cluster '".concat(cluster, "'"));
5891
- _b.label = 6;
5901
+ _d.label = 6;
5892
5902
  case 6: return [2 /*return*/];
5893
5903
  }
5894
5904
  });
@@ -6513,7 +6523,7 @@ var getPipelineContextByChoice = function (env, componentName) { return __awaite
6513
6523
  case 0: return [4 /*yield*/, (0, exports.getProjectConfig)()];
6514
6524
  case 1:
6515
6525
  config = _a.sent();
6516
- return [4 /*yield*/, (0, pipeline_1.createContext)({
6526
+ return [4 /*yield*/, (0, pipeline_1.createComponentContext)({
6517
6527
  config: config,
6518
6528
  componentName: componentName,
6519
6529
  env: env,
@@ -6917,19 +6927,20 @@ var pipeline_1 = __nccwpck_require__(10603);
6917
6927
  var openDashboard_1 = __nccwpck_require__(77056);
6918
6928
  var openGoogleCloudRunDashboard = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
6919
6929
  var fullName, _a, region, projectId;
6920
- return __generator(this, function (_b) {
6921
- switch (_b.label) {
6930
+ var _b;
6931
+ return __generator(this, function (_c) {
6932
+ switch (_c.label) {
6922
6933
  case 0:
6923
- if (!(0, pipeline_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")) {
6934
+ if (!(0, pipeline_1.isOfDeployType)((_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config, "google-cloudrun")) {
6924
6935
  throw new Error("deploy type is not google-cloudrun ");
6925
6936
  }
6926
6937
  fullName = context.environment.fullName;
6927
- _a = context.componentConfig.deploy, region = _a.region, projectId = _a.projectId;
6938
+ _a = context.deploy.config, region = _a.region, projectId = _a.projectId;
6928
6939
  return [4 /*yield*/, (0, openDashboard_1.openGoogleCloudDashboard)(instance, "run/detail/".concat(region, "/").concat(fullName, "/metrics"), {
6929
6940
  project: projectId,
6930
6941
  })];
6931
6942
  case 1:
6932
- _b.sent();
6943
+ _c.sent();
6933
6944
  return [2 /*return*/];
6934
6945
  }
6935
6946
  });
@@ -7726,10 +7737,11 @@ var pipeline_1 = __nccwpck_require__(10603);
7726
7737
  var openDashboard_1 = __nccwpck_require__(77056);
7727
7738
  var openGoogleCloudLogs = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
7728
7739
  var deployConfig, namespace, cluster, resource;
7729
- return __generator(this, function (_a) {
7730
- switch (_a.label) {
7740
+ var _a;
7741
+ return __generator(this, function (_b) {
7742
+ switch (_b.label) {
7731
7743
  case 0:
7732
- deployConfig = context.componentConfig.deploy;
7744
+ deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
7733
7745
  if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) {
7734
7746
  throw new Error("context is not of type kubernetes");
7735
7747
  }
@@ -7744,7 +7756,7 @@ var openGoogleCloudLogs = function (instance, context) { return __awaiter(void 0
7744
7756
  resource: resource,
7745
7757
  })];
7746
7758
  case 1:
7747
- _a.sent();
7759
+ _b.sent();
7748
7760
  return [2 /*return*/];
7749
7761
  }
7750
7762
  });
@@ -7752,10 +7764,11 @@ var openGoogleCloudLogs = function (instance, context) { return __awaiter(void 0
7752
7764
  exports.openGoogleCloudLogs = openGoogleCloudLogs;
7753
7765
  var openGoogleCloudKubernetesDashboard = function (instance, context) { return __awaiter(void 0, void 0, void 0, function () {
7754
7766
  var deployConfig, namespace, cluster, pageState;
7755
- return __generator(this, function (_a) {
7756
- switch (_a.label) {
7767
+ var _a;
7768
+ return __generator(this, function (_b) {
7769
+ switch (_b.label) {
7757
7770
  case 0:
7758
- deployConfig = context.componentConfig.deploy;
7771
+ deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
7759
7772
  if (!(0, pipeline_1.isOfDeployType)(deployConfig, "kubernetes")) {
7760
7773
  throw new Error("context is not of type kubernetes");
7761
7774
  }
@@ -7770,7 +7783,7 @@ var openGoogleCloudKubernetesDashboard = function (instance, context) { return _
7770
7783
  pageState: pageState,
7771
7784
  })];
7772
7785
  case 1:
7773
- _a.sent();
7786
+ _b.sent();
7774
7787
  return [2 /*return*/];
7775
7788
  }
7776
7789
  });
@@ -9691,17 +9704,19 @@ var createAppBuildJob = function (context, _a) {
9691
9704
  image: (0, __1.getRunnerImage)("jobs-default"),
9692
9705
  needs: [],
9693
9706
  cache: [],
9694
- variables: __assign(__assign(__assign(__assign({}, (variables !== null && variables !== void 0 ? variables : {})), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), ((_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {})),
9695
- runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), (runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {})), ((_c = context.componentConfig.build.runnerVariables) !== null && _c !== void 0 ? _c : {})),
9707
+ variables: __assign(__assign(__assign(__assign({}, (variables !== null && variables !== void 0 ? variables : {})), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), ((_b = context.build.config.extraVars) !== null && _b !== void 0 ? _b : {})),
9708
+ runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), (runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {})), ((_c = context.build.config.runnerVariables) !== null && _c !== void 0 ? _c : {})),
9696
9709
  script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((context.componentConfig.dotEnv === true // don't build when set to `local`
9697
9710
  ? (0, writeDotEnv_1.writeDotEnv)(context)
9698
- : [])), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), [
9699
- "cd ".concat(context.componentConfig.dir)
9711
+ : [])), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context.build)), false), [
9712
+ "cd ".concat(context.build.dir)
9700
9713
  ], false), __read(((_d = (0, utils_1.ensureArray)(script)) !== null && _d !== void 0 ? _d : [])), false),
9701
9714
  artifacts: {
9702
- paths: [(0, path_1.join)(context.componentConfig.dir, "__build_info.json")],
9715
+ paths: [(0, path_1.join)(context.build.dir, "__build_info.json")],
9703
9716
  reports: {
9704
- junit: (_f = (_e = context.componentConfig.build.artifactsReports) === null || _e === void 0 ? void 0 : _e.junit) === null || _f === void 0 ? void 0 : _f.map(function (p) { return (0, path_1.join)(context.componentConfig.dir, p); }),
9717
+ junit: (_f = (_e = context.build.config.artifactsReports) === null || _e === void 0 ? void 0 : _e.junit) === null || _f === void 0 ? void 0 : _f.map(function (p) {
9718
+ return (0, path_1.join)(context.build.dir, p);
9719
+ }),
9705
9720
  },
9706
9721
  },
9707
9722
  }, def);
@@ -9849,7 +9864,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
9849
9864
  exports.writeBuildInfo = void 0;
9850
9865
  var writeBuildInfo = function (context) {
9851
9866
  return [
9852
- "echo '{\"id\":\"".concat(context.environment.envVars.BUILD_INFO_BUILD_ID, "\",\"time\":\"").concat(context.environment.envVars.BUILD_INFO_BUILD_TIME, "\"}' > ").concat(context.componentConfig.dir, "/__build_info.json"),
9867
+ "echo '{\"id\":\"".concat(context.environment.envVars.BUILD_INFO_BUILD_ID, "\",\"time\":\"").concat(context.environment.envVars.BUILD_INFO_BUILD_TIME, "\"}' > ").concat(context.build.dir, "/__build_info.json"),
9853
9868
  ];
9854
9869
  };
9855
9870
  exports.writeBuildInfo = writeBuildInfo;
@@ -9901,7 +9916,7 @@ var writeDotEnv = function (context) {
9901
9916
  })
9902
9917
  .join("\n");
9903
9918
  return [
9904
- "cat <<EOF > ".concat(context.componentConfig.dir, "/.env\n").concat(keyValueString, "\nEOF"),
9919
+ "cat <<EOF > ".concat(context.build.dir, "/.env\n").concat(keyValueString, "\nEOF"),
9905
9920
  ];
9906
9921
  };
9907
9922
  exports.writeDotEnv = writeDotEnv;
@@ -9953,7 +9968,7 @@ var RUNNER_BUILD_VARIABLES = {
9953
9968
  };
9954
9969
  var createCustomBuildJobs = function (context) {
9955
9970
  var _a, _b, _c;
9956
- var buildConfig = context.componentConfig.build;
9971
+ var buildConfig = context.build.config;
9957
9972
  if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
9958
9973
  throw new Error("deploy config is not custom");
9959
9974
  }
@@ -9967,10 +9982,10 @@ var createCustomBuildJobs = function (context) {
9967
9982
  script: __spreadArray([], __read(((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : [])), false),
9968
9983
  artifacts: {
9969
9984
  paths: __spreadArray([
9970
- (0, path_1.join)(context.componentConfig.dir, "__build_info.json"),
9971
- (0, path_1.join)(context.componentConfig.dir, "dist")
9985
+ (0, path_1.join)(context.build.dir, "__build_info.json"),
9986
+ (0, path_1.join)(context.build.dir, "dist")
9972
9987
  ], __read(((_c = (_b = buildConfig.artifactsPaths) === null || _b === void 0 ? void 0 : _b.map(function (path) {
9973
- return (0, path_1.join)(context.componentConfig.dir, path);
9988
+ return (0, path_1.join)(context.build.dir, path);
9974
9989
  })) !== null && _c !== void 0 ? _c : [])), false),
9975
9990
  expire_in: "1 day",
9976
9991
  },
@@ -10087,12 +10102,12 @@ var createCustomTestJobs = function (context) {
10087
10102
  if (context.trigger === "taggedRelease") {
10088
10103
  return [];
10089
10104
  }
10090
- var buildConfig = context.componentConfig.build;
10105
+ var buildConfig = context.build.config;
10091
10106
  if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
10092
10107
  throw new Error("deploy config is not custom");
10093
10108
  }
10094
10109
  var base = {
10095
- variables: __assign(__assign({ APP_PATH: context.componentConfig.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
10110
+ variables: __assign(__assign({ APP_PATH: context.build.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
10096
10111
  runnerVariables: RUNNER_CUSTOM_TEST_VARIABLES,
10097
10112
  services: buildConfig.jobServices,
10098
10113
  cache: buildConfig.jobCache,
@@ -10101,11 +10116,11 @@ var createCustomTestJobs = function (context) {
10101
10116
  envMode: "none",
10102
10117
  };
10103
10118
  var auditJob = buildConfig.audit
10104
- ? __assign(__assign(__assign({ name: "🛡 audit" }, base), { image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage, cache: undefined, script: __spreadArray([], __read(((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [])), false), allow_failure: true }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifactsReports, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifacts)) : null;
10119
+ ? __assign(__assign(__assign({ name: "🛡 audit" }, base), { image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : buildConfig.jobImage, cache: undefined, script: __spreadArray([], __read(((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [])), false), allow_failure: true }), (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)) : null;
10105
10120
  var lintJob = buildConfig.lint
10106
- ? __assign(__assign(__assign({ name: "👮 lint" }, base), { image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : buildConfig.jobImage, script: __spreadArray([], __read(((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : [])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifactsReports, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifacts)) : null;
10121
+ ? __assign(__assign(__assign({ name: "👮 lint" }, base), { image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : buildConfig.jobImage, script: __spreadArray([], __read(((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : [])), false) }), (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)) : null;
10107
10122
  var testJob = buildConfig.test
10108
- ? __assign(__assign(__assign({ name: "🧪 test" }, base), { image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : buildConfig.jobImage, script: __spreadArray([], __read(((_s = (0, utils_1.ensureArray)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : [])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifacts)) : null;
10123
+ ? __assign(__assign(__assign({ name: "🧪 test" }, base), { image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : buildConfig.jobImage, script: __spreadArray([], __read(((_s = (0, utils_1.ensureArray)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : [])), false) }), (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)) : null;
10109
10124
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
10110
10125
  };
10111
10126
  exports.createCustomTestJobs = createCustomTestJobs;
@@ -10170,21 +10185,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
10170
10185
  };
10171
10186
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10172
10187
  exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.getDockerBuildScriptWithBuiltInDockerFile = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
10173
- var lodash_1 = __nccwpck_require__(23255);
10174
- var deploy_1 = __nccwpck_require__(68483);
10175
- var runner_1 = __nccwpck_require__(4058);
10176
10188
  var fs_1 = __nccwpck_require__(57147);
10189
+ var lodash_1 = __nccwpck_require__(23255);
10177
10190
  var path_1 = __importDefault(__nccwpck_require__(71017));
10178
- var gitlab_1 = __nccwpck_require__(38490);
10191
+ var deploy_1 = __nccwpck_require__(68483);
10179
10192
  var artifactsRegistry_1 = __nccwpck_require__(44963);
10180
10193
  var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(46320);
10194
+ var runner_1 = __nccwpck_require__(4058);
10195
+ var gitlab_1 = __nccwpck_require__(38490);
10181
10196
  var DOCKER_BUILD_RUNNER_REQUESTS = {
10182
10197
  KUBERNETES_CPU_REQUEST: "0.5",
10183
10198
  KUBERNETES_MEMORY_REQUEST: "1Gi",
10184
10199
  KUBERNETES_MEMORY_LIMIT: "2Gi",
10185
10200
  };
10186
10201
  var getDockerImageVariables = function (context) {
10187
- return __assign(__assign({}, ((0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")
10202
+ var _a;
10203
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
10204
+ return __assign(__assign({}, ((0, deploy_1.isOfDeployType)(deployConfig, "google-cloudrun")
10188
10205
  ? {
10189
10206
  DOCKER_REGISTRY: (0, artifactsRegistry_1.getArtifactsRegistryHost)(context),
10190
10207
  DOCKER_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryImageName)(context),
@@ -10203,10 +10220,11 @@ exports.getDockerImageVariables = getDockerImageVariables;
10203
10220
  /**
10204
10221
  * Weather the context requires a docker build
10205
10222
  */
10206
- var requiresDockerBuild = function (_a) {
10207
- var deploy = _a.componentConfig.deploy;
10208
- return (0, deploy_1.isOfDeployType)(deploy, "kubernetes", "google-cloudrun", "dockerTag") ||
10209
- ((0, deploy_1.isOfDeployType)(deploy, "custom") && deploy.requiresDocker);
10223
+ var requiresDockerBuild = function (context) {
10224
+ var _a;
10225
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
10226
+ return ((0, deploy_1.isOfDeployType)(deployConfig, "kubernetes", "google-cloudrun", "dockerTag") ||
10227
+ ((0, deploy_1.isOfDeployType)(deployConfig, "custom") && deployConfig.requiresDocker));
10210
10228
  };
10211
10229
  exports.requiresDockerBuild = requiresDockerBuild;
10212
10230
  // those need to be runner variables
@@ -10232,11 +10250,11 @@ var getDockerAdditions = function (build) {
10232
10250
  };
10233
10251
  };
10234
10252
  var getDockerBuildVariables = function (context) {
10235
- return __assign(__assign(__assign({}, getDockerAdditions(context.componentConfig.build)), { APP_DIR: context.componentConfig.dir, DOCKER_DIR: "." }), (0, exports.getDockerImageVariables)(context));
10253
+ return __assign(__assign(__assign({}, getDockerAdditions(context.build.config)), { APP_DIR: context.build.dir, DOCKER_DIR: "." }), (0, exports.getDockerImageVariables)(context));
10236
10254
  };
10237
10255
  exports.getDockerBuildVariables = getDockerBuildVariables;
10238
10256
  exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
10239
- var getDockerJobBaseProps = function (context) {
10257
+ var getDockerJobBaseProps = function () {
10240
10258
  return {
10241
10259
  image: (0, runner_1.getRunnerImage)("docker-build"),
10242
10260
  services: [
@@ -10252,14 +10270,14 @@ var getDockerJobBaseProps = function (context) {
10252
10270
  exports.getDockerJobBaseProps = getDockerJobBaseProps;
10253
10271
  var createDockerBuildJobBase = function (context, _a) {
10254
10272
  var script = _a.script, def = __rest(_a, ["script"]);
10255
- return (0, lodash_1.merge)(__assign(__assign({ name: exports.DOCKER_BUILD_JOB_NAME, envMode: "jobPerEnv", stage: "build" }, (0, exports.getDockerJobBaseProps)(context)), { script: script || [] }), {
10273
+ return (0, lodash_1.merge)(__assign(__assign({ name: exports.DOCKER_BUILD_JOB_NAME, envMode: "jobPerEnv", stage: "build" }, (0, exports.getDockerJobBaseProps)()), { script: script || [] }), {
10256
10274
  variables: (0, exports.getDockerBuildVariables)(context),
10257
10275
  runnerVariables: __assign(__assign({}, DOCKER_BUILD_RUNNER_REQUESTS), getDockerBuildRunnerVariables()),
10258
10276
  }, def);
10259
10277
  };
10260
10278
  exports.createDockerBuildJobBase = createDockerBuildJobBase;
10261
10279
  var gitlabDockerLogin = function (context) {
10262
- return (0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun")
10280
+ return context.deploy && (0, deploy_1.isOfDeployType)(context.deploy.config, "google-cloudrun")
10263
10281
  ? __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), [
10264
10282
  "gcloud auth configure-docker ".concat((0, artifactsRegistry_1.getArtifactsRegistryHost)(context)),
10265
10283
  ], false) : [
@@ -10296,7 +10314,7 @@ var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
10296
10314
  };
10297
10315
  exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
10298
10316
  var hasDockerfile = function (context) {
10299
- return (0, fs_1.existsSync)(path_1.default.join(context.componentConfig.dir, "Dockerfile"));
10317
+ return (0, fs_1.existsSync)(path_1.default.join(context.build.dir, "Dockerfile"));
10300
10318
  };
10301
10319
  exports.hasDockerfile = hasDockerfile;
10302
10320
  //# sourceMappingURL=docker.js.map
@@ -10417,23 +10435,23 @@ var constants_1 = __nccwpck_require__(31765);
10417
10435
  var yarn_1 = __nccwpck_require__(45043);
10418
10436
  var createNodeBuildJobs = function (context) {
10419
10437
  var _a, _b, _c, _d, _e, _f, _g;
10420
- var buildConfig = context.componentConfig.build;
10438
+ var buildConfig = context.build.config;
10421
10439
  if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
10422
10440
  throw new Error("deploy config is not node, node-static or storybook");
10423
10441
  }
10424
10442
  var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
10425
- var yarnInstall = (0, yarn_1.getYarnInstall)(context);
10443
+ var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
10426
10444
  return (0, base_1.createBuildJobs)(context, {
10427
10445
  appBuild: buildConfig.buildCommand !== null
10428
10446
  ? {
10429
10447
  image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
10430
10448
  runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
10431
- cache: __spreadArray(__spreadArray(__spreadArray([], __read(((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : [])), false), __read((0, cache_1.getNodeCache)(context)), false), __read((0, cache_1.getNextCache)(context)), false),
10449
+ cache: __spreadArray(__spreadArray(__spreadArray([], __read(((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : [])), false), __read((0, cache_1.getNodeCache)(context.build)), false), __read((0, cache_1.getNextCache)(context)), false),
10432
10450
  script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read(((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])), false),
10433
10451
  artifacts: {
10434
10452
  paths: __spreadArray([
10435
- context.componentConfig.dir
10436
- ], __read(((_e = (_d = context.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.currentWorkspaceDependencies) !== null && _e !== void 0 ? _e : [])), false).flatMap(function (dir) {
10453
+ context.build.dir
10454
+ ], __read(((_e = (_d = context.build.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.currentWorkspaceDependencies) !== null && _e !== void 0 ? _e : [])), false).flatMap(function (dir) {
10437
10455
  var _a, _b;
10438
10456
  return __spreadArray([
10439
10457
  (0, path_1.join)(dir, "__build_info.json"),
@@ -10453,11 +10471,11 @@ var createNodeBuildJobs = function (context) {
10453
10471
  script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
10454
10472
  ? "nginx"
10455
10473
  : "node"),
10456
- cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
10474
+ cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.build, "pull")), false),
10457
10475
  variables: {
10458
10476
  // only required for non static
10459
- DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context),
10460
- DOCKER_COPY_WORKSPACE_FILES: (_g = (_f = context.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.pathsToCopyInDocker.map(function (dir) { return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir); })) === null || _g === void 0 ? void 0 : _g.join("\n"),
10477
+ DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context.build),
10478
+ DOCKER_COPY_WORKSPACE_FILES: (_g = (_f = context.build.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.pathsToCopyInDocker.map(function (dir) { return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir); })) === null || _g === void 0 ? void 0 : _g.join("\n"),
10461
10479
  },
10462
10480
  },
10463
10481
  });
@@ -10517,9 +10535,9 @@ var getYarnCache = function (context, policy) {
10517
10535
  paths: [".yarn"],
10518
10536
  }
10519
10537
  : {
10520
- key: (0, slugify_1.default)(context.componentConfig.dir) + "-yarn",
10538
+ key: (0, slugify_1.default)(context.dir) + "-yarn",
10521
10539
  policy: policy,
10522
- paths: [(0, path_1.join)(context.componentConfig.dir, ".yarn")],
10540
+ paths: [(0, path_1.join)(context.dir, ".yarn")],
10523
10541
  },
10524
10542
  ];
10525
10543
  };
@@ -10535,7 +10553,7 @@ var getNodeModulesCache = function (context, policy) {
10535
10553
  // if component is in a shared workspace, use workspace cache. use individual cache else
10536
10554
  key: componentIsInWorkspace
10537
10555
  ? "node-modules-workspace"
10538
- : (0, slugify_1.default)(context.componentConfig.dir) + "-node-modules", // we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
10556
+ : (0, slugify_1.default)(context.dir) + "-node-modules", // we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
10539
10557
  policy: policy,
10540
10558
  paths: __spreadArray([], __read((componentIsInWorkspace
10541
10559
  ? (0, lodash_1.uniq)(__spreadArray([
@@ -10543,7 +10561,7 @@ var getNodeModulesCache = function (context, policy) {
10543
10561
  ], __read(((_c = (_b = context.packageManagerInfo) === null || _b === void 0 ? void 0 : _b.workspaces.map(function (w) {
10544
10562
  return (0, path_1.join)(w.location, "node_modules");
10545
10563
  })) !== null && _c !== void 0 ? _c : [])), false))
10546
- : [(0, path_1.join)(context.componentConfig.dir, "node_modules")])), false),
10564
+ : [(0, path_1.join)(context.dir, "node_modules")])), false),
10547
10565
  },
10548
10566
  ];
10549
10567
  };
@@ -10557,7 +10575,7 @@ var getNextCache = function (context) { return [
10557
10575
  {
10558
10576
  key: context.componentName + "-next-cache",
10559
10577
  policy: "pull-push",
10560
- paths: [context.componentConfig.dir + "/.next/cache/"],
10578
+ paths: [context.build.dir + "/.next/cache/"],
10561
10579
  },
10562
10580
  ]; };
10563
10581
  exports.getNextCache = getNextCache;
@@ -10676,23 +10694,23 @@ var getMeteorCache = function (context) { return [
10676
10694
  key: context.componentName + "meteor-build-cache",
10677
10695
  policy: "pull-push",
10678
10696
  paths: [
10679
- (0, path_1.join)(context.componentConfig.dir, ".meteor/local/resolver-result-cache.json"),
10680
- (0, path_1.join)(context.componentConfig.dir, ".meteor/local/plugin-cache"),
10681
- (0, path_1.join)(context.componentConfig.dir, ".meteor/local/isopacks"),
10682
- (0, path_1.join)(context.componentConfig.dir, ".meteor/local/bundler-cache/scanner"),
10697
+ (0, path_1.join)(context.build.dir, ".meteor/local/resolver-result-cache.json"),
10698
+ (0, path_1.join)(context.build.dir, ".meteor/local/plugin-cache"),
10699
+ (0, path_1.join)(context.build.dir, ".meteor/local/isopacks"),
10700
+ (0, path_1.join)(context.build.dir, ".meteor/local/bundler-cache/scanner"),
10683
10701
  ],
10684
10702
  },
10685
10703
  ]; };
10686
10704
  var createMeteorBuildJobs = function (context) {
10687
- var buildConfig = context.componentConfig.build;
10705
+ var buildConfig = context.build.config;
10688
10706
  if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
10689
10707
  throw new Error("deploy config is not meteor");
10690
10708
  }
10691
- var yarnInstall = (0, yarn_1.getYarnInstall)(context);
10709
+ var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
10692
10710
  return (0, base_1.createBuildJobs)(context, {
10693
10711
  appBuild: buildConfig.buildCommand !== null
10694
10712
  ? {
10695
- cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read(getMeteorCache(context)), false),
10713
+ cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context.build)), false), __read(getMeteorCache(context)), false),
10696
10714
  image: (0, runner_1.getRunnerImage)("jobs-meteor"),
10697
10715
  variables: {
10698
10716
  METEOR_DISABLE_OPTIMISTIC_CACHING: "1", // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
@@ -10706,8 +10724,8 @@ var createMeteorBuildJobs = function (context) {
10706
10724
  ], false),
10707
10725
  artifacts: {
10708
10726
  paths: [
10709
- context.componentConfig.dir + "/__build_info.json",
10710
- context.componentConfig.dir + "/dist",
10727
+ context.build.dir + "/__build_info.json",
10728
+ context.build.dir + "/dist",
10711
10729
  ],
10712
10730
  },
10713
10731
  }
@@ -10781,32 +10799,32 @@ var createNodeTestJobs = function (context) {
10781
10799
  if (context.trigger === "taggedRelease") {
10782
10800
  return [];
10783
10801
  }
10784
- var buildConfig = context.componentConfig.build;
10802
+ var buildConfig = context.build.config;
10785
10803
  var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
10786
10804
  var base = {
10787
- variables: __assign(__assign({ APP_PATH: context.componentConfig.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
10805
+ variables: __assign(__assign({ APP_PATH: context.build.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
10788
10806
  runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
10789
10807
  stage: "test",
10790
10808
  needs: [],
10791
10809
  envMode: "none",
10792
10810
  };
10793
- var yarnInstall = (0, yarn_1.getYarnInstall)(context);
10811
+ var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
10794
10812
  var auditJob = buildConfig.audit !== false
10795
10813
  ? __assign(__assign(__assign({ name: "🛡 audit" }, base), { image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage, cache: undefined, script: __spreadArray([
10796
- "cd ".concat(context.componentConfig.dir)
10814
+ "cd ".concat(context.build.dir)
10797
10815
  ], __read(((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [
10798
- ((_f = context.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.isClassic)
10816
+ ((_f = context.build.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.isClassic)
10799
10817
  ? "yarn audit"
10800
10818
  : "yarn npm audit --environment production", // yarn 2
10801
- ])), false), allow_failure: true }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifactsReports, (_h = buildConfig.audit) === null || _h === void 0 ? void 0 : _h.artifacts)) : null;
10819
+ ])), false), allow_failure: true }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifactsReports, (_h = buildConfig.audit) === null || _h === void 0 ? void 0 : _h.artifacts)) : null;
10802
10820
  var lintJob = buildConfig.lint !== false
10803
- ? __assign(__assign(__assign({ name: "👮 lint" }, base), { image: (_k = (_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.jobImage) !== null && _k !== void 0 ? _k : defaultImage, cache: (0, cache_1.getNodeCache)(context), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), [
10804
- "cd ".concat(context.componentConfig.dir)
10805
- ], false), __read(yarnInstall), false), __read(((_m = (0, utils_1.ensureArray)((_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.command)) !== null && _m !== void 0 ? _m : ["yarn lint"])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifactsReports, (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.artifacts)) : null;
10821
+ ? __assign(__assign(__assign({ name: "👮 lint" }, base), { image: (_k = (_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.jobImage) !== null && _k !== void 0 ? _k : defaultImage, cache: (0, cache_1.getNodeCache)(context.build), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.build)), false), [
10822
+ "cd ".concat(context.build.dir)
10823
+ ], false), __read(yarnInstall), false), __read(((_m = (0, utils_1.ensureArray)((_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.command)) !== null && _m !== void 0 ? _m : ["yarn lint"])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifactsReports, (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.artifacts)) : null;
10806
10824
  var testJob = buildConfig.test !== false
10807
- ? __assign(__assign(__assign({ name: "🧪 test" }, base), { image: (_r = (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.jobImage) !== null && _r !== void 0 ? _r : (0, runner_1.getRunnerImage)("jobs-testing-chrome"), cache: (0, cache_1.getNodeCache)(context), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), [
10808
- "cd ".concat(context.componentConfig.dir)
10809
- ], false), __read(yarnInstall), false), __read(((_t = (0, utils_1.ensureArray)((_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.command)) !== null && _t !== void 0 ? _t : ["yarn test"])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifactsReports, (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.artifacts)) : null;
10825
+ ? __assign(__assign(__assign({ name: "🧪 test" }, base), { image: (_r = (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.jobImage) !== null && _r !== void 0 ? _r : (0, runner_1.getRunnerImage)("jobs-testing-chrome"), cache: (0, cache_1.getNodeCache)(context.build), script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.build)), false), [
10826
+ "cd ".concat(context.build.dir)
10827
+ ], false), __read(yarnInstall), false), __read(((_t = (0, utils_1.ensureArray)((_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.command)) !== null && _t !== void 0 ? _t : ["yarn test"])), false) }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifactsReports, (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.artifacts)) : null;
10810
10828
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
10811
10829
  };
10812
10830
  exports.createNodeTestJobs = createNodeTestJobs;
@@ -10868,9 +10886,7 @@ var ensureNodeVersion = function (context) {
10868
10886
  exports.ensureNodeVersion = ensureNodeVersion;
10869
10887
  var getYarnInstall = function (context, options) {
10870
10888
  var _a;
10871
- var postInstall = "postInstall" in context.componentConfig.build
10872
- ? context.componentConfig.build.postInstall
10873
- : null;
10889
+ var postInstall = "postInstall" in context.config ? context.config.postInstall : null;
10874
10890
  return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), __read((0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(context)])), false), __read((postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall)
10875
10891
  ? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((_a = (0, utils_1.ensureArray)(postInstall)) !== null && _a !== void 0 ? _a : [])
10876
10892
  : [])), false);
@@ -10945,7 +10961,7 @@ var docker_1 = __nccwpck_require__(9641);
10945
10961
  var types_1 = __nccwpck_require__(84466);
10946
10962
  var createRailsBuildJobs = function (context) {
10947
10963
  var _a, _b, _c;
10948
- var buildConfig = context.componentConfig.build;
10964
+ var buildConfig = context.build.config;
10949
10965
  if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
10950
10966
  // should not happen
10951
10967
  throw new Error("build type is not rails");
@@ -10969,10 +10985,10 @@ var createRailsBuildJobs = function (context) {
10969
10985
  return (0, base_1.createBuildJobs)(context, {
10970
10986
  appBuild: undefined,
10971
10987
  dockerBuild: {
10972
- variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.componentConfig.build.extraVars),
10988
+ variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.build.config.extraVars),
10973
10989
  // custom script
10974
10990
  script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
10975
- "cd ".concat(context.componentConfig.dir),
10991
+ "cd ".concat(context.build.dir),
10976
10992
  "docker pull $DOCKER_CACHE_IMAGE || true",
10977
10993
  "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"),
10978
10994
  "chmod +x /usr/local/bin/pack",
@@ -11081,7 +11097,7 @@ var createRailsTestJobs = function (context) {
11081
11097
  if (context.trigger === "taggedRelease") {
11082
11098
  return [];
11083
11099
  }
11084
- var buildConfig = context.componentConfig.build;
11100
+ var buildConfig = context.build.config;
11085
11101
  var base = {
11086
11102
  variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
11087
11103
  stage: "test",
@@ -11103,20 +11119,20 @@ var createRailsTestJobs = function (context) {
11103
11119
  };
11104
11120
  var auditJob = buildConfig.audit !== false
11105
11121
  ? __assign(__assign({ name: "🛡 audit" }, base), { cache: undefined, 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, script: __spreadArray([
11106
- "cd ".concat(context.componentConfig.dir)
11122
+ "cd ".concat(context.build.dir)
11107
11123
  ], __read(((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : [
11108
11124
  "gem install bundler-audit",
11109
11125
  "bundle audit check",
11110
11126
  ])), false), allow_failure: true }) : null;
11111
11127
  var lintJob = buildConfig.lint !== false
11112
11128
  ? __assign(__assign({ name: "👮 lint" }, base), { cache: bundlerCache, 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, script: __spreadArray(__spreadArray([
11113
- "cd ".concat(context.componentConfig.dir)
11129
+ "cd ".concat(context.build.dir)
11114
11130
  ], __read(bundlerInstall), false), __read(((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : [
11115
11131
  "bundle exec rubocop",
11116
11132
  ])), false) }) : null;
11117
11133
  var testJob = buildConfig.test !== false
11118
11134
  ? __assign(__assign({ name: "🧪 test" }, base), { cache: bundlerCache, 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, script: __spreadArray(__spreadArray([
11119
- "cd ".concat(context.componentConfig.dir)
11135
+ "cd ".concat(context.build.dir)
11120
11136
  ], __read(bundlerInstall), false), __read(((_r = (0, utils_1.ensureArray)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : [
11121
11137
  "bundle exec rspec",
11122
11138
  ])), false) }) : null;
@@ -11139,12 +11155,12 @@ exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
11139
11155
  exports.SBOM_FILE = "__sbom.json";
11140
11156
  var createSbomBuildJob = function (context) {
11141
11157
  var _a, _b, _c, _d, _e;
11142
- var buildConfig = context.componentConfig.build;
11158
+ var buildConfig = context.build.config;
11143
11159
  var defaultImage = "aquasec/trivy:0.38.3";
11144
11160
  var defaultScript = [
11145
- "trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace)
11161
+ "trivy fs --quiet --format cyclonedx --output \"".concat(exports.SBOM_FILE, "\" ").concat(((_a = context.build.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace)
11146
11162
  ? "."
11147
- : context.componentConfig.dir),
11163
+ : context.build.dir),
11148
11164
  ];
11149
11165
  var image = buildConfig.type === "custom" && buildConfig.sbom !== false
11150
11166
  ? (_c = (_b = buildConfig.sbom) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage
@@ -11770,7 +11786,7 @@ var sanitize = function (value) {
11770
11786
  };
11771
11787
  var getLabels = function (context) {
11772
11788
  var _a, _b, _c;
11773
- var labels = __assign({ "customer-name": sanitize(context.fullConfig.customerName), "component-name": sanitize(context.componentName), "app-name": sanitize(context.fullConfig.appName), "env-type": sanitize(context.environment.envType), "env-name": sanitize(context.environment.shortName), "build-type": sanitize((_a = context.componentConfig.build) === null || _a === void 0 ? void 0 : _a.type) }, ((_c = (_b = context.fullConfig.meta) === null || _b === void 0 ? void 0 : _b.labels) !== null && _c !== void 0 ? _c : {}));
11789
+ var labels = __assign({ "customer-name": sanitize(context.fullConfig.customerName), "component-name": sanitize(context.componentName), "app-name": sanitize(context.fullConfig.appName), "env-type": sanitize(context.environment.envType), "env-name": sanitize(context.environment.shortName), "build-type": sanitize((_a = context.build.config) === null || _a === void 0 ? void 0 : _a.type) }, ((_c = (_b = context.fullConfig.meta) === null || _b === void 0 ? void 0 : _b.labels) !== null && _c !== void 0 ? _c : {}));
11774
11790
  return labels;
11775
11791
  };
11776
11792
  exports.getLabels = getLabels;
@@ -11809,6 +11825,17 @@ exports.getReviewSlug = getReviewSlug;
11809
11825
 
11810
11826
  "use strict";
11811
11827
 
11828
+ var __assign = (this && this.__assign) || function () {
11829
+ __assign = Object.assign || function(t) {
11830
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
11831
+ s = arguments[i];
11832
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
11833
+ t[p] = s[p];
11834
+ }
11835
+ return t;
11836
+ };
11837
+ return __assign.apply(this, arguments);
11838
+ };
11812
11839
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11813
11840
  if (k2 === undefined) k2 = k;
11814
11841
  var desc = Object.getOwnPropertyDescriptor(m, k);
@@ -11860,7 +11887,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
11860
11887
  }
11861
11888
  };
11862
11889
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11863
- exports.createContext = void 0;
11890
+ exports.createContext = exports.createComponentContext = void 0;
11891
+ var lodash_1 = __nccwpck_require__(23255);
11864
11892
  var build_1 = __nccwpck_require__(67862);
11865
11893
  var deploy_1 = __nccwpck_require__(68483);
11866
11894
  var utils_1 = __nccwpck_require__(32497);
@@ -11868,11 +11896,10 @@ var getEnvironment_1 = __nccwpck_require__(45699);
11868
11896
  var getEnvironmentContext_1 = __nccwpck_require__(13663);
11869
11897
  __exportStar(__nccwpck_require__(45699), exports);
11870
11898
  __exportStar(__nccwpck_require__(45133), exports);
11871
- var createContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
11872
- var envContext, componentConfigWithoutDefaults, defaults, componentConfig;
11873
- var _a;
11874
- return __generator(this, function (_b) {
11875
- switch (_b.label) {
11899
+ var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
11900
+ var envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
11901
+ return __generator(this, function (_a) {
11902
+ switch (_a.label) {
11876
11903
  case 0:
11877
11904
  if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
11878
11905
  throw new Error("componentName may only contain lower case letters, numbers and -");
@@ -11889,21 +11916,41 @@ var createContext = function (ctx) { return __awaiter(void 0, void 0, void 0, fu
11889
11916
  deploy: {},
11890
11917
  };
11891
11918
  componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
11892
- _a = {
11919
+ return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
11920
+ case 1:
11921
+ environment = _a.sent();
11922
+ deploy = componentConfig.deploy, build = componentConfig.build, customJobs = componentConfig.customJobs, dir = componentConfig.dir;
11923
+ context = {
11893
11924
  fullConfig: ctx.config,
11894
11925
  componentConfig: componentConfig,
11895
- componentName: ctx.componentName
11926
+ build: {
11927
+ dir: dir,
11928
+ packageManagerInfo: ctx.packageManagerInfo,
11929
+ config: build,
11930
+ },
11931
+ deploy: deploy
11932
+ ? {
11933
+ config: deploy,
11934
+ }
11935
+ : null,
11936
+ componentName: ctx.componentName,
11937
+ environment: environment,
11938
+ packageManagerInfo: ctx.packageManagerInfo,
11939
+ pipelineType: ctx.pipelineType,
11940
+ trigger: ctx.trigger,
11896
11941
  };
11897
- return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
11898
- case 1: return [2 /*return*/, (_a.environment = _b.sent(),
11899
- _a.packageManagerInfo = ctx.packageManagerInfo,
11900
- _a.pipelineType = ctx.pipelineType,
11901
- _a.trigger = ctx.trigger,
11902
- _a)];
11942
+ resolvedCustomJobs = (0, lodash_1.isFunction)(customJobs)
11943
+ ? customJobs(context)
11944
+ : customJobs;
11945
+ return [2 /*return*/, __assign(__assign({}, context), { customJobs: resolvedCustomJobs })];
11903
11946
  }
11904
11947
  });
11905
11948
  }); };
11906
- exports.createContext = createContext;
11949
+ exports.createComponentContext = createComponentContext;
11950
+ /**
11951
+ * @deprecated use createComponentContext instead
11952
+ */
11953
+ exports.createContext = exports.createComponentContext;
11907
11954
  //# sourceMappingURL=index.js.map
11908
11955
 
11909
11956
  /***/ }),
@@ -12310,7 +12357,7 @@ var stop_1 = __nccwpck_require__(82846);
12310
12357
  var variables_1 = __nccwpck_require__(82422);
12311
12358
  exports.DEPLOY_JOB_NAME = "🚀 Deploy";
12312
12359
  var createDeployJob = function (context, jobDefinition) {
12313
- var _a, _b, _c, _d, _e, _f;
12360
+ var _a, _b, _c, _d, _e, _f, _g;
12314
12361
  var hasDocker = (0, docker_1.requiresDockerBuild)(context);
12315
12362
  var isStoppable = (0, utils_1.contextIsStoppable)(context);
12316
12363
  var autoStop = context.environment.envType === "review"
@@ -12318,14 +12365,13 @@ var createDeployJob = function (context, jobDefinition) {
12318
12365
  : context.environment.envType === "dev"
12319
12366
  ? "4 weeks"
12320
12367
  : undefined;
12368
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
12321
12369
  // if auto or manual is configured explicitly, use that
12322
- var whenDeployDefined = context.componentConfig.deploy && context.componentConfig.deploy.when
12323
- ? context.componentConfig.deploy.when
12324
- : undefined;
12370
+ var whenDeployDefined = deployConfig && deployConfig.when ? deployConfig.when : undefined;
12325
12371
  // otherwise auto deploy if env is not prod. If its prod, deploy automatically if stage is disabled
12326
12372
  var whenDeployDefault = context.environment.envType !== "prod"
12327
12373
  ? "auto" // is not stage, auto deploy
12328
- : ((_a = context.componentConfig.env) === null || _a === void 0 ? void 0 : _a.stage) === false
12374
+ : ((_b = context.componentConfig.env) === null || _b === void 0 ? void 0 : _b.stage) === false
12329
12375
  ? "auto" // is prod, but no staging, auto deploy
12330
12376
  : "manual"; // manually deploy
12331
12377
  var whenDeploy = whenDeployDefined ? whenDeployDefined : whenDeployDefault;
@@ -12339,12 +12385,12 @@ var createDeployJob = function (context, jobDefinition) {
12339
12385
  envMode: "stagePerEnv", // makes it easier to run manual tasks er env
12340
12386
  needs: __spreadArray(__spreadArray([], __read(((0, sbom_2.sbomDeactivated)(context)
12341
12387
  ? []
12342
- : [{ job: sbom_1.SBOM_BUILD_JOB_NAME, artifacts: true }])), false), __read((context.componentConfig.deploy
12343
- ? (_c = (_b = context.componentConfig.deploy.waitFor) === null || _b === void 0 ? void 0 : _b.map(function (c) { return ({
12388
+ : [{ job: sbom_1.SBOM_BUILD_JOB_NAME, artifacts: true }])), false), __read((deployConfig
12389
+ ? (_d = (_c = deployConfig.waitFor) === null || _c === void 0 ? void 0 : _c.map(function (c) { return ({
12344
12390
  componentName: c,
12345
12391
  job: exports.DEPLOY_JOB_NAME,
12346
12392
  artifacts: false,
12347
- }); })) !== null && _c !== void 0 ? _c : []
12393
+ }); })) !== null && _d !== void 0 ? _d : []
12348
12394
  : [])), false),
12349
12395
  // we don't want to deploy when there is a broken test
12350
12396
  needsStages: [
@@ -12360,21 +12406,15 @@ var createDeployJob = function (context, jobDefinition) {
12360
12406
  when: whenDeploy === "auto" ? "on_success" : "manual",
12361
12407
  allow_failure: whenDeploy === "manual" ? true : false,
12362
12408
  stage: "deploy",
12363
- variables: __assign(__assign(__assign(__assign(__assign({}, context.environment.envVars), (hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {})), context.environment.jobOnlyVars.deploy.envVars), (context.componentConfig.deploy
12364
- ? (_d = context.componentConfig.deploy.extraVars) !== null && _d !== void 0 ? _d : {}
12365
- : {})), jobDefinition.variables),
12366
- runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), ((_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {})), (context.componentConfig.deploy
12367
- ? (_f = context.componentConfig.deploy.runnerVariables) !== null && _f !== void 0 ? _f : {}
12368
- : {})),
12409
+ variables: __assign(__assign(__assign(__assign(__assign({}, context.environment.envVars), (hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {})), context.environment.jobOnlyVars.deploy.envVars), (deployConfig ? (_e = deployConfig.extraVars) !== null && _e !== void 0 ? _e : {} : {})), jobDefinition.variables),
12410
+ runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), ((_f = jobDefinition.runnerVariables) !== null && _f !== void 0 ? _f : {})), (deployConfig ? (_g = deployConfig.runnerVariables) !== null && _g !== void 0 ? _g : {} : {})),
12369
12411
  environment: isStoppable
12370
12412
  ? {
12371
12413
  on_stop: stop_1.STOP_JOB_NAME,
12372
12414
  auto_stop_in: autoStop,
12373
12415
  }
12374
12416
  : undefined,
12375
- jobTags: context.componentConfig.deploy
12376
- ? context.componentConfig.deploy.jobTags
12377
- : undefined,
12417
+ jobTags: deployConfig ? deployConfig.jobTags : undefined,
12378
12418
  };
12379
12419
  };
12380
12420
  exports.createDeployJob = createDeployJob;
@@ -12572,17 +12612,18 @@ var BashExpression_1 = __nccwpck_require__(42376);
12572
12612
  var gitlab_1 = __nccwpck_require__(38490);
12573
12613
  var types_1 = __nccwpck_require__(75781);
12574
12614
  var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(74398);
12575
- var getArtifactsRegistryHost = function (_a) {
12576
- var deploy = _a.componentConfig.deploy;
12577
- if (!(0, types_1.isOfDeployType)(deploy, "google-cloudrun")) {
12615
+ var getArtifactsRegistryHost = function (context) {
12616
+ var _a;
12617
+ if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "google-cloudrun")) {
12578
12618
  // should not happen
12579
12619
  throw new Error("deploy config is wrong");
12580
12620
  }
12581
- return "".concat(deploy.region, "-docker.pkg.dev");
12621
+ return "".concat(context.deploy.config.region, "-docker.pkg.dev");
12582
12622
  };
12583
12623
  exports.getArtifactsRegistryHost = getArtifactsRegistryHost;
12584
12624
  var getArtifactsRegistryDockerUrl = function (context) {
12585
- var deployConfig = context.componentConfig.deploy;
12625
+ var _a;
12626
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
12586
12627
  if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
12587
12628
  // should not happen
12588
12629
  throw new Error("deploy config is wrong");
@@ -12645,11 +12686,9 @@ var getDeleteImageCommands = function (fullImageName, keepNewest) {
12645
12686
  * @returns
12646
12687
  */
12647
12688
  var getDeleteUnusedImagesCommands = function (context, keep) {
12689
+ var _a;
12648
12690
  if (keep === void 0) { keep = 0; }
12649
- var deployConfig = context.componentConfig.deploy;
12650
- if (deployConfig === false) {
12651
- return [];
12652
- }
12691
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
12653
12692
  if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
12654
12693
  // should not happen
12655
12694
  throw new Error("deploy config is wrong");
@@ -12740,8 +12779,9 @@ var createArgsString_1 = __nccwpck_require__(49598);
12740
12779
  var getServiceName_1 = __nccwpck_require__(38128);
12741
12780
  var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(74398);
12742
12781
  var getListRevisionsCommand = function (context, args) {
12782
+ var _a;
12743
12783
  var serviceName = (0, getServiceName_1.getServiceName)(context);
12744
- var deployConfig = context.componentConfig.deploy;
12784
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
12745
12785
  if (!deployConfig || !(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
12746
12786
  // should not happen
12747
12787
  throw new Error("deploy config is wrong");
@@ -12753,10 +12793,8 @@ var getListRevisionsCommand = function (context, args) {
12753
12793
  return "gcloud run revisions list ".concat((0, createArgsString_1.createArgsString)(filterRevisionArgs));
12754
12794
  };
12755
12795
  var getDeleteUnusedRevisionsCommands = function (context, keep) {
12756
- var deployConfig = context.componentConfig.deploy;
12757
- if (deployConfig === false) {
12758
- return [];
12759
- }
12796
+ var _a;
12797
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
12760
12798
  if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
12761
12799
  // should not happen
12762
12800
  throw new Error("deploy config is wrong");
@@ -13025,7 +13063,7 @@ var getServiceDeployScript = function (context, service, nameSuffix) {
13025
13063
  var serviceName = (0, getServiceName_1.getServiceName)(context);
13026
13064
  var customConfig = service !== true ? service : undefined;
13027
13065
  var command = service !== true
13028
- ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand
13066
+ ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.build.config.startCommand
13029
13067
  : undefined;
13030
13068
  var commandArray = command
13031
13069
  ? Array.isArray(command)
@@ -13120,7 +13158,8 @@ var makeLabelString = function (obj) {
13120
13158
  };
13121
13159
  exports.makeLabelString = makeLabelString;
13122
13160
  var getCloudRunDeployConfig = function (context) {
13123
- var deployConfig = context.componentConfig.deploy;
13161
+ var _a;
13162
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
13124
13163
  if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
13125
13164
  // should not happen
13126
13165
  throw new Error("deploy config is wrong");
@@ -13302,10 +13341,8 @@ var constants_1 = __nccwpck_require__(38865);
13302
13341
  var getCloudRunDeployScripts_1 = __nccwpck_require__(53695);
13303
13342
  var getCloudRunStopScripts_1 = __nccwpck_require__(33747);
13304
13343
  var createGoogleCloudRunDeployJobs = function (context) {
13305
- var deployConfig = context.componentConfig.deploy;
13306
- if (deployConfig === false) {
13307
- return [];
13308
- }
13344
+ var _a;
13345
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
13309
13346
  if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
13310
13347
  // should not happen
13311
13348
  throw new Error("deploy config is wrong");
@@ -13785,29 +13822,28 @@ var base_1 = __nccwpck_require__(84052);
13785
13822
  var sbom_1 = __nccwpck_require__(44986);
13786
13823
  var types_1 = __nccwpck_require__(75781);
13787
13824
  var createCustomDeployJobs = function (context) {
13788
- var _a, _b, _c;
13789
- var deployConfig = context.componentConfig.deploy;
13790
- if (deployConfig === false) {
13791
- return [];
13792
- }
13825
+ var _a, _b, _c, _d;
13826
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
13793
13827
  if (!(0, types_1.isOfDeployType)(deployConfig, "custom")) {
13794
13828
  // should not happen
13795
13829
  throw new Error("deploy config is not custom");
13796
13830
  }
13797
13831
  // FIXME: custom deploy currently assumes yarn-based project
13798
- var yarnInstall = (0, yarn_1.getYarnInstall)(context, { noCustomPostInstall: true });
13832
+ var yarnInstall = (0, yarn_1.getYarnInstall)(context.build, {
13833
+ noCustomPostInstall: true,
13834
+ });
13799
13835
  return (0, base_1.createDeployementJobs)(context, {
13800
13836
  deploy: {
13801
- image: (_a = deployConfig.jobImage) !== null && _a !== void 0 ? _a : (0, runner_1.getRunnerImage)("jobs-default"),
13802
- cache: (_b = deployConfig.jobCache) !== null && _b !== void 0 ? _b : [],
13837
+ image: (_b = deployConfig.jobImage) !== null && _b !== void 0 ? _b : (0, runner_1.getRunnerImage)("jobs-default"),
13838
+ cache: (_c = deployConfig.jobCache) !== null && _c !== void 0 ? _c : [],
13803
13839
  script: __spreadArray(__spreadArray(__spreadArray([
13804
- "cd ".concat(context.componentConfig.dir)
13840
+ "cd ".concat(context.build.dir)
13805
13841
  ], __read((deployConfig.requiresYarnInstall ? yarnInstall : [])), false), __read(deployConfig.script), false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false),
13806
13842
  variables: {},
13807
13843
  },
13808
13844
  stop: deployConfig.stopScript
13809
13845
  ? {
13810
- image: (_c = deployConfig.jobImage) !== null && _c !== void 0 ? _c : (0, runner_1.getRunnerImage)("jobs-default"),
13846
+ image: (_d = deployConfig.jobImage) !== null && _d !== void 0 ? _d : (0, runner_1.getRunnerImage)("jobs-default"),
13811
13847
  script: __spreadArray(__spreadArray([], __read(deployConfig.stopScript), false), __read((0, sbom_1.getDependencyTrackDeleteScript)(context)), false),
13812
13848
  variables: {},
13813
13849
  }
@@ -13884,17 +13920,15 @@ var docker_1 = __nccwpck_require__(9641);
13884
13920
  var base_1 = __nccwpck_require__(84052);
13885
13921
  var types_1 = __nccwpck_require__(75781);
13886
13922
  var createDockerTagDeployJobs = function (context) {
13887
- var deployConfig = context.componentConfig.deploy;
13888
- if (deployConfig === false) {
13889
- return [];
13890
- }
13923
+ var _a;
13924
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
13891
13925
  if (!(0, types_1.isOfDeployType)(deployConfig, "dockerTag")) {
13892
13926
  // should not happen
13893
13927
  throw new Error("deploy config is not dockerTag");
13894
13928
  }
13895
13929
  var tag = deployConfig.tag;
13896
13930
  return (0, base_1.createDeployementJobs)(context, {
13897
- deploy: __assign(__assign({}, (0, docker_1.getDockerJobBaseProps)(context)), { script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
13931
+ deploy: __assign(__assign({}, (0, docker_1.getDockerJobBaseProps)()), { script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), [
13898
13932
  "docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG",
13899
13933
  "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_IMAGE:".concat(tag),
13900
13934
  "docker push $DOCKER_IMAGE:".concat(tag),
@@ -14006,32 +14040,34 @@ var context_1 = __nccwpck_require__(5875);
14006
14040
  var utils_1 = __nccwpck_require__(62089);
14007
14041
  var types_1 = __nccwpck_require__(75781);
14008
14042
  var hasKubernetesCloudSQL = function (context) {
14009
- var _a, _b;
14010
- if ((0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
14011
- return (_b = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql) === null || _b === void 0 ? void 0 : _b.enabled;
14043
+ var _a, _b, _c;
14044
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
14045
+ if ((0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
14046
+ return (_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.cloudsql) === null || _c === void 0 ? void 0 : _c.enabled;
14012
14047
  }
14013
14048
  return false;
14014
14049
  };
14015
14050
  exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
14016
14051
  var createKubernetesCloudsqlBaseValues = function (context) {
14017
- var _a, _b, _c, _d, _e, _f;
14018
- if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
14052
+ var _a, _b, _c, _d, _e, _f, _g;
14053
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
14054
+ if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
14019
14055
  throw new Error("cannot get cloud sql config");
14020
14056
  }
14021
- var config = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql;
14057
+ var config = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.cloudsql;
14022
14058
  if (!config) {
14023
14059
  throw new Error("cannot get cloud sql config");
14024
14060
  }
14025
14061
  var proxyCredentials = "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"));
14026
14062
  if ((config === null || config === void 0 ? void 0 : config.type) !== "unmanaged") {
14027
- var instanceConnectionName = "".concat((_b = config.projectId) !== null && _b !== void 0 ? _b : "skynet-164509", ":").concat((_c = config.region) !== null && _c !== void 0 ? _c : "europe-west6", ":").concat((_d = config.instanceId) !== null && _d !== void 0 ? _d : context.environment.envVars.KUBE_NAMESPACE);
14063
+ var instanceConnectionName = "".concat((_c = config.projectId) !== null && _c !== void 0 ? _c : "skynet-164509", ":").concat((_d = config.region) !== null && _d !== void 0 ? _d : "europe-west6", ":").concat((_e = config.instanceId) !== null && _e !== void 0 ? _e : context.environment.envVars.KUBE_NAMESPACE);
14028
14064
  return {
14029
14065
  cloudsql: {
14030
14066
  enabled: config.enabled,
14031
14067
  dbUser: "postgres",
14032
14068
  instanceConnectionName: instanceConnectionName,
14033
14069
  proxyCredentials: proxyCredentials,
14034
- fullDbName: (_e = context.environment.envVars.KUBE_APP_NAME) !== null && _e !== void 0 ? _e : "",
14070
+ fullDbName: (_f = context.environment.envVars.KUBE_APP_NAME) !== null && _f !== void 0 ? _f : "",
14035
14071
  },
14036
14072
  };
14037
14073
  }
@@ -14039,7 +14075,7 @@ var createKubernetesCloudsqlBaseValues = function (context) {
14039
14075
  return {
14040
14076
  cloudsql: {
14041
14077
  enabled: config.enabled,
14042
- dbUser: (_f = config.dbUser) !== null && _f !== void 0 ? _f : "postgres",
14078
+ dbUser: (_g = config.dbUser) !== null && _g !== void 0 ? _g : "postgres",
14043
14079
  instanceConnectionName: config.instanceConnectionName,
14044
14080
  proxyCredentials: proxyCredentials,
14045
14081
  fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName),
@@ -14108,11 +14144,8 @@ var bashYaml_1 = __nccwpck_require__(54660);
14108
14144
  var gitlab_1 = __nccwpck_require__(38490);
14109
14145
  var ALL_VALUES_FILE = "__all_values.yml";
14110
14146
  var createKubernetesDeployJobs = function (context) {
14111
- var _a, _b;
14112
- var deployConfig = context.componentConfig.deploy;
14113
- if (deployConfig === false) {
14114
- return [];
14115
- }
14147
+ var _a, _b, _c;
14148
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
14116
14149
  if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
14117
14150
  // should not happen
14118
14151
  throw new Error("deploy config is not kubernetes");
@@ -14126,7 +14159,7 @@ var createKubernetesDeployJobs = function (context) {
14126
14159
  when: "always",
14127
14160
  },
14128
14161
  }
14129
- : {})), { variables: __assign(__assign({}, context.environment.envVars), { RELEASE_NAME: context.environment.fullName, HELM_EXPERIMENTAL_OCI: "1", KUBE_DOCKER_IMAGE_PULL_SECRET: "gitlab-registry-".concat(context.componentName), HELM_GITLAB_CHART_NAME: (_a = deployConfig.chartName) !== null && _a !== void 0 ? _a : "/helm-charts/the-panter-chart", HELM_ARGS: __spreadArray(__spreadArray([], __read((deployConfig.debug ? ["--debug"] : [])), false), __read(((_b = deployConfig.additionalHelmArgs) !== null && _b !== void 0 ? _b : [])), false).join(" "), COMPONENT_NAME: context.componentName,
14162
+ : {})), { variables: __assign(__assign({}, context.environment.envVars), { RELEASE_NAME: context.environment.fullName, HELM_EXPERIMENTAL_OCI: "1", KUBE_DOCKER_IMAGE_PULL_SECRET: "gitlab-registry-".concat(context.componentName), HELM_GITLAB_CHART_NAME: (_b = deployConfig.chartName) !== null && _b !== void 0 ? _b : "/helm-charts/the-panter-chart", HELM_ARGS: __spreadArray(__spreadArray([], __read((deployConfig.debug ? ["--debug"] : [])), false), __read(((_c = deployConfig.additionalHelmArgs) !== null && _c !== void 0 ? _c : [])), false).join(" "), COMPONENT_NAME: context.componentName,
14130
14163
  /** @deprecated */
14131
14164
  BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID }) });
14132
14165
  var clusterName = "kube-".concat(context.environment.fullName);
@@ -14292,7 +14325,8 @@ var shouldGoIntoSecrets = function (key, value) {
14292
14325
  * we evalulate the actual values later, but want to store the secrets in kubernetes secrets
14293
14326
  */
14294
14327
  var createKubeEnv = function (context) {
14295
- if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
14328
+ var _a;
14329
+ if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
14296
14330
  // should not happen
14297
14331
  throw new Error("deploy config is not kubernetes");
14298
14332
  }
@@ -14378,7 +14412,7 @@ var createAppConfig = function (context, application) {
14378
14412
  var _a = application !== null && application !== void 0 ? application : {}, healthRoute = _a.healthRoute, command = _a.command, rest = __rest(_a, ["healthRoute", "command"]);
14379
14413
  return (0, utils_1.mergeWithMergingArrays)({
14380
14414
  host: context.environment.host,
14381
- command: command !== null && command !== void 0 ? command : context.componentConfig.build.startCommand,
14415
+ command: command !== null && command !== void 0 ? command : context.build.config.startCommand,
14382
14416
  livenessProbe: {
14383
14417
  httpGet: {
14384
14418
  path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health",
@@ -14406,9 +14440,9 @@ var removeFalsy = function (record) {
14406
14440
  }));
14407
14441
  };
14408
14442
  var createKubeValues = function (context) {
14409
- var _a, _b;
14410
- var deployConfig = context.componentConfig.deploy;
14411
- if (deployConfig === false) {
14443
+ var _a, _b, _c;
14444
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
14445
+ if (!deployConfig) {
14412
14446
  return [];
14413
14447
  }
14414
14448
  if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
@@ -14418,14 +14452,14 @@ var createKubeValues = function (context) {
14418
14452
  var values = deployConfig.values;
14419
14453
  // we remove the application config because it can be just the value `false` which is a convenience feature, but not supported in the helm chart
14420
14454
  // we only merge the rest of the values in
14421
- var _c = values !== null && values !== void 0 ? values : {}, application = _c.application, jobs = _c.jobs, cronjobs = _c.cronjobs, rest = __rest(_c, ["application", "jobs", "cronjobs"]);
14455
+ var _d = values !== null && values !== void 0 ? values : {}, application = _d.application, jobs = _d.jobs, cronjobs = _d.cronjobs, rest = __rest(_d, ["application", "jobs", "cronjobs"]);
14422
14456
  var env = (0, kubeEnv_1.createKubeEnv)(context);
14423
14457
  var defaultKubeValues = (0, lodash_1.merge)({
14424
14458
  env: env,
14425
14459
  application: createAppConfig(context, application),
14426
14460
  }, (0, cloudSql_1.hasKubernetesCloudSQL)(context)
14427
14461
  ? (0, cloudSql_1.createKubernetesCloudsqlBaseValues)(context)
14428
- : {}, ((_b = (_a = deployConfig.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled)
14462
+ : {}, ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled)
14429
14463
  ? (0, mongodb_1.createMongodbBaseConfig)(context)
14430
14464
  : {});
14431
14465
  var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, __assign({ jobs: removeFalsy(jobs), cronjobs: removeFalsy(cronjobs) }, rest)));
@@ -14473,15 +14507,15 @@ var getMongodbReplicasetHost = function (context, index) {
14473
14507
  return getMongodbHost(context, "".concat(fullAppname, "-mongodb-").concat(index, ".").concat(fullAppname, "-mongodb-headless"));
14474
14508
  };
14475
14509
  var createMongodbUrl = function (context, dbName) {
14476
- var _a, _b;
14477
- if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
14510
+ var _a, _b, _c, _d;
14511
+ if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
14478
14512
  throw new Error("can only createMongodbUrl on supported deploys");
14479
14513
  }
14480
- var mongodbConfig = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.mongodb;
14514
+ var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
14481
14515
  var queryParams = undefined;
14482
14516
  var hosts = "";
14483
14517
  if ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset") {
14484
- hosts = (0, lodash_1.range)(0, (_b = mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.replicaCount) !== null && _b !== void 0 ? _b : 2)
14518
+ hosts = (0, lodash_1.range)(0, (_d = mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.replicaCount) !== null && _d !== void 0 ? _d : 2)
14485
14519
  .map(function (i) { return getMongodbReplicasetHost(context, i); })
14486
14520
  .join(",");
14487
14521
  queryParams = "replicaSet=rs0&authSource=admin";
@@ -14493,11 +14527,11 @@ var createMongodbUrl = function (context, dbName) {
14493
14527
  return "mongodb://".concat(getCredentialString(context)).concat(hosts, "/").concat(dbName).concat(queryParams ? "?".concat(queryParams) : "");
14494
14528
  };
14495
14529
  var createMongoBackupDefaultConfig = function (context) {
14496
- var _a;
14497
- if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
14530
+ var _a, _b, _c;
14531
+ if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
14498
14532
  throw new Error("can only create mongodb base config on supported deploys");
14499
14533
  }
14500
- var mongodbConfig = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.mongodb;
14534
+ var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
14501
14535
  var fullAppName = context.environment.envVars.KUBE_APP_NAME;
14502
14536
  var backupEnabled = ["prod", "stage"].includes(context.environment.envType);
14503
14537
  var hostToBackup;
@@ -14527,11 +14561,11 @@ var createMongoBackupDefaultConfig = function (context) {
14527
14561
  };
14528
14562
  };
14529
14563
  var createMongodbBaseConfig = function (context) {
14530
- var _a, _b;
14531
- if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
14564
+ var _a, _b, _c, _d;
14565
+ if (!(0, types_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
14532
14566
  throw new Error("can only create mongodb base config on supported deploys");
14533
14567
  }
14534
- var mongodbConfig = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.mongodb;
14568
+ var mongodbConfig = (_c = (_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.values) === null || _c === void 0 ? void 0 : _c.mongodb;
14535
14569
  return {
14536
14570
  mongodb: {
14537
14571
  enabled: true,
@@ -14546,7 +14580,7 @@ var createMongodbBaseConfig = function (context) {
14546
14580
  backup: createMongoBackupDefaultConfig(context),
14547
14581
  },
14548
14582
  env: {
14549
- secret: __assign({ MONGO_URL: createMongodbUrl(context, (_b = mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.dbName) !== null && _b !== void 0 ? _b : "app") }, ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset"
14583
+ secret: __assign({ MONGO_URL: createMongodbUrl(context, (_d = mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.dbName) !== null && _d !== void 0 ? _d : "app") }, ((mongodbConfig === null || mongodbConfig === void 0 ? void 0 : mongodbConfig.architecture) === "replicaset"
14550
14584
  ? { MONGO_OPLOG_URL: createMongodbUrl(context, "local") } // oplog only works with replicasets
14551
14585
  : {})),
14552
14586
  },
@@ -14602,8 +14636,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
14602
14636
  exports.getDependencyTrackDeleteScript = exports.getDependencyTrackUploadScript = exports.sbomDeactivated = void 0;
14603
14637
  var sbom_1 = __nccwpck_require__(37038);
14604
14638
  var sbomDeactivated = function (context) {
14605
- return context.componentConfig.build.type === "custom" &&
14606
- context.componentConfig.build.sbom === false;
14639
+ return context.build.config.type === "custom" && context.build.config.sbom === false;
14607
14640
  };
14608
14641
  exports.sbomDeactivated = sbomDeactivated;
14609
14642
  var getDependencyTrackUploadScript = function (context) {
@@ -14688,7 +14721,7 @@ var isOfDeployType = function (t) {
14688
14721
  for (var _i = 1; _i < arguments.length; _i++) {
14689
14722
  types[_i - 1] = arguments[_i];
14690
14723
  }
14691
- return t && types.includes(t.type);
14724
+ return t && types.includes(t.type) ? true : false;
14692
14725
  };
14693
14726
  exports.isOfDeployType = isOfDeployType;
14694
14727
  //# sourceMappingURL=index.js.map
@@ -14724,7 +14757,8 @@ var getKubernetesNamespace = function (config, env) {
14724
14757
  };
14725
14758
  exports.getKubernetesNamespace = getKubernetesNamespace;
14726
14759
  var contextIsStoppable = function (context) {
14727
- var deployConfig = context.componentConfig.deploy;
14760
+ var _a;
14761
+ var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
14728
14762
  if ((0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
14729
14763
  return true;
14730
14764
  }
@@ -15060,7 +15094,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
15060
15094
  };
15061
15095
  Object.defineProperty(exports, "__esModule", ({ value: true }));
15062
15096
  exports.createJobsForComponent = void 0;
15063
- var lodash_1 = __nccwpck_require__(23255);
15064
15097
  var build_1 = __nccwpck_require__(67862);
15065
15098
  var context_1 = __nccwpck_require__(5875);
15066
15099
  var deploy_1 = __nccwpck_require__(68483);
@@ -15073,18 +15106,17 @@ var injectDefaultVarsInCustomJobs = function (context, jobs) {
15073
15106
  });
15074
15107
  };
15075
15108
  var getCustomJobs = function (context) {
15076
- if (!context.componentConfig.customJobs) {
15109
+ if (!context.customJobs) {
15077
15110
  return [];
15078
15111
  }
15079
- var rawJobs = (0, lodash_1.isFunction)(context.componentConfig.customJobs)
15080
- ? context.componentConfig.customJobs(context)
15081
- : context.componentConfig.customJobs;
15112
+ var rawJobs = context.customJobs;
15082
15113
  return injectDefaultVarsInCustomJobs(context, rawJobs);
15083
15114
  };
15084
15115
  var createRawJobs = function (context) {
15085
- var buildJobs = build_1.BUILD_TYPES[context.componentConfig.build.type].jobs(context);
15086
- var deployJobs = context.componentConfig.deploy !== false
15087
- ? deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context)
15116
+ var _a, _b;
15117
+ var buildJobs = build_1.BUILD_TYPES[context.build.config.type].jobs(context);
15118
+ var deployJobs = ((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config)
15119
+ ? deploy_1.DEPLOY_TYPES[(_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.type].jobs(context)
15088
15120
  : [];
15089
15121
  var customJobs = getCustomJobs(context);
15090
15122
  return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
@@ -15096,7 +15128,7 @@ var createJobsForComponent = function (contextContext) { return __awaiter(void 0
15096
15128
  case 0: return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfo)(contextContext.config, contextContext.componentName)];
15097
15129
  case 1:
15098
15130
  packageManagerInfo = _a.sent();
15099
- return [4 /*yield*/, (0, context_1.createContext)(__assign(__assign({}, contextContext), { packageManagerInfo: packageManagerInfo }))];
15131
+ return [4 /*yield*/, (0, context_1.createComponentContext)(__assign(__assign({}, contextContext), { packageManagerInfo: packageManagerInfo }))];
15100
15132
  case 2:
15101
15133
  context = _a.sent();
15102
15134
  return [2 /*return*/, createRawJobs(context).map(function (job) { return (__assign(__assign({}, job), { context: context })); })];