@catladder/cli 0.0.0-main-bf628b7e → 0.0.0-main-718a0caa

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 (135) hide show
  1. package/dist/bundles/catenv/index.js +887 -272
  2. package/dist/bundles/cli/index.js +901 -318
  3. package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js +2 -2
  4. package/dist/cli/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js.map +1 -1
  5. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js +2 -2
  6. package/dist/cli/src/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
  7. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js +1 -1
  8. package/dist/cli/src/apps/cli/commands/project/setup/setupCloudRun.js.map +1 -1
  9. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js +2 -10
  10. package/dist/cli/src/apps/cli/commands/project/setup/setupContext.js.map +1 -1
  11. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js +2 -2
  12. package/dist/cli/src/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
  13. package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js +2 -26
  14. package/dist/cli/src/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
  15. package/dist/cli/src/gcloud/serviceAccounts.js +3 -3
  16. package/dist/cli/src/gcloud/serviceAccounts.js.map +1 -1
  17. package/dist/pipeline/src/build/artifacts/createBuildJobArtifact.d.ts +3 -0
  18. package/dist/pipeline/src/build/artifacts/createBuildJobArtifact.js +81 -0
  19. package/dist/pipeline/src/build/artifacts/createBuildJobArtifact.js.map +1 -0
  20. package/dist/pipeline/src/build/base/createAppBuildJob.d.ts +3 -3
  21. package/dist/pipeline/src/build/base/createAppBuildJob.js +14 -13
  22. package/dist/pipeline/src/build/base/createAppBuildJob.js.map +1 -1
  23. package/dist/pipeline/src/build/base/index.d.ts +6 -2
  24. package/dist/pipeline/src/build/base/index.js +23 -5
  25. package/dist/pipeline/src/build/base/index.js.map +1 -1
  26. package/dist/pipeline/src/build/base/writeDotEnv.js +3 -2
  27. package/dist/pipeline/src/build/base/writeDotEnv.js.map +1 -1
  28. package/dist/pipeline/src/build/custom/buildJob.js +2 -12
  29. package/dist/pipeline/src/build/custom/buildJob.js.map +1 -1
  30. package/dist/pipeline/src/build/docker.js +6 -6
  31. package/dist/pipeline/src/build/docker.js.map +1 -1
  32. package/dist/pipeline/src/build/index.d.ts +14 -5
  33. package/dist/pipeline/src/build/index.js +23 -3
  34. package/dist/pipeline/src/build/index.js.map +1 -1
  35. package/dist/pipeline/src/build/node/buildJob.d.ts +7 -2
  36. package/dist/pipeline/src/build/node/buildJob.js +44 -42
  37. package/dist/pipeline/src/build/node/buildJob.js.map +1 -1
  38. package/dist/pipeline/src/build/node/cache.d.ts +2 -2
  39. package/dist/pipeline/src/build/node/cache.js +17 -9
  40. package/dist/pipeline/src/build/node/cache.js.map +1 -1
  41. package/dist/pipeline/src/build/node/index.d.ts +2 -2
  42. package/dist/pipeline/src/build/node/index.js.map +1 -1
  43. package/dist/pipeline/src/build/node/meteor.js +2 -8
  44. package/dist/pipeline/src/build/node/meteor.js.map +1 -1
  45. package/dist/pipeline/src/build/node/testJob.d.ts +3 -2
  46. package/dist/pipeline/src/build/node/testJob.js +10 -3
  47. package/dist/pipeline/src/build/node/testJob.js.map +1 -1
  48. package/dist/pipeline/src/build/node/yarn.js +1 -1
  49. package/dist/pipeline/src/build/node/yarn.js.map +1 -1
  50. package/dist/pipeline/src/build/rails/build.d.ts +1 -1
  51. package/dist/pipeline/src/build/rails/build.js +7 -2
  52. package/dist/pipeline/src/build/rails/build.js.map +1 -1
  53. package/dist/pipeline/src/build/rails/test.d.ts +1 -1
  54. package/dist/pipeline/src/build/rails/test.js +5 -0
  55. package/dist/pipeline/src/build/rails/test.js.map +1 -1
  56. package/dist/pipeline/src/build/sbom.js +7 -2
  57. package/dist/pipeline/src/build/sbom.js.map +1 -1
  58. package/dist/pipeline/src/build/types.d.ts +49 -5
  59. package/dist/pipeline/src/build/types.js +9 -1
  60. package/dist/pipeline/src/build/types.js.map +1 -1
  61. package/dist/pipeline/src/context/createAllComponentsContext.d.ts +8 -0
  62. package/dist/pipeline/src/context/createAllComponentsContext.js +68 -0
  63. package/dist/pipeline/src/context/createAllComponentsContext.js.map +1 -0
  64. package/dist/pipeline/src/context/createComponentContext.d.ts +0 -4
  65. package/dist/pipeline/src/context/createComponentContext.js +81 -19
  66. package/dist/pipeline/src/context/createComponentContext.js.map +1 -1
  67. package/dist/pipeline/src/context/createWorkspaceContext.d.ts +9 -0
  68. package/dist/pipeline/src/context/createWorkspaceContext.js +86 -0
  69. package/dist/pipeline/src/context/createWorkspaceContext.js.map +1 -0
  70. package/dist/pipeline/src/context/getBuildInfoVariables.d.ts +1 -1
  71. package/dist/pipeline/src/context/getBuildInfoVariables.js.map +1 -1
  72. package/dist/pipeline/src/context/getEnvironmentContext.d.ts +1 -1
  73. package/dist/pipeline/src/context/getEnvironmentVariables.d.ts +1 -1
  74. package/dist/pipeline/src/context/getEnvironmentVariables.js +10 -6
  75. package/dist/pipeline/src/context/getEnvironmentVariables.js.map +1 -1
  76. package/dist/pipeline/src/context/getLabels.js +2 -2
  77. package/dist/pipeline/src/context/getLabels.js.map +1 -1
  78. package/dist/pipeline/src/deploy/base/deploy.d.ts +1 -1
  79. package/dist/pipeline/src/deploy/base/deploy.js +29 -6
  80. package/dist/pipeline/src/deploy/base/deploy.js.map +1 -1
  81. package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js +3 -3
  82. package/dist/pipeline/src/deploy/cloudRun/artifactsRegistry.js.map +1 -1
  83. package/dist/pipeline/src/deploy/cloudRun/createJobs/common.d.ts +4 -4
  84. package/dist/pipeline/src/deploy/cloudRun/createJobs/common.js.map +1 -1
  85. package/dist/pipeline/src/deploy/cloudRun/index.d.ts +2 -2
  86. package/dist/pipeline/src/deploy/cloudRun/index.js.map +1 -1
  87. package/dist/pipeline/src/deploy/custom/index.d.ts +2 -2
  88. package/dist/pipeline/src/deploy/custom/index.js.map +1 -1
  89. package/dist/pipeline/src/deploy/dockerTag/index.d.ts +2 -2
  90. package/dist/pipeline/src/deploy/dockerTag/index.js.map +1 -1
  91. package/dist/pipeline/src/deploy/index.d.ts +7 -7
  92. package/dist/pipeline/src/deploy/index.js.map +1 -1
  93. package/dist/pipeline/src/deploy/kubernetes/additionalSecretKeys.d.ts +3 -1
  94. package/dist/pipeline/src/deploy/kubernetes/additionalSecretKeys.js.map +1 -1
  95. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js +1 -1
  96. package/dist/pipeline/src/deploy/kubernetes/cloudSql/index.js.map +1 -1
  97. package/dist/pipeline/src/deploy/kubernetes/deployJob.js +1 -1
  98. package/dist/pipeline/src/deploy/kubernetes/deployJob.js.map +1 -1
  99. package/dist/pipeline/src/deploy/kubernetes/index.d.ts +2 -2
  100. package/dist/pipeline/src/deploy/kubernetes/index.js.map +1 -1
  101. package/dist/pipeline/src/deploy/sbom.d.ts +1 -1
  102. package/dist/pipeline/src/deploy/sbom.js +6 -3
  103. package/dist/pipeline/src/deploy/sbom.js.map +1 -1
  104. package/dist/pipeline/src/pipeline/createAllJobs.d.ts +12 -10
  105. package/dist/pipeline/src/pipeline/createAllJobs.js +84 -44
  106. package/dist/pipeline/src/pipeline/createAllJobs.js.map +1 -1
  107. package/dist/pipeline/src/pipeline/createChildPipeline.js.map +1 -1
  108. package/dist/pipeline/src/pipeline/createJobsForComponent.js +3 -4
  109. package/dist/pipeline/src/pipeline/createJobsForComponent.js.map +1 -1
  110. package/dist/pipeline/src/pipeline/createJobsForWorkspace.d.ts +3 -0
  111. package/dist/pipeline/src/pipeline/createJobsForWorkspace.js +10 -0
  112. package/dist/pipeline/src/pipeline/createJobsForWorkspace.js.map +1 -0
  113. package/dist/pipeline/src/pipeline/createMainPipeline.js +18 -8
  114. package/dist/pipeline/src/pipeline/createMainPipeline.js.map +1 -1
  115. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.d.ts +3 -3
  116. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js +158 -51
  117. package/dist/pipeline/src/pipeline/gitlab/createGitlabJobs.js.map +1 -1
  118. package/dist/pipeline/src/pipeline/packageManager.d.ts +2 -1
  119. package/dist/pipeline/src/pipeline/packageManager.js +36 -15
  120. package/dist/pipeline/src/pipeline/packageManager.js.map +1 -1
  121. package/dist/pipeline/src/types/config.d.ts +2 -1
  122. package/dist/pipeline/src/types/context.d.ts +80 -12
  123. package/dist/pipeline/src/types/context.js +9 -0
  124. package/dist/pipeline/src/types/context.js.map +1 -1
  125. package/dist/pipeline/src/types/environmentContext.d.ts +5 -6
  126. package/dist/pipeline/src/types/jobs.d.ts +5 -0
  127. package/dist/tsconfig.tsbuildinfo +1 -1
  128. package/package.json +1 -1
  129. package/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts +4 -4
  130. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +2 -10
  131. package/src/apps/cli/commands/project/setup/setupCloudRun.ts +2 -2
  132. package/src/apps/cli/commands/project/setup/setupContext.ts +2 -14
  133. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +3 -3
  134. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +3 -16
  135. package/src/gcloud/serviceAccounts.ts +4 -4
@@ -1828,7 +1828,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
1828
1828
  return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(sourceEnv, sourceComponent)];
1829
1829
  case 3:
1830
1830
  sourceContext = _g.sent();
1831
- return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(this, sourceContext.environment.shortName, sourceContext.componentName)];
1831
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(this, sourceContext.env, sourceContext.name)];
1832
1832
  case 4:
1833
1833
  sourceEnvVars = _g.sent();
1834
1834
  closeAll = function () {
@@ -1870,7 +1870,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
1870
1870
  return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(targetEnv, targetComponent)];
1871
1871
  case 9:
1872
1872
  targetContext = _g.sent();
1873
- return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(this, targetContext.environment.shortName, targetContext.componentName)];
1873
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(this, targetContext.env, targetContext.name)];
1874
1874
  case 10:
1875
1875
  targetEnvVars = _g.sent();
1876
1876
  if (!(targetEnv === "local")) return [3 /*break*/, 11];
@@ -2081,7 +2081,7 @@ var getProxyInfoForKubernetes = function (vorpal, context) { return __awaiter(vo
2081
2081
  if (!(0, pipeline_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "kubernetes")) {
2082
2082
  throw new Error("unsupported");
2083
2083
  }
2084
- return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.environment.shortName, context.componentName)];
2084
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.env, context.name)];
2085
2085
  case 1:
2086
2086
  envVars = _b.sent();
2087
2087
  cloudSqlValues = (0, pipeline_1.createKubernetesCloudsqlBaseValues)(context);
@@ -2107,7 +2107,7 @@ var getProxyInfoForCloudRun = function (vorpal, context) { return __awaiter(void
2107
2107
  !((_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.cloudSql)) {
2108
2108
  throw new Error("unsupported");
2109
2109
  }
2110
- return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.environment.shortName, context.componentName)];
2110
+ return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(vorpal, context.env, context.name)];
2111
2111
  case 1:
2112
2112
  envVars = _d.sent();
2113
2113
  DB_PASSWORD = envVars === null || envVars === void 0 ? void 0 : envVars.DB_PASSWORD;
@@ -5414,7 +5414,7 @@ var setupCloudRun = function (instance, context) { return __awaiter(void 0, void
5414
5414
  instance.log("domain suffix: " + suffix);
5415
5415
  return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, (_a = {},
5416
5416
  _a[pipeline_1.GCLOUD_RUN_CANONICAL_HOST_SUFFIX] = suffix,
5417
- _a), context.environment.shortName, context.componentName, false, // backup
5417
+ _a), context.env, context.name, false, // backup
5418
5418
  false)];
5419
5419
  case 5:
5420
5420
  _d.sent();
@@ -5481,11 +5481,7 @@ var setupContext = function (instance, context) { return __awaiter(void 0, void
5481
5481
  case 0:
5482
5482
  instance.log("");
5483
5483
  instance.log("==================================================================================");
5484
- instance.log("🐱 🔧 setting up " +
5485
- context.environment.shortName +
5486
- ":" +
5487
- context.componentName +
5488
- "...");
5484
+ instance.log("🐱 🔧 setting up " + context.env + ":" + context.name + "...");
5489
5485
  instance.log("");
5490
5486
  if (!(0, pipeline_1.isOfDeployType)((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config, "google-cloudrun")) return [3 /*break*/, 2];
5491
5487
  return [4 /*yield*/, (0, setupCloudRun_1.setupCloudRun)(instance, context)];
@@ -5501,11 +5497,7 @@ var setupContext = function (instance, context) { return __awaiter(void 0, void
5501
5497
  _c.label = 4;
5502
5498
  case 4:
5503
5499
  instance.log("");
5504
- instance.log("✅ " +
5505
- context.environment.shortName +
5506
- ":" +
5507
- context.componentName +
5508
- " done!");
5500
+ instance.log("✅ " + context.env + ":" + context.name + " done!");
5509
5501
  instance.log("");
5510
5502
  return [2 /*return*/];
5511
5503
  }
@@ -5610,7 +5602,7 @@ var setupKubernetes = function (instance, context) { return __awaiter(void 0, vo
5610
5602
  // we name the service account and the role and the role binding with the same name
5611
5603
  // we currently create one per component to better separate them
5612
5604
  instance.log("ensuring service accounts...");
5613
- serviceAccountName = "cl-".concat(context.componentName, "-deploy");
5605
+ serviceAccountName = "cl-".concat(context.name, "-deploy");
5614
5606
  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(); })];
5615
5607
  case 7:
5616
5608
  KUBE_URL = _b.sent();
@@ -5666,7 +5658,7 @@ var setupKubernetes = function (instance, context) { return __awaiter(void 0, vo
5666
5658
  instance.log("service accounts created / updated!");
5667
5659
  instance.log("");
5668
5660
  instance.log("pusing secrets to gitlab...");
5669
- return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, vars, context.environment.shortName, context.componentName, false)];
5661
+ return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, vars, context.env, context.name, false)];
5670
5662
  case 19:
5671
5663
  _b.sent();
5672
5664
  instance.log("done!");
@@ -6034,22 +6026,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
6034
6026
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
6035
6027
  }
6036
6028
  };
6037
- var __read = (this && this.__read) || function (o, n) {
6038
- var m = typeof Symbol === "function" && o[Symbol.iterator];
6039
- if (!m) return o;
6040
- var i = m.call(o), r, ar = [], e;
6041
- try {
6042
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
6043
- }
6044
- catch (error) { e = { error: error }; }
6045
- finally {
6046
- try {
6047
- if (r && !r.done && (m = i["return"])) m.call(i);
6048
- }
6049
- finally { if (e) throw e.error; }
6050
- }
6051
- return ar;
6052
- };
6053
6029
  Object.defineProperty(exports, "__esModule", ({ value: true }));
6054
6030
  var pipeline_1 = __nccwpck_require__(10603);
6055
6031
  var client_node_1 = __nccwpck_require__(15124);
@@ -6061,19 +6037,11 @@ function default_1(context) {
6061
6037
  return __generator(this, function (_f) {
6062
6038
  switch (_f.label) {
6063
6039
  case 0:
6064
- namespace = (0, pipeline_1.getKubernetesNamespace)(context.fullConfig, context.environment.shortName);
6040
+ namespace = (0, pipeline_1.getKubernetesNamespace)(context.fullConfig, context.env);
6065
6041
  namespaceBody = new client_node_1.V1Namespace();
6066
6042
  metadata = {
6067
6043
  name: namespace,
6068
- labels: __assign(__assign({ customerName: context.fullConfig.customerName, appName: context.fullConfig.appName, environment: context.environment.shortName, components: Object.keys(context.fullConfig.components).join("_"), buildTypes: Object.values(context.fullConfig.components)
6069
- .map(function (config) { return config.build.type; })
6070
- .join("_") }, Object.fromEntries(Object.entries(context.fullConfig.components).map(function (_a) {
6071
- var _b = __read(_a, 2), componentName = _b[0], config = _b[1];
6072
- return [
6073
- "buildType_" + componentName,
6074
- config.build.type,
6075
- ];
6076
- }))), ((_b = (_a = context.fullConfig.meta) === null || _a === void 0 ? void 0 : _a.labels) !== null && _b !== void 0 ? _b : {})),
6044
+ labels: __assign({ customerName: context.fullConfig.customerName, appName: context.fullConfig.appName, environment: context.env, components: Object.keys(context.fullConfig.components).join("_") }, ((_b = (_a = context.fullConfig.meta) === null || _a === void 0 ? void 0 : _a.labels) !== null && _b !== void 0 ? _b : {})),
6077
6045
  };
6078
6046
  namespaceBody.metadata = metadata;
6079
6047
  k8sApi = (0, k8sApi_1.getk8sApi)();
@@ -7525,7 +7493,7 @@ var upsertGcloudServiceAccount = function (context, account) { return __awaiter(
7525
7493
  case 0:
7526
7494
  projectId = account.projectId, name = account.name, displayName = account.displayName, roles = account.roles, description = account.description;
7527
7495
  namePrefix = "".concat(name);
7528
- nameSuffixRaw = "".concat(context.environment.shortName, "-").concat(context.componentName);
7496
+ nameSuffixRaw = "".concat(context.env, "-").concat(context.name);
7529
7497
  nameMiddleRaw = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName);
7530
7498
  MAX_LENGTH = 30;
7531
7499
  NUM_SEPARATORS = 2;
@@ -7539,7 +7507,7 @@ var upsertGcloudServiceAccount = function (context, account) { return __awaiter(
7539
7507
  nameSuffix = nameSuffixRaw;
7540
7508
  }
7541
7509
  fullName = "".concat(namePrefix, "-").concat(nameMiddle, "-").concat(nameSuffix);
7542
- fullDisplayName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, " ").concat(context.environment.shortName, ":").concat(context.componentName, " | ").concat(displayName);
7510
+ fullDisplayName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, " ").concat(context.env, ":").concat(context.name, " | ").concat(displayName);
7543
7511
  fullIdentifier = "".concat(fullName, "@").concat(projectId, ".iam.gserviceaccount.com");
7544
7512
  return [4 /*yield*/, (0, exports.accountExists)(fullIdentifier)];
7545
7513
  case 1:
@@ -7625,7 +7593,7 @@ var upsertGcloudServiceAccountAndSaveSecret = function (instance, context, accou
7625
7593
  key = _b.sent();
7626
7594
  return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, (_a = {},
7627
7595
  _a[secretName] = key,
7628
- _a), context.environment.shortName, context.componentName)];
7596
+ _a), context.env, context.name)];
7629
7597
  case 2:
7630
7598
  _b.sent();
7631
7599
  instance.log("done!");
@@ -9708,6 +9676,94 @@ exports["default"] = replaceAsync;
9708
9676
 
9709
9677
  /***/ }),
9710
9678
 
9679
+ /***/ 43397:
9680
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
9681
+
9682
+ "use strict";
9683
+
9684
+ var __assign = (this && this.__assign) || function () {
9685
+ __assign = Object.assign || function(t) {
9686
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
9687
+ s = arguments[i];
9688
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
9689
+ t[p] = s[p];
9690
+ }
9691
+ return t;
9692
+ };
9693
+ return __assign.apply(this, arguments);
9694
+ };
9695
+ var __read = (this && this.__read) || function (o, n) {
9696
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
9697
+ if (!m) return o;
9698
+ var i = m.call(o), r, ar = [], e;
9699
+ try {
9700
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
9701
+ }
9702
+ catch (error) { e = { error: error }; }
9703
+ finally {
9704
+ try {
9705
+ if (r && !r.done && (m = i["return"])) m.call(i);
9706
+ }
9707
+ finally { if (e) throw e.error; }
9708
+ }
9709
+ return ar;
9710
+ };
9711
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
9712
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
9713
+ if (ar || !(i in from)) {
9714
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
9715
+ ar[i] = from[i];
9716
+ }
9717
+ }
9718
+ return to.concat(ar || Array.prototype.slice.call(from));
9719
+ };
9720
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9721
+ exports.createBuildJobArtifacts = void 0;
9722
+ var path_1 = __nccwpck_require__(71017);
9723
+ var types_1 = __nccwpck_require__(11853);
9724
+ var lodash_1 = __nccwpck_require__(23255);
9725
+ var writeDotEnv_1 = __nccwpck_require__(48052);
9726
+ var createBuildJobArtifacts = function (context) {
9727
+ var _a, _b;
9728
+ var paths = context.type === "workspace"
9729
+ ? context.components.flatMap(function (c) { return getArtifactsPathForComponent(c); })
9730
+ : getArtifactsPathForComponent(context, ["__build_info.json"]);
9731
+ // esxclude .env files if generated
9732
+ var exclude = context.type === "workspace"
9733
+ ? context.components.flatMap(function (c) { return getDotEnvPathsForComponent(c); })
9734
+ : getDotEnvPathsForComponent(context);
9735
+ return __assign(__assign({ paths: (0, lodash_1.uniq)(paths).sort(function (a, b) { return a.localeCompare(b); }) }, (exclude.length > 0 ? { exclude: exclude } : {})), { expire_in: "1 day", when: "always", reports:
9736
+ // TODO: support for junit reports in other builds
9737
+ context.type === "component" && (0, types_1.componentContextIsStandaloneBuild)(context)
9738
+ ? {
9739
+ junit: (_b = (_a = context.build.config.artifactsReports) === null || _a === void 0 ? void 0 : _a.junit) === null || _b === void 0 ? void 0 : _b.map(function (p) {
9740
+ return (0, path_1.join)(context.build.dir, p);
9741
+ }),
9742
+ }
9743
+ : {} });
9744
+ };
9745
+ exports.createBuildJobArtifacts = createBuildJobArtifacts;
9746
+ var getArtifactsPathForComponent = function (c, additionalPaths) {
9747
+ var _a, _b;
9748
+ return (_b = __spreadArray(__spreadArray([], __read(((_a = c.build.config.artifactsPaths) !== null && _a !== void 0 ? _a : [])), false), __read((additionalPaths !== null && additionalPaths !== void 0 ? additionalPaths : [])), false)) === null || _b === void 0 ? void 0 : _b.flatMap(function (artifact) {
9749
+ return c.build
9750
+ // in theory, we only need "direct",
9751
+ // but in some cases project may have packages in the workspace that create build artifacts, which aren't components
9752
+ // this highly depends on the build tool. To be safe, we get all
9753
+ .getComponentDirs("all")
9754
+ .flatMap(function (cDir) { return (0, path_1.join)(cDir, artifact); });
9755
+ });
9756
+ };
9757
+ var getDotEnvPathsForComponent = function (c) {
9758
+ if ((0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(c)) {
9759
+ return [(0, path_1.join)(c.build.dir, ".env")];
9760
+ }
9761
+ return [];
9762
+ };
9763
+ //# sourceMappingURL=createBuildJobArtifact.js.map
9764
+
9765
+ /***/ }),
9766
+
9711
9767
  /***/ 82786:
9712
9768
  /***/ ((__unused_webpack_module, exports) => {
9713
9769
 
@@ -9780,15 +9836,15 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
9780
9836
  Object.defineProperty(exports, "__esModule", ({ value: true }));
9781
9837
  exports.createAppBuildJob = void 0;
9782
9838
  var lodash_1 = __nccwpck_require__(23255);
9783
- var path_1 = __nccwpck_require__(71017);
9784
9839
  var __1 = __nccwpck_require__(10603);
9785
9840
  var utils_1 = __nccwpck_require__(32497);
9841
+ var createBuildJobArtifact_1 = __nccwpck_require__(43397);
9786
9842
  var yarn_1 = __nccwpck_require__(45043);
9787
9843
  var constants_1 = __nccwpck_require__(82786);
9788
9844
  var writeBuildInfo_1 = __nccwpck_require__(99578);
9789
9845
  var writeDotEnv_1 = __nccwpck_require__(48052);
9790
9846
  var createAppBuildJob = function (context, _a) {
9791
- var _b, _c, _d, _e, _f;
9847
+ var _b, _c, _d;
9792
9848
  var script = _a.script, variables = _a.variables, runnerVariables = _a.runnerVariables, def = __rest(_a, ["script", "variables", "runnerVariables"]);
9793
9849
  return (0, lodash_1.merge)({
9794
9850
  name: constants_1.APP_BUILD_JOB_NAME,
@@ -9797,20 +9853,21 @@ var createAppBuildJob = function (context, _a) {
9797
9853
  image: (0, __1.getRunnerImage)("jobs-default"),
9798
9854
  needs: [],
9799
9855
  cache: [],
9800
- 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 : {})),
9856
+ variables: __assign(__assign({}, (variables !== null && variables !== void 0 ? variables : {})), (context.type === "component"
9857
+ ? __assign(__assign(__assign({}, context.environment.envVars), context.environment.jobOnlyVars.build.envVars), ((_b = context.build.config.extraVars) !== null && _b !== void 0 ? _b : {})) : {})),
9801
9858
  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 : {})),
9802
- script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(((0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(context)
9803
- ? (0, writeDotEnv_1.writeDotEnv)(context)
9804
- : [])), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), [
9859
+ script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((context.type === "component"
9860
+ ? (0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(context)
9861
+ ? (0, writeDotEnv_1.writeDotEnv)(context)
9862
+ : []
9863
+ : context.type === "workspace"
9864
+ ? context.components
9865
+ .filter(function (c) { return (0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(c); })
9866
+ .flatMap(function (c) { return (0, writeDotEnv_1.writeDotEnv)(c); })
9867
+ : [])), false), __read((context.type === "component" ? (0, writeBuildInfo_1.writeBuildInfo)(context) : [])), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), [
9805
9868
  "cd ".concat(context.build.dir)
9806
9869
  ], false), __read(((_d = (0, utils_1.ensureArray)(script)) !== null && _d !== void 0 ? _d : [])), false),
9807
- artifacts: __assign(__assign({ paths: [(0, path_1.join)(context.build.dir, "__build_info.json")] }, ((0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(context)
9808
- ? { exclude: [(0, path_1.join)(context.build.dir, ".env")] }
9809
- : {})), { reports: {
9810
- 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) {
9811
- return (0, path_1.join)(context.build.dir, p);
9812
- }),
9813
- } }),
9870
+ artifacts: (0, createBuildJobArtifact_1.createBuildJobArtifacts)(context),
9814
9871
  }, def);
9815
9872
  };
9816
9873
  exports.createAppBuildJob = createAppBuildJob;
@@ -9926,23 +9983,41 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
9926
9983
  return to.concat(ar || Array.prototype.slice.call(from));
9927
9984
  };
9928
9985
  Object.defineProperty(exports, "__esModule", ({ value: true }));
9929
- exports.createBuildJobs = void 0;
9986
+ exports.createWorkspaceBuildJobs = exports.createComponentBuildJobs = void 0;
9930
9987
  var sbom_1 = __nccwpck_require__(44986);
9988
+ var context_1 = __nccwpck_require__(61724);
9931
9989
  var docker_1 = __nccwpck_require__(9641);
9932
9990
  var sbom_2 = __nccwpck_require__(37038);
9933
9991
  var constants_1 = __nccwpck_require__(82786);
9934
9992
  var createAppBuildJob_1 = __nccwpck_require__(7801);
9935
- var createBuildJobs = function (context, definitions) {
9993
+ var createComponentBuildJobs = function (context, definitions) {
9936
9994
  var _a;
9937
- return __spreadArray(__spreadArray(__spreadArray([], __read((definitions.appBuild
9995
+ return __spreadArray(__spreadArray(__spreadArray([], __read((definitions.appBuild && (0, context_1.componentContextIsStandaloneBuild)(context)
9938
9996
  ? [(0, createAppBuildJob_1.createAppBuildJob)(context, definitions.appBuild)]
9939
9997
  : [])), false), __read(((0, docker_1.requiresDockerBuild)(context)
9940
9998
  ? [
9941
- (0, docker_1.createDockerBuildJobBase)(context, __assign(__assign({}, definitions.dockerBuild), { needs: __spreadArray(__spreadArray([], __read(((_a = definitions.dockerBuild.needs) !== null && _a !== void 0 ? _a : [])), false), __read((definitions.appBuild ? [constants_1.APP_BUILD_JOB_NAME] : [])), false) })),
9999
+ (0, docker_1.createDockerBuildJobBase)(context, __assign(__assign({}, definitions.dockerBuild), { needs: __spreadArray(__spreadArray([], __read(((_a = definitions.dockerBuild.needs) !== null && _a !== void 0 ? _a : [])), false), __read((definitions.appBuild &&
10000
+ (0, context_1.componentContextIsStandaloneBuild)(context)
10001
+ ? [constants_1.APP_BUILD_JOB_NAME]
10002
+ : (0, context_1.componentContextHasWorkspaceBuild)(context)
10003
+ ? [
10004
+ {
10005
+ job: constants_1.APP_BUILD_JOB_NAME,
10006
+ artifacts: true,
10007
+ workspaceName: context.build.workspaceName,
10008
+ },
10009
+ ]
10010
+ : [])), false) })),
9942
10011
  ]
9943
10012
  : [])), false), __read(((0, sbom_1.sbomDeactivated)(context) ? [] : [(0, sbom_2.createSbomBuildJob)(context)])), false);
9944
10013
  };
9945
- exports.createBuildJobs = createBuildJobs;
10014
+ exports.createComponentBuildJobs = createComponentBuildJobs;
10015
+ var createWorkspaceBuildJobs = function (context, definitions) {
10016
+ return definitions.appBuild
10017
+ ? [(0, createAppBuildJob_1.createAppBuildJob)(context, definitions.appBuild)]
10018
+ : [];
10019
+ };
10020
+ exports.createWorkspaceBuildJobs = createWorkspaceBuildJobs;
9946
10021
  //# sourceMappingURL=index.js.map
9947
10022
 
9948
10023
  /***/ }),
@@ -9988,6 +10063,7 @@ var __read = (this && this.__read) || function (o, n) {
9988
10063
  Object.defineProperty(exports, "__esModule", ({ value: true }));
9989
10064
  exports.componentContextNeedsBuildTimeDotEnv = exports.writeDotEnv = void 0;
9990
10065
  var lodash_1 = __nccwpck_require__(23255);
10066
+ var gitlab_1 = __nccwpck_require__(38490);
9991
10067
  /**
9992
10068
  * writes a .env file in the components folder
9993
10069
  * @param context
@@ -10007,9 +10083,9 @@ var writeDotEnv = function (context) {
10007
10083
  return "".concat(key, "=").concat(value === null || value === void 0 ? void 0 : value.toString().replaceAll("\n", "\\n"));
10008
10084
  })
10009
10085
  .join("\n");
10010
- return [
10086
+ return (0, gitlab_1.collapseableSection)("write-dotenv-" + context.name, "write dot env")([
10011
10087
  "cat <<EOF > ".concat(context.build.dir, "/.env\n").concat(keyValueString, "\nEOF"),
10012
- ];
10088
+ ]);
10013
10089
  };
10014
10090
  exports.writeDotEnv = writeDotEnv;
10015
10091
  var componentContextNeedsBuildTimeDotEnv = function (context) {
@@ -10052,7 +10128,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
10052
10128
  };
10053
10129
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10054
10130
  exports.createCustomBuildJobs = void 0;
10055
- var path_1 = __nccwpck_require__(71017);
10056
10131
  var utils_1 = __nccwpck_require__(32497);
10057
10132
  var docker_1 = __nccwpck_require__(9641);
10058
10133
  var types_1 = __nccwpck_require__(84466);
@@ -10063,12 +10138,12 @@ var RUNNER_BUILD_VARIABLES = {
10063
10138
  KUBERNETES_MEMORY_LIMIT: "4Gi",
10064
10139
  };
10065
10140
  var createCustomBuildJobs = function (context) {
10066
- var _a, _b, _c;
10141
+ var _a;
10067
10142
  var buildConfig = context.build.config;
10068
10143
  if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
10069
10144
  throw new Error("deploy config is not custom");
10070
10145
  }
10071
- return (0, base_1.createBuildJobs)(context, {
10146
+ return (0, base_1.createComponentBuildJobs)(context, {
10072
10147
  appBuild: buildConfig.buildCommand !== null
10073
10148
  ? {
10074
10149
  image: buildConfig.jobImage,
@@ -10076,15 +10151,6 @@ var createCustomBuildJobs = function (context) {
10076
10151
  cache: buildConfig.jobCache,
10077
10152
  services: buildConfig.jobServices,
10078
10153
  script: __spreadArray([], __read(((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : [])), false),
10079
- artifacts: {
10080
- paths: __spreadArray([
10081
- (0, path_1.join)(context.build.dir, "__build_info.json"),
10082
- (0, path_1.join)(context.build.dir, "dist")
10083
- ], __read(((_c = (_b = buildConfig.artifactsPaths) === null || _b === void 0 ? void 0 : _b.map(function (path) {
10084
- return (0, path_1.join)(context.build.dir, path);
10085
- })) !== null && _c !== void 0 ? _c : [])), false),
10086
- expire_in: "1 day",
10087
- },
10088
10154
  }
10089
10155
  : undefined,
10090
10156
  dockerBuild: {
@@ -10306,9 +10372,9 @@ var getDockerImageVariables = function (context) {
10306
10372
  : // gitlab registry:
10307
10373
  {
10308
10374
  DOCKER_REGISTRY: "$CI_REGISTRY",
10309
- DOCKER_CACHE_IMAGE: "$CI_REGISTRY_IMAGE/caches/" + context.componentName,
10375
+ DOCKER_CACHE_IMAGE: "$CI_REGISTRY_IMAGE/caches/" + context.name,
10310
10376
  // ONLY USED IN KUBERNETES
10311
- DOCKER_IMAGE_NAME: context.environment.shortName + "/" + context.componentName,
10377
+ DOCKER_IMAGE_NAME: context.env + "/" + context.name,
10312
10378
  DOCKER_IMAGE: "$CI_REGISTRY_IMAGE/$DOCKER_IMAGE_NAME",
10313
10379
  })), { DOCKER_IMAGE_TAG: "$CI_COMMIT_SHA" });
10314
10380
  };
@@ -10389,10 +10455,10 @@ var BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS = {
10389
10455
  };
10390
10456
  var getDockerBuildScriptWithBuiltInDockerFile = function (context, defaultType) {
10391
10457
  var _a;
10392
- var type = "docker" in context.componentConfig.build &&
10393
- context.componentConfig.build.docker &&
10394
- "type" in context.componentConfig.build.docker
10395
- ? (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.type
10458
+ var type = "docker" in context.build.config &&
10459
+ context.build.config.docker &&
10460
+ "type" in context.build.config.docker
10461
+ ? (_a = context.build.config.docker) === null || _a === void 0 ? void 0 : _a.type
10396
10462
  : defaultType;
10397
10463
  return (0, exports.getDockerBuildDefaultScript)(context, type ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[type] : null);
10398
10464
  };
@@ -10437,41 +10503,47 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10437
10503
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
10438
10504
  };
10439
10505
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10440
- exports.BUILD_TYPES = void 0;
10506
+ exports.WORKSPACE_BUILD_TYPES = exports.BUILD_TYPES = void 0;
10441
10507
  var custom_1 = __nccwpck_require__(41183);
10442
10508
  var node_1 = __nccwpck_require__(95734);
10443
10509
  var rails_1 = __nccwpck_require__(18513);
10444
- __exportStar(__nccwpck_require__(84466), exports);
10445
10510
  __exportStar(__nccwpck_require__(95734), exports);
10511
+ __exportStar(__nccwpck_require__(84466), exports);
10446
10512
  exports.BUILD_TYPES = {
10447
10513
  node: {
10448
10514
  jobs: node_1.createNodeJobs,
10449
10515
  defaults: function () { return ({
10450
10516
  buildCommand: "yarn build",
10451
10517
  startCommand: "yarn start",
10518
+ artifactsPaths: ["dist", ".next"],
10452
10519
  }); },
10453
10520
  },
10454
10521
  "node-static": {
10455
10522
  jobs: node_1.createNodeJobs,
10456
10523
  defaults: function () { return ({
10457
10524
  buildCommand: "yarn build",
10525
+ artifactsPaths: ["dist"],
10458
10526
  }); },
10459
10527
  },
10460
10528
  storybook: {
10461
10529
  jobs: node_1.createStorybookJobs,
10462
10530
  defaults: function () { return ({
10463
10531
  buildCommand: ["yarn build-storybook --quiet -o ./dist"],
10532
+ artifactsPaths: ["dist"],
10464
10533
  }); },
10465
10534
  },
10466
10535
  meteor: {
10467
10536
  jobs: node_1.createMeteorJobs,
10468
10537
  defaults: function () { return ({
10469
10538
  startCommand: "node main.js",
10539
+ artifactsPaths: ["dist"],
10470
10540
  }); },
10471
10541
  },
10472
10542
  custom: {
10473
10543
  jobs: custom_1.createCustomJobs,
10474
- defaults: function () { return ({}); },
10544
+ defaults: function () { return ({
10545
+ artifactsPaths: ["dist"],
10546
+ }); },
10475
10547
  },
10476
10548
  rails: {
10477
10549
  jobs: rails_1.createRailsJobs,
@@ -10484,6 +10556,20 @@ exports.BUILD_TYPES = {
10484
10556
  }); },
10485
10557
  },
10486
10558
  };
10559
+ exports.WORKSPACE_BUILD_TYPES = {
10560
+ node: {
10561
+ jobs: node_1.createNodeJobs,
10562
+ defaults: function () { return ({
10563
+ buildCommand: "yarn build",
10564
+ lint: {
10565
+ command: "yarn lint",
10566
+ },
10567
+ test: {
10568
+ command: "yarn test",
10569
+ },
10570
+ }); },
10571
+ },
10572
+ };
10487
10573
  //# sourceMappingURL=index.js.map
10488
10574
 
10489
10575
  /***/ }),
@@ -10519,9 +10605,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
10519
10605
  return to.concat(ar || Array.prototype.slice.call(from));
10520
10606
  };
10521
10607
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10522
- exports.createNodeBuildJobs = void 0;
10523
- var path_1 = __nccwpck_require__(71017);
10608
+ exports.createNodeDockerJobDefinition = exports.createNodeBuildJobDefinition = exports.createNodeBuildJobs = void 0;
10524
10609
  var runner_1 = __nccwpck_require__(4058);
10610
+ var context_1 = __nccwpck_require__(61724);
10525
10611
  var utils_1 = __nccwpck_require__(32497);
10526
10612
  var base_1 = __nccwpck_require__(9366);
10527
10613
  var docker_1 = __nccwpck_require__(9641);
@@ -10530,54 +10616,56 @@ var cache_1 = __nccwpck_require__(72026);
10530
10616
  var constants_1 = __nccwpck_require__(31765);
10531
10617
  var yarn_1 = __nccwpck_require__(45043);
10532
10618
  var createNodeBuildJobs = function (context) {
10533
- var _a, _b, _c, _d, _e;
10619
+ if (context.type === "workspace") {
10620
+ return (0, base_1.createWorkspaceBuildJobs)(context, {
10621
+ appBuild: (0, exports.createNodeBuildJobDefinition)(context),
10622
+ });
10623
+ }
10624
+ return (0, base_1.createComponentBuildJobs)(context, {
10625
+ appBuild: (0, context_1.componentContextIsStandaloneBuild)(context)
10626
+ ? (0, exports.createNodeBuildJobDefinition)(context)
10627
+ : undefined,
10628
+ dockerBuild: (0, exports.createNodeDockerJobDefinition)(context),
10629
+ });
10630
+ };
10631
+ exports.createNodeBuildJobs = createNodeBuildJobs;
10632
+ var createNodeBuildJobDefinition = function (context) {
10633
+ var _a, _b, _c;
10534
10634
  var buildConfig = context.build.config;
10535
10635
  if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
10536
10636
  throw new Error("deploy config is not node, node-static or storybook");
10537
10637
  }
10638
+ if (buildConfig.buildCommand === null)
10639
+ return undefined;
10538
10640
  var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
10539
10641
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
10540
- return (0, base_1.createBuildJobs)(context, {
10541
- appBuild: buildConfig.buildCommand !== null
10542
- ? {
10543
- image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
10544
- runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
10545
- 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),
10546
- script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read(((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])), false),
10547
- artifacts: {
10548
- paths: __spreadArray([
10549
- context.build.dir
10550
- ], __read(((_d = context.packageManagerInfo.currentWorkspaceDependencies) !== null && _d !== void 0 ? _d : [])), false).flatMap(function (dir) {
10551
- var _a, _b;
10552
- return __spreadArray([
10553
- (0, path_1.join)(dir, "__build_info.json"),
10554
- (0, path_1.join)(dir, "dist"),
10555
- (0, path_1.join)(dir, ".next")
10556
- ], __read(((_b = (_a = buildConfig.artifactsPaths) === null || _a === void 0 ? void 0 : _a.map(function (path) {
10557
- return (0, path_1.join)(dir, path);
10558
- })) !== null && _b !== void 0 ? _b : [])), false);
10559
- }),
10560
- expire_in: "1 day",
10561
- when: "always",
10562
- },
10563
- jobTags: buildConfig.jobTags,
10564
- }
10565
- : undefined,
10566
- dockerBuild: {
10567
- script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
10568
- ? "nginx"
10569
- : "node"),
10570
- cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
10571
- variables: {
10572
- // only required for non static
10573
- DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context),
10574
- DOCKER_COPY_WORKSPACE_FILES: (_e = context.packageManagerInfo.pathsToCopyInDocker
10575
- .map(function (dir) { return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir); })) === null || _e === void 0 ? void 0 : _e.join("\n"),
10576
- },
10642
+ return {
10643
+ image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
10644
+ runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
10645
+ 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),
10646
+ script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read(((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])), false),
10647
+ jobTags: buildConfig.jobTags,
10648
+ };
10649
+ };
10650
+ exports.createNodeBuildJobDefinition = createNodeBuildJobDefinition;
10651
+ var createNodeDockerJobDefinition = function (context) {
10652
+ var _a, _b;
10653
+ // get the default docker built-in type based on the build type
10654
+ var dockerDefaultBuiltIn = context.build.buildType === "node-static" ||
10655
+ context.build.buildType === "storybook"
10656
+ ? "nginx"
10657
+ : "node";
10658
+ return {
10659
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, dockerDefaultBuiltIn),
10660
+ cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
10661
+ variables: {
10662
+ // only required for non static
10663
+ DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context),
10664
+ DOCKER_COPY_WORKSPACE_FILES: (_b = (_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.pathsToCopyInDocker.map(function (dir) { return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir); })) === null || _b === void 0 ? void 0 : _b.join("\n"),
10577
10665
  },
10578
- });
10666
+ };
10579
10667
  };
10580
- exports.createNodeBuildJobs = createNodeBuildJobs;
10668
+ exports.createNodeDockerJobDefinition = createNodeDockerJobDefinition;
10581
10669
  //# sourceMappingURL=buildJob.js.map
10582
10670
 
10583
10671
  /***/ }),
@@ -10622,7 +10710,8 @@ var path_1 = __nccwpck_require__(71017);
10622
10710
  var slugify_1 = __importDefault(__nccwpck_require__(44035));
10623
10711
  var getYarnCache = function (context, policy) {
10624
10712
  if (policy === void 0) { policy = "pull-push"; }
10625
- var componentIsInWorkspace = context.packageManagerInfo.componentIsInWorkspace;
10713
+ var componentIsInWorkspace = context.type === "component" &&
10714
+ context.packageManagerInfo.componentIsInWorkspace;
10626
10715
  return [
10627
10716
  componentIsInWorkspace
10628
10717
  ? {
@@ -10641,7 +10730,8 @@ exports.getYarnCache = getYarnCache;
10641
10730
  var getNodeModulesCache = function (context, policy) {
10642
10731
  var _a;
10643
10732
  if (policy === void 0) { policy = "pull-push"; }
10644
- var componentIsInWorkspace = context.packageManagerInfo.componentIsInWorkspace;
10733
+ var componentIsInWorkspace = context.type === "component" &&
10734
+ context.packageManagerInfo.componentIsInWorkspace;
10645
10735
  // We intentionally do not use the contents of yarn.lock as a cache key, as yarn install should always guarantee that the files are updated, but it can still use part of the cache if not all packages are up-to-date.
10646
10736
  // It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
10647
10737
  return [
@@ -10667,13 +10757,19 @@ var getNodeCache = function (context, policy) {
10667
10757
  return __spreadArray(__spreadArray([], __read((0, exports.getYarnCache)(context, policy)), false), __read((0, exports.getNodeModulesCache)(context, policy)), false);
10668
10758
  };
10669
10759
  exports.getNodeCache = getNodeCache;
10670
- var getNextCache = function (context) { return [
10671
- {
10672
- key: context.componentName + "-next-cache",
10673
- policy: "pull-push",
10674
- paths: [context.build.dir + "/.next/cache/"],
10675
- },
10676
- ]; };
10760
+ var getNextCache = function (context) {
10761
+ var key = context.name + "-next-cache";
10762
+ var paths = context.build
10763
+ .getComponentDirs("direct")
10764
+ .map(function (c) { return (0, path_1.join)(c, ".next/cache"); });
10765
+ return [
10766
+ {
10767
+ key: key,
10768
+ policy: "pull-push",
10769
+ paths: paths,
10770
+ },
10771
+ ];
10772
+ };
10677
10773
  exports.getNextCache = getNextCache;
10678
10774
  //# sourceMappingURL=cache.js.map
10679
10775
 
@@ -10787,7 +10883,7 @@ var cache_1 = __nccwpck_require__(72026);
10787
10883
  var yarn_1 = __nccwpck_require__(45043);
10788
10884
  var getMeteorCache = function (context) { return [
10789
10885
  {
10790
- key: context.componentName + "meteor-build-cache",
10886
+ key: context.name + "meteor-build-cache",
10791
10887
  policy: "pull-push",
10792
10888
  paths: [
10793
10889
  (0, path_1.join)(context.build.dir, ".meteor/local/resolver-result-cache.json"),
@@ -10803,7 +10899,7 @@ var createMeteorBuildJobs = function (context) {
10803
10899
  throw new Error("deploy config is not meteor");
10804
10900
  }
10805
10901
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
10806
- return (0, base_1.createBuildJobs)(context, {
10902
+ return (0, base_1.createComponentBuildJobs)(context, {
10807
10903
  appBuild: buildConfig.buildCommand !== null
10808
10904
  ? {
10809
10905
  cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read(getMeteorCache(context)), false),
@@ -10818,12 +10914,6 @@ var createMeteorBuildJobs = function (context) {
10818
10914
  'TOOL_NODE_FLAGS="--max_old_space_size=3584 --min_semi_space_size=8 --max_semi_space_size=256 --optimize_for_size" meteor build ./dist --architecture os.linux.x86_64 --allow-superuser --server-only --directory',
10819
10915
  "cp ./__build_info.json ./dist/bundle/programs/server",
10820
10916
  ], false),
10821
- artifacts: {
10822
- paths: [
10823
- context.build.dir + "/__build_info.json",
10824
- context.build.dir + "/dist",
10825
- ],
10826
- },
10827
10917
  }
10828
10918
  : undefined,
10829
10919
  dockerBuild: {
@@ -10883,11 +10973,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
10883
10973
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10884
10974
  exports.createNodeTestJobs = void 0;
10885
10975
  var runner_1 = __nccwpck_require__(4058);
10976
+ var context_1 = __nccwpck_require__(61724);
10886
10977
  var utils_1 = __nccwpck_require__(32497);
10978
+ var createArtifactsConfig_1 = __nccwpck_require__(12820);
10887
10979
  var cache_1 = __nccwpck_require__(72026);
10888
10980
  var constants_1 = __nccwpck_require__(31765);
10889
10981
  var yarn_1 = __nccwpck_require__(45043);
10890
- var createArtifactsConfig_1 = __nccwpck_require__(12820);
10891
10982
  var createNodeTestJobs = function (context) {
10892
10983
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
10893
10984
  // don't run tests after release
@@ -10895,15 +10986,21 @@ var createNodeTestJobs = function (context) {
10895
10986
  if (context.trigger === "taggedRelease") {
10896
10987
  return [];
10897
10988
  }
10898
- var buildConfig = context.build.config;
10989
+ // if its not a standalone build, we don't need to run tests
10990
+ if (context.type === "component" &&
10991
+ !(0, context_1.componentContextIsStandaloneBuild)(context)) {
10992
+ return [];
10993
+ }
10899
10994
  var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
10900
10995
  var base = {
10901
- variables: __assign(__assign({ APP_PATH: context.build.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
10996
+ variables: __assign({ APP_PATH: context.build.dir }, (context.type === "component"
10997
+ ? __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), ((_a = context.build.config.extraVars) !== null && _a !== void 0 ? _a : {})) : {})),
10902
10998
  runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
10903
10999
  stage: "test",
10904
11000
  needs: [],
10905
11001
  envMode: "none",
10906
11002
  };
11003
+ var buildConfig = context.build.config;
10907
11004
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
10908
11005
  var auditJob = buildConfig.audit !== false
10909
11006
  ? __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([
@@ -10981,7 +11078,7 @@ var ensureNodeVersion = function (context) {
10981
11078
  exports.ensureNodeVersion = ensureNodeVersion;
10982
11079
  var getYarnInstall = function (context, options) {
10983
11080
  var _a;
10984
- var postInstall = "postInstall" in context.build.config
11081
+ var postInstall = context.type !== "workspace" && "postInstall" in context.build.config
10985
11082
  ? context.build.config.postInstall
10986
11083
  : null;
10987
11084
  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)
@@ -11054,6 +11151,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
11054
11151
  };
11055
11152
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11056
11153
  exports.createRailsBuildJobs = void 0;
11154
+ var __1 = __nccwpck_require__(10603);
11057
11155
  var base_1 = __nccwpck_require__(9366);
11058
11156
  var docker_1 = __nccwpck_require__(9641);
11059
11157
  var types_1 = __nccwpck_require__(84466);
@@ -11064,8 +11162,12 @@ var createRailsBuildJobs = function (context) {
11064
11162
  // should not happen
11065
11163
  throw new Error("build type is not rails");
11066
11164
  }
11165
+ // if its not a standalone build, we don't need to run tests
11166
+ if (!(0, __1.componentContextIsStandaloneBuild)(context)) {
11167
+ throw new Error("workspace builds are not supported for rails apps");
11168
+ }
11067
11169
  if ((0, docker_1.hasDockerfile)(context)) {
11068
- return (0, base_1.createBuildJobs)(context, {
11170
+ return (0, base_1.createComponentBuildJobs)(context, {
11069
11171
  appBuild: undefined,
11070
11172
  dockerBuild: {
11071
11173
  script: (0, docker_1.getDockerBuildDefaultScript)(context),
@@ -11080,7 +11182,7 @@ var createRailsBuildJobs = function (context) {
11080
11182
  return "--env '".concat(k).concat(v ? "=".concat(v) : "", "'");
11081
11183
  })
11082
11184
  .join(" ");
11083
- return (0, base_1.createBuildJobs)(context, {
11185
+ return (0, base_1.createComponentBuildJobs)(context, {
11084
11186
  appBuild: undefined,
11085
11187
  dockerBuild: {
11086
11188
  variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.build.config.extraVars),
@@ -11187,6 +11289,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
11187
11289
  };
11188
11290
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11189
11291
  exports.createRailsTestJobs = void 0;
11292
+ var __1 = __nccwpck_require__(10603);
11190
11293
  var utils_1 = __nccwpck_require__(32497);
11191
11294
  var createRailsTestJobs = function (context) {
11192
11295
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
@@ -11195,6 +11298,10 @@ var createRailsTestJobs = function (context) {
11195
11298
  if (context.trigger === "taggedRelease") {
11196
11299
  return [];
11197
11300
  }
11301
+ // if its not a standalone build, we don't need to run tests
11302
+ if (!(0, __1.componentContextIsStandaloneBuild)(context)) {
11303
+ return [];
11304
+ }
11198
11305
  var buildConfig = context.build.config;
11199
11306
  var base = {
11200
11307
  variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
@@ -11248,6 +11355,7 @@ exports.createRailsTestJobs = createRailsTestJobs;
11248
11355
 
11249
11356
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11250
11357
  exports.createSbomBuildJob = exports.SBOM_FILE = exports.SBOM_BUILD_JOB_NAME = void 0;
11358
+ var _1 = __nccwpck_require__(67862);
11251
11359
  var utils_1 = __nccwpck_require__(32497);
11252
11360
  exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
11253
11361
  exports.SBOM_FILE = "__sbom.json";
@@ -11260,10 +11368,14 @@ var createSbomBuildJob = function (context) {
11260
11368
  ? "."
11261
11369
  : context.build.dir),
11262
11370
  ];
11263
- var image = buildConfig.type === "custom" && buildConfig.sbom !== false
11371
+ var image = (0, _1.isStandaloneBuildConfig)(buildConfig) &&
11372
+ buildConfig.type === "custom" &&
11373
+ buildConfig.sbom !== false
11264
11374
  ? (_b = (_a = buildConfig.sbom) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : defaultImage
11265
11375
  : defaultImage;
11266
- var script = buildConfig.type === "custom" && buildConfig.sbom !== false
11376
+ var script = (0, _1.isStandaloneBuildConfig)(buildConfig) &&
11377
+ buildConfig.type === "custom" &&
11378
+ buildConfig.sbom !== false
11267
11379
  ? (_d = (0, utils_1.ensureArray)((_c = buildConfig.sbom) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : defaultScript
11268
11380
  : defaultScript;
11269
11381
  return {
@@ -11291,12 +11403,20 @@ exports.createSbomBuildJob = createSbomBuildJob;
11291
11403
  "use strict";
11292
11404
 
11293
11405
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11294
- exports.isOfBuildType = void 0;
11406
+ exports.isOfBuildType = exports.isStandaloneBuildConfig = void 0;
11407
+ var isStandaloneBuildConfig = function (t) {
11408
+ if (!t)
11409
+ return false;
11410
+ return !("from" in t);
11411
+ };
11412
+ exports.isStandaloneBuildConfig = isStandaloneBuildConfig;
11295
11413
  var isOfBuildType = function (t) {
11296
11414
  var types = [];
11297
11415
  for (var _i = 1; _i < arguments.length; _i++) {
11298
11416
  types[_i - 1] = arguments[_i];
11299
11417
  }
11418
+ if (!(0, exports.isStandaloneBuildConfig)(t))
11419
+ return false;
11300
11420
  return types.includes(t.type);
11301
11421
  };
11302
11422
  exports.isOfBuildType = isOfBuildType;
@@ -11469,6 +11589,81 @@ exports.DOCKER_REGISTRY = process.env.INLINE_DOCKER_REGISTRY ||
11469
11589
 
11470
11590
  /***/ }),
11471
11591
 
11592
+ /***/ 28375:
11593
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
11594
+
11595
+ "use strict";
11596
+
11597
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
11598
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11599
+ return new (P || (P = Promise))(function (resolve, reject) {
11600
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11601
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11602
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11603
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11604
+ });
11605
+ };
11606
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11607
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
11608
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
11609
+ function verb(n) { return function (v) { return step([n, v]); }; }
11610
+ function step(op) {
11611
+ if (f) throw new TypeError("Generator is already executing.");
11612
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
11613
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
11614
+ if (y = 0, t) op = [op[0] & 2, t.value];
11615
+ switch (op[0]) {
11616
+ case 0: case 1: t = op; break;
11617
+ case 4: _.label++; return { value: op[1], done: false };
11618
+ case 5: _.label++; y = op[1]; op = [0]; continue;
11619
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
11620
+ default:
11621
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
11622
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
11623
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
11624
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
11625
+ if (t[2]) _.ops.pop();
11626
+ _.trys.pop(); continue;
11627
+ }
11628
+ op = body.call(thisArg, _);
11629
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
11630
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
11631
+ }
11632
+ };
11633
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
11634
+ exports.createAllComponentsContext = void 0;
11635
+ var configruedEnvs_1 = __nccwpck_require__(45449);
11636
+ var createComponentContext_1 = __nccwpck_require__(92775);
11637
+ var createAllComponentsContext = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
11638
+ var config = _b.config, trigger = _b.trigger, pipelineType = _b.pipelineType;
11639
+ return __generator(this, function (_c) {
11640
+ switch (_c.label) {
11641
+ case 0: return [4 /*yield*/, Promise.all(Object.keys(config.components).flatMap(function (componentName) {
11642
+ var envs = (0, configruedEnvs_1.getAllEnvsByTrigger)(config, componentName, trigger);
11643
+ return envs.map(function (env) { return __awaiter(void 0, void 0, void 0, function () {
11644
+ return __generator(this, function (_a) {
11645
+ switch (_a.label) {
11646
+ case 0: return [4 /*yield*/, (0, createComponentContext_1.createComponentContext)({
11647
+ config: config,
11648
+ componentName: componentName,
11649
+ env: env,
11650
+ trigger: trigger,
11651
+ pipelineType: pipelineType,
11652
+ })];
11653
+ case 1: return [2 /*return*/, _a.sent()];
11654
+ }
11655
+ });
11656
+ }); });
11657
+ }))];
11658
+ case 1: return [2 /*return*/, _c.sent()];
11659
+ }
11660
+ });
11661
+ }); };
11662
+ exports.createAllComponentsContext = createAllComponentsContext;
11663
+ //# sourceMappingURL=createAllComponentsContext.js.map
11664
+
11665
+ /***/ }),
11666
+
11472
11667
  /***/ 92775:
11473
11668
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
11474
11669
 
@@ -11521,56 +11716,122 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
11521
11716
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
11522
11717
  }
11523
11718
  };
11719
+ var __read = (this && this.__read) || function (o, n) {
11720
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
11721
+ if (!m) return o;
11722
+ var i = m.call(o), r, ar = [], e;
11723
+ try {
11724
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
11725
+ }
11726
+ catch (error) { e = { error: error }; }
11727
+ finally {
11728
+ try {
11729
+ if (r && !r.done && (m = i["return"])) m.call(i);
11730
+ }
11731
+ finally { if (e) throw e.error; }
11732
+ }
11733
+ return ar;
11734
+ };
11735
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
11736
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
11737
+ if (ar || !(i in from)) {
11738
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
11739
+ ar[i] = from[i];
11740
+ }
11741
+ }
11742
+ return to.concat(ar || Array.prototype.slice.call(from));
11743
+ };
11524
11744
  Object.defineProperty(exports, "__esModule", ({ value: true }));
11525
- exports.createContext = exports.createComponentContext = void 0;
11745
+ exports.createComponentContext = void 0;
11526
11746
  var lodash_1 = __nccwpck_require__(23255);
11527
11747
  var build_1 = __nccwpck_require__(67862);
11528
11748
  var deploy_1 = __nccwpck_require__(68483);
11749
+ var packageManager_1 = __nccwpck_require__(76451);
11529
11750
  var utils_1 = __nccwpck_require__(32497);
11530
11751
  var getEnvironment_1 = __nccwpck_require__(45699);
11531
11752
  var getEnvironmentContext_1 = __nccwpck_require__(13663);
11532
- var packageManager_1 = __nccwpck_require__(76451);
11533
11753
  var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
11534
- var packageManagerInfo, envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
11535
- return __generator(this, function (_a) {
11536
- switch (_a.label) {
11754
+ var packageManagerInfo, envContext, componentConfigWithoutDefaults, resolvedBuildType, defaults, componentConfig, environment, deploy, build, customJobs, dir, getComponentDirs, _getBuildContext, buildContext, context, resolvedCustomJobs;
11755
+ var _a;
11756
+ return __generator(this, function (_b) {
11757
+ switch (_b.label) {
11537
11758
  case 0:
11538
11759
  if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
11539
11760
  throw new Error("componentName may only contain lower case letters, numbers and -");
11540
11761
  }
11541
11762
  return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfoForComponent)(ctx.config, ctx.componentName)];
11542
11763
  case 1:
11543
- packageManagerInfo = _a.sent();
11764
+ packageManagerInfo = _b.sent();
11544
11765
  envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
11545
11766
  componentConfigWithoutDefaults = envContext.envConfigRaw;
11767
+ resolvedBuildType = (0, build_1.isStandaloneBuildConfig)(componentConfigWithoutDefaults.build)
11768
+ ? componentConfigWithoutDefaults.build.type
11769
+ : (_a = ctx.config.builds) === null || _a === void 0 ? void 0 : _a[componentConfigWithoutDefaults.build.from].type;
11770
+ if (!resolvedBuildType) {
11771
+ throw new Error("build type not found, is the build config correct?");
11772
+ }
11546
11773
  defaults = componentConfigWithoutDefaults.deploy
11547
11774
  ? {
11548
- build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(envContext),
11775
+ build: build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
11549
11776
  deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext),
11550
11777
  }
11551
11778
  : {
11552
- build: {},
11779
+ build: build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
11553
11780
  deploy: {},
11554
11781
  };
11555
11782
  componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
11556
11783
  return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
11557
11784
  case 2:
11558
- environment = _a.sent();
11785
+ environment = _b.sent();
11559
11786
  deploy = componentConfig.deploy, build = componentConfig.build, customJobs = componentConfig.customJobs, dir = componentConfig.dir;
11787
+ getComponentDirs = function (mode) {
11788
+ var _a;
11789
+ return __spreadArray([
11790
+ dir
11791
+ ], __read((mode === "all"
11792
+ ? (_a = packageManagerInfo.currentWorkspaceDependencies) !== null && _a !== void 0 ? _a : []
11793
+ : [])), false);
11794
+ };
11795
+ _getBuildContext = function () {
11796
+ var _a;
11797
+ if ((0, build_1.isStandaloneBuildConfig)(build)) {
11798
+ return {
11799
+ dir: dir,
11800
+ getComponentDirs: getComponentDirs,
11801
+ config: build,
11802
+ buildType: build.type,
11803
+ type: "standalone",
11804
+ };
11805
+ }
11806
+ // must be shared build
11807
+ var referencedBuild = (_a = ctx.config.builds) === null || _a === void 0 ? void 0 : _a[build.from];
11808
+ if (!referencedBuild) {
11809
+ throw new Error("build.from not found in config");
11810
+ }
11811
+ return {
11812
+ dir: dir,
11813
+ getComponentDirs: getComponentDirs,
11814
+ config: build,
11815
+ workspaceBuildConfig: referencedBuild,
11816
+ workspaceName: build.from,
11817
+ buildType: referencedBuild.type,
11818
+ type: "fromWorkspace",
11819
+ };
11820
+ };
11821
+ buildContext = _getBuildContext();
11560
11822
  context = {
11823
+ type: "component",
11824
+ name: ctx.componentName,
11825
+ componentName: ctx.componentName,
11826
+ env: ctx.env,
11561
11827
  fullConfig: ctx.config,
11562
11828
  componentConfig: componentConfig,
11563
- env: ctx.env,
11564
- build: {
11565
- dir: dir,
11566
- config: build,
11567
- },
11829
+ build: buildContext,
11568
11830
  deploy: deploy
11569
11831
  ? {
11570
11832
  config: deploy,
11571
11833
  }
11572
11834
  : null,
11573
- componentName: ctx.componentName,
11574
11835
  environment: environment,
11575
11836
  packageManagerInfo: packageManagerInfo,
11576
11837
  pipelineType: ctx.pipelineType,
@@ -11584,14 +11845,103 @@ var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, v
11584
11845
  });
11585
11846
  }); };
11586
11847
  exports.createComponentContext = createComponentContext;
11587
- /**
11588
- * @deprecated use createComponentContext instead
11589
- */
11590
- exports.createContext = exports.createComponentContext;
11591
11848
  //# sourceMappingURL=createComponentContext.js.map
11592
11849
 
11593
11850
  /***/ }),
11594
11851
 
11852
+ /***/ 76558:
11853
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
11854
+
11855
+ "use strict";
11856
+
11857
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
11858
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11859
+ return new (P || (P = Promise))(function (resolve, reject) {
11860
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
11861
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
11862
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
11863
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
11864
+ });
11865
+ };
11866
+ var __generator = (this && this.__generator) || function (thisArg, body) {
11867
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
11868
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
11869
+ function verb(n) { return function (v) { return step([n, v]); }; }
11870
+ function step(op) {
11871
+ if (f) throw new TypeError("Generator is already executing.");
11872
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
11873
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
11874
+ if (y = 0, t) op = [op[0] & 2, t.value];
11875
+ switch (op[0]) {
11876
+ case 0: case 1: t = op; break;
11877
+ case 4: _.label++; return { value: op[1], done: false };
11878
+ case 5: _.label++; y = op[1]; op = [0]; continue;
11879
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
11880
+ default:
11881
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
11882
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
11883
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
11884
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
11885
+ if (t[2]) _.ops.pop();
11886
+ _.trys.pop(); continue;
11887
+ }
11888
+ op = body.call(thisArg, _);
11889
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
11890
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
11891
+ }
11892
+ };
11893
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
11894
+ exports.createWorkspaceContext = void 0;
11895
+ var __1 = __nccwpck_require__(10603);
11896
+ var packageManager_1 = __nccwpck_require__(76451);
11897
+ var utils_1 = __nccwpck_require__(32497);
11898
+ var lodash_1 = __nccwpck_require__(23255);
11899
+ function createWorkspaceContext(_a) {
11900
+ return __awaiter(this, arguments, void 0, function (_b) {
11901
+ var workspaceConfigRaw, defaults, workspaceConfig;
11902
+ var _c;
11903
+ var _d, _e;
11904
+ var env = _b.env, components = _b.components, workspaceName = _b.workspaceName, config = _b.config, pipelineType = _b.pipelineType, trigger = _b.trigger;
11905
+ return __generator(this, function (_f) {
11906
+ switch (_f.label) {
11907
+ case 0:
11908
+ workspaceConfigRaw = (_d = config.builds) === null || _d === void 0 ? void 0 : _d[workspaceName];
11909
+ if (!workspaceConfigRaw) {
11910
+ throw new Error("Workspace ".concat(workspaceName, " not found in config"));
11911
+ }
11912
+ defaults = __1.WORKSPACE_BUILD_TYPES[workspaceConfigRaw.type].defaults();
11913
+ workspaceConfig = (0, utils_1.mergeWithMergingArrays)(defaults, workspaceConfigRaw);
11914
+ _c = {
11915
+ name: workspaceName,
11916
+ pipelineType: pipelineType,
11917
+ trigger: trigger,
11918
+ type: "workspace",
11919
+ workspaceConfig: workspaceConfig,
11920
+ env: env,
11921
+ components: components,
11922
+ fullConfig: config
11923
+ };
11924
+ return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfoBase)()];
11925
+ case 1: return [2 /*return*/, (_c.packageManagerInfo = _f.sent(),
11926
+ _c.build = {
11927
+ type: "workspace",
11928
+ dir: (_e = workspaceConfig.dir) !== null && _e !== void 0 ? _e : ".",
11929
+ getComponentDirs: function (mode) {
11930
+ return (0, lodash_1.uniq)(components.flatMap(function (c) { return c.build.getComponentDirs(mode); }));
11931
+ },
11932
+ buildType: workspaceConfig.type,
11933
+ config: workspaceConfig,
11934
+ },
11935
+ _c)];
11936
+ }
11937
+ });
11938
+ });
11939
+ }
11940
+ exports.createWorkspaceContext = createWorkspaceContext;
11941
+ //# sourceMappingURL=createWorkspaceContext.js.map
11942
+
11943
+ /***/ }),
11944
+
11595
11945
  /***/ 17827:
11596
11946
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
11597
11947
 
@@ -11875,6 +12225,7 @@ exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvir
11875
12225
  var lodash_1 = __nccwpck_require__(23255);
11876
12226
  var deploy_1 = __nccwpck_require__(68483);
11877
12227
  var BashExpression_1 = __nccwpck_require__(42376);
12228
+ var types_1 = __nccwpck_require__(84466);
11878
12229
  var getBuildInfoVariables_1 = __nccwpck_require__(17827);
11879
12230
  var getEnvironmentContext_1 = __nccwpck_require__(13663);
11880
12231
  var resolveReferences_1 = __nccwpck_require__(43115);
@@ -11905,7 +12256,8 @@ var getEnvironmentVariables = function (ctx_1) {
11905
12256
  port = (_c = devLocalConfig.port) !== null && _c !== void 0 ? _c : 3000;
11906
12257
  host = "localhost:" + port.toString();
11907
12258
  url = "http://" + host;
11908
- predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), { ENV_SHORT: "local", ROOT_URL: url }), (config.components[componentName].build.type === "rails"
12259
+ predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), { ENV_SHORT: "local", ROOT_URL: url }), ((0, types_1.isStandaloneBuildConfig)(buildConfigRaw) &&
12260
+ buildConfigRaw.type === "rails"
11909
12261
  ? {}
11910
12262
  : { HOST: host })), { HOST_INTERNAL: host, ROOT_URL_INTERNAL: "http://" + host, PORT: port.toString() });
11911
12263
  }
@@ -11916,7 +12268,8 @@ var getEnvironmentVariables = function (ctx_1) {
11916
12268
  HOST_INTERNAL = (_d = additionalEnvVars.HOST_INTERNAL) !== null && _d !== void 0 ? _d : "unknown-host.example.com";
11917
12269
  host = (_e = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _e !== void 0 ? _e : HOST_INTERNAL;
11918
12270
  url = (0, BashExpression_1.joinBashExpressions)(["https://", host]);
11919
- predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), (config.components[componentName].build.type === "rails"
12271
+ predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), ((0, types_1.isStandaloneBuildConfig)(buildConfigRaw) &&
12272
+ buildConfigRaw.type === "rails"
11920
12273
  ? {}
11921
12274
  : { HOST: host })), { ROOT_URL: url, HOST_INTERNAL: HOST_INTERNAL,
11922
12275
  /**@deprecated */
@@ -11950,7 +12303,10 @@ var getEnvironmentVariables = function (ctx_1) {
11950
12303
  secretEnvVarKeys: secretEnvVarKeys
11951
12304
  };
11952
12305
  _b = {};
11953
- return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, (buildConfigRaw && buildConfigRaw.jobVars) || null)];
12306
+ return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, (buildConfigRaw &&
12307
+ (0, types_1.isStandaloneBuildConfig)(buildConfigRaw) &&
12308
+ buildConfigRaw.jobVars) ||
12309
+ null)];
11954
12310
  case 2:
11955
12311
  _b.build = _m.sent();
11956
12312
  return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, (deployConfigRaw && deployConfigRaw.jobVars) || null)];
@@ -11968,9 +12324,7 @@ var sanitizeForEnVar = function (s) { return s.replace(/-/g, "_"); };
11968
12324
  var getSecretVarName = function (env, componentName, key) { return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key); }; // remove dash from component name
11969
12325
  exports.getSecretVarName = getSecretVarName;
11970
12326
  var addIndexVar = function (vars) { return (__assign(__assign({}, vars), { _ALL_ENV_VAR_KEYS: JSON.stringify(Object.keys(vars)) })); };
11971
- var getSecretVarNameForContext = function (context, key) {
11972
- return (0, exports.getSecretVarName)(context.environment.shortName, context.componentName, key);
11973
- };
12327
+ var getSecretVarNameForContext = function (context, key) { return (0, exports.getSecretVarName)(context.env, context.name, key); };
11974
12328
  exports.getSecretVarNameForContext = getSecretVarNameForContext;
11975
12329
  //# sourceMappingURL=getEnvironmentVariables.js.map
11976
12330
 
@@ -12006,8 +12360,8 @@ var sanitize = function (value) {
12006
12360
  return (0, slugify_1.default)(value).toLowerCase();
12007
12361
  };
12008
12362
  var getLabels = function (context) {
12009
- var _a, _b, _c;
12010
- 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 : {}));
12363
+ var _a, _b;
12364
+ var labels = __assign({ "customer-name": sanitize(context.fullConfig.customerName), "component-name": sanitize(context.name), "app-name": sanitize(context.fullConfig.appName), "env-type": sanitize(context.environment.envType), "env-name": sanitize(context.env), "build-type": sanitize(context.build.buildType) }, ((_b = (_a = context.fullConfig.meta) === null || _a === void 0 ? void 0 : _a.labels) !== null && _b !== void 0 ? _b : {}));
12011
12365
  return labels;
12012
12366
  };
12013
12367
  exports.getLabels = getLabels;
@@ -12464,6 +12818,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
12464
12818
  exports.createDeployJob = exports.DEPLOY_JOB_NAME = void 0;
12465
12819
  var docker_1 = __nccwpck_require__(9641);
12466
12820
  var sbom_1 = __nccwpck_require__(37038);
12821
+ var context_1 = __nccwpck_require__(61724);
12467
12822
  var sbom_2 = __nccwpck_require__(44986);
12468
12823
  var utils_1 = __nccwpck_require__(6054);
12469
12824
  var stop_1 = __nccwpck_require__(82846);
@@ -12506,16 +12861,38 @@ var createDeployJob = function (context, jobDefinition) {
12506
12861
  }); })) !== null && _d !== void 0 ? _d : []
12507
12862
  : [])), false),
12508
12863
  // we don't want to deploy when there is a broken test
12509
- needsStages: [
12510
- {
12511
- stage: "build",
12512
- artifacts: hasDocker ? false : true, // we asume that no-docker deployments need build artifacts,
12513
- },
12864
+ needsStages: __spreadArray(__spreadArray([], __read(((0, context_1.componentContextHasWorkspaceBuild)(context)
12865
+ ? hasDocker // docker build is per component,
12866
+ ? [
12867
+ // we don't need artifacts, but have to wait for the component build
12868
+ {
12869
+ stage: "build",
12870
+ artifacts: false,
12871
+ },
12872
+ ]
12873
+ : [
12874
+ {
12875
+ // pick build artifacts from workspace build
12876
+ stage: "build",
12877
+ artifacts: true,
12878
+ workspaceName: context.build.workspaceName,
12879
+ },
12880
+ ]
12881
+ : [
12882
+ {
12883
+ stage: "build",
12884
+ artifacts: hasDocker ? false : true, // we asume that no-docker deployments need build artifacts,
12885
+ },
12886
+ ])), false), [
12514
12887
  {
12515
12888
  stage: "test",
12516
12889
  artifacts: false,
12890
+ // use test from workspace build
12891
+ workspaceName: (0, context_1.componentContextHasWorkspaceBuild)(context)
12892
+ ? context.build.workspaceName
12893
+ : undefined,
12517
12894
  },
12518
- ], // workaround for https://gitlab.com/gitlab-org/gitlab/-/issues/220758
12895
+ ], false),
12519
12896
  when: whenDeploy === "auto" ? "on_success" : "manual",
12520
12897
  allow_failure: whenDeploy === "manual" ? true : false,
12521
12898
  stage: "deploy",
@@ -12757,8 +13134,8 @@ var getArtifactsRegistryImageName = function (context, lecacyReviewImageName) {
12757
13134
  var dockerUrl = (0, exports.getArtifactsRegistryDockerUrl)(context);
12758
13135
  var gcloudImagePath = __spreadArray([
12759
13136
  dockerUrl,
12760
- context.environment.shortName,
12761
- context.componentName
13137
+ context.env,
13138
+ context.name
12762
13139
  ], __read((context.environment.reviewSlug && !lecacyReviewImageName
12763
13140
  ? [context.environment.reviewSlug]
12764
13141
  : [])), false);
@@ -12768,7 +13145,7 @@ exports.getArtifactsRegistryImageName = getArtifactsRegistryImageName;
12768
13145
  var getArtifactsRegistryBuildCacheImage = function (context) {
12769
13146
  var dockerUrl = (0, exports.getArtifactsRegistryDockerUrl)(context);
12770
13147
  // does not include env, so that after merge, you might get more cache hits (review-->dev)
12771
- var gcloudImagePath = [dockerUrl, "caches", context.componentName];
13148
+ var gcloudImagePath = [dockerUrl, "caches", context.name];
12772
13149
  return gcloudImagePath.join("/");
12773
13150
  };
12774
13151
  exports.getArtifactsRegistryBuildCacheImage = getArtifactsRegistryBuildCacheImage;
@@ -14191,7 +14568,7 @@ var createKubernetesCloudsqlBaseValues = function (context) {
14191
14568
  dbUser: (_g = config.dbUser) !== null && _g !== void 0 ? _g : "postgres",
14192
14569
  instanceConnectionName: config.instanceConnectionName,
14193
14570
  proxyCredentials: proxyCredentials,
14194
- fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName),
14571
+ fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.name),
14195
14572
  },
14196
14573
  };
14197
14574
  }
@@ -14272,7 +14649,7 @@ var createKubernetesDeployJobs = function (context) {
14272
14649
  when: "always",
14273
14650
  },
14274
14651
  }
14275
- : {})), { 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,
14652
+ : {})), { variables: __assign(__assign({}, context.environment.envVars), { RELEASE_NAME: context.environment.fullName, HELM_EXPERIMENTAL_OCI: "1", KUBE_DOCKER_IMAGE_PULL_SECRET: "gitlab-registry-".concat(context.name), 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.name,
14276
14653
  /** @deprecated */
14277
14654
  BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID }) });
14278
14655
  var clusterName = "kube-".concat(context.environment.fullName);
@@ -14748,8 +15125,11 @@ exports.processSecretsAsFiles = processSecretsAsFiles;
14748
15125
  Object.defineProperty(exports, "__esModule", ({ value: true }));
14749
15126
  exports.getDependencyTrackDeleteScript = exports.getDependencyTrackUploadScript = exports.sbomDeactivated = void 0;
14750
15127
  var sbom_1 = __nccwpck_require__(37038);
15128
+ var context_1 = __nccwpck_require__(61724);
14751
15129
  var sbomDeactivated = function (context) {
14752
- return context.build.config.type === "custom" && context.build.config.sbom === false;
15130
+ return (0, context_1.componentContextIsStandaloneBuild)(context) &&
15131
+ context.build.config.type === "custom" &&
15132
+ context.build.config.sbom === false;
14753
15133
  };
14754
15134
  exports.sbomDeactivated = sbomDeactivated;
14755
15135
  var getDependencyTrackUploadScript = function (context) {
@@ -14757,7 +15137,7 @@ var getDependencyTrackUploadScript = function (context) {
14757
15137
  ? []
14758
15138
  : [
14759
15139
  "echo 'Uploading SBOM to Dependency Track'",
14760
- "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" upload \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.componentName, "\" \"").concat(context.environment.url, "\" \"").concat(sbom_1.SBOM_FILE, "\" vex.json || true"),
15140
+ "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" upload \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.name, "\" \"").concat(context.environment.url, "\" \"").concat(sbom_1.SBOM_FILE, "\" vex.json || true"),
14761
15141
  ];
14762
15142
  };
14763
15143
  exports.getDependencyTrackUploadScript = getDependencyTrackUploadScript;
@@ -14766,7 +15146,7 @@ var getDependencyTrackDeleteScript = function (context) {
14766
15146
  ? []
14767
15147
  : [
14768
15148
  "echo 'Disabling component in Dependency Track'",
14769
- "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" disable \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.componentName, "\" \"").concat(context.environment.url, "\" || true"),
15149
+ "/dtrackuploader https://dep.panter.swiss/ \"$DT_KEY_PROD\" disable \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.name, "\" \"").concat(context.environment.url, "\" || true"),
14770
15150
  ];
14771
15151
  };
14772
15152
  exports.getDependencyTrackDeleteScript = getDependencyTrackDeleteScript;
@@ -14981,62 +15361,102 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
14981
15361
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
14982
15362
  }
14983
15363
  };
15364
+ var __read = (this && this.__read) || function (o, n) {
15365
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
15366
+ if (!m) return o;
15367
+ var i = m.call(o), r, ar = [], e;
15368
+ try {
15369
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
15370
+ }
15371
+ catch (error) { e = { error: error }; }
15372
+ finally {
15373
+ try {
15374
+ if (r && !r.done && (m = i["return"])) m.call(i);
15375
+ }
15376
+ finally { if (e) throw e.error; }
15377
+ }
15378
+ return ar;
15379
+ };
15380
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
15381
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15382
+ if (ar || !(i in from)) {
15383
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
15384
+ ar[i] = from[i];
15385
+ }
15386
+ }
15387
+ return to.concat(ar || Array.prototype.slice.call(from));
15388
+ };
14984
15389
  Object.defineProperty(exports, "__esModule", ({ value: true }));
14985
15390
  exports.createAllJobs = void 0;
14986
- var config_1 = __nccwpck_require__(13352);
14987
- var context_1 = __nccwpck_require__(5875);
15391
+ var createAllComponentsContext_1 = __nccwpck_require__(28375);
15392
+ var createWorkspaceContext_1 = __nccwpck_require__(76558);
15393
+ var types_1 = __nccwpck_require__(11853);
14988
15394
  var createJobsForComponent_1 = __nccwpck_require__(92321);
14989
- var createAllComponentContext = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
14990
- var config = _b.config, trigger = _b.trigger, pipelineType = _b.pipelineType;
14991
- return __generator(this, function (_c) {
14992
- switch (_c.label) {
14993
- case 0: return [4 /*yield*/, Promise.all(Object.keys(config.components).flatMap(function (componentName) {
14994
- var envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
14995
- return envs.map(function (env) { return __awaiter(void 0, void 0, void 0, function () {
14996
- var context;
14997
- return __generator(this, function (_a) {
14998
- switch (_a.label) {
14999
- case 0: return [4 /*yield*/, (0, context_1.createComponentContext)({
15000
- config: config,
15001
- componentName: componentName,
15002
- env: env,
15003
- trigger: trigger,
15004
- pipelineType: pipelineType,
15005
- })];
15006
- case 1:
15007
- context = _a.sent();
15008
- return [2 /*return*/, {
15009
- env: env,
15010
- componentName: componentName,
15011
- context: context,
15012
- }];
15013
- }
15014
- });
15015
- }); });
15016
- }))];
15017
- case 1: return [2 /*return*/, _c.sent()];
15018
- }
15019
- });
15020
- }); };
15395
+ var createJobsForWorkspace_1 = __nccwpck_require__(70803);
15021
15396
  var createAllJobs = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
15022
- var allComponentContext;
15397
+ var allComponentsContext;
15398
+ var _c;
15399
+ var _d;
15023
15400
  var config = _b.config, trigger = _b.trigger, pipelineType = _b.pipelineType;
15024
- return __generator(this, function (_c) {
15025
- switch (_c.label) {
15026
- case 0: return [4 /*yield*/, createAllComponentContext({
15401
+ return __generator(this, function (_e) {
15402
+ switch (_e.label) {
15403
+ case 0: return [4 /*yield*/, (0, createAllComponentsContext_1.createAllComponentsContext)({
15027
15404
  config: config,
15028
15405
  trigger: trigger,
15029
15406
  pipelineType: pipelineType,
15030
15407
  })];
15031
15408
  case 1:
15032
- allComponentContext = _c.sent();
15033
- return [2 /*return*/, allComponentContext.map(function (_a) {
15034
- var context = _a.context;
15035
- return ({
15409
+ allComponentsContext = _e.sent();
15410
+ _c = {};
15411
+ return [4 /*yield*/, Promise.all(Object.keys((_d = config.builds) !== null && _d !== void 0 ? _d : {}).map(function (workspaceName) { return __awaiter(void 0, void 0, void 0, function () {
15412
+ var componentsInAllEnvs, allEnvs;
15413
+ return __generator(this, function (_a) {
15414
+ switch (_a.label) {
15415
+ case 0:
15416
+ componentsInAllEnvs = allComponentsContext.filter(function (context) {
15417
+ return (0, types_1.componentContextHasWorkspaceBuild)(context) &&
15418
+ context.build.workspaceName === workspaceName;
15419
+ });
15420
+ allEnvs = __spreadArray([], __read(new Set(componentsInAllEnvs.map(function (_a) {
15421
+ var env = _a.env;
15422
+ return env;
15423
+ }))), false);
15424
+ return [4 /*yield*/, Promise.all(allEnvs.map(function (env) { return __awaiter(void 0, void 0, void 0, function () {
15425
+ var workspaceContext;
15426
+ return __generator(this, function (_a) {
15427
+ switch (_a.label) {
15428
+ case 0: return [4 /*yield*/, (0, createWorkspaceContext_1.createWorkspaceContext)({
15429
+ components: componentsInAllEnvs.filter(function (_a) {
15430
+ var componentEnv = _a.env;
15431
+ return componentEnv === env;
15432
+ }),
15433
+ workspaceName: workspaceName,
15434
+ config: config,
15435
+ trigger: trigger,
15436
+ pipelineType: pipelineType,
15437
+ env: env,
15438
+ })];
15439
+ case 1:
15440
+ workspaceContext = _a.sent();
15441
+ return [2 /*return*/, {
15442
+ context: workspaceContext,
15443
+ jobs: (0, createJobsForWorkspace_1.createJobsForWorkspace)(workspaceContext),
15444
+ }];
15445
+ }
15446
+ });
15447
+ }); }))];
15448
+ case 1: return [2 /*return*/, _a.sent()];
15449
+ }
15450
+ });
15451
+ }); })).then(function (f) { return f.flat(); })];
15452
+ case 2: return [2 /*return*/, (_c.workspaces = _e.sent(),
15453
+ _c.components = allComponentsContext.map(function (context) {
15454
+ return {
15036
15455
  context: context,
15037
15456
  jobs: (0, createJobsForComponent_1.createJobsForComponentContext)(context),
15038
- });
15039
- })];
15457
+ };
15458
+ }),
15459
+ _c)];
15040
15460
  }
15041
15461
  });
15042
15462
  }); };
@@ -15199,10 +15619,9 @@ var getCustomJobs = function (context) {
15199
15619
  return injectDefaultVarsInCustomJobs(context, rawJobs);
15200
15620
  };
15201
15621
  var createJobsForComponentContext = function (context) {
15202
- var _a, _b;
15203
- var buildJobs = build_1.BUILD_TYPES[context.build.config.type].jobs(context);
15204
- var deployJobs = ((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config)
15205
- ? deploy_1.DEPLOY_TYPES[(_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.type].jobs(context)
15622
+ var buildJobs = build_1.BUILD_TYPES[context.build.buildType].jobs(context);
15623
+ var deployJobs = context.componentConfig.deploy !== false
15624
+ ? deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context)
15206
15625
  : [];
15207
15626
  var customJobs = getCustomJobs(context);
15208
15627
  return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
@@ -15212,6 +15631,23 @@ exports.createJobsForComponentContext = createJobsForComponentContext;
15212
15631
 
15213
15632
  /***/ }),
15214
15633
 
15634
+ /***/ 70803:
15635
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
15636
+
15637
+ "use strict";
15638
+
15639
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
15640
+ exports.createJobsForWorkspace = void 0;
15641
+ var build_1 = __nccwpck_require__(67862);
15642
+ var createJobsForWorkspace = function (context) {
15643
+ var buildJobs = build_1.WORKSPACE_BUILD_TYPES[context.build.buildType].jobs(context);
15644
+ return buildJobs;
15645
+ };
15646
+ exports.createJobsForWorkspace = createJobsForWorkspace;
15647
+ //# sourceMappingURL=createJobsForWorkspace.js.map
15648
+
15649
+ /***/ }),
15650
+
15215
15651
  /***/ 39192:
15216
15652
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
15217
15653
 
@@ -15299,7 +15735,7 @@ var createGitlabJobs_1 = __nccwpck_require__(58862);
15299
15735
  var createGitlabPipeline_1 = __nccwpck_require__(66551);
15300
15736
  var gitlabReleaseJobs_1 = __nccwpck_require__(16564);
15301
15737
  var createMainPipeline = function (pipelineType, config) { return __awaiter(void 0, void 0, void 0, function () {
15302
- var stages, allJobsPerTrigger, allJobs;
15738
+ var stages, allJobsPerTrigger, allWorkspaceJobs, allComponentJobs, allJobs;
15303
15739
  return __generator(this, function (_a) {
15304
15740
  switch (_a.label) {
15305
15741
  case 0:
@@ -15316,20 +15752,30 @@ var createMainPipeline = function (pipelineType, config) { return __awaiter(void
15316
15752
  case 2: return [2 /*return*/, _b.sent()];
15317
15753
  }
15318
15754
  });
15319
- }); }))];
15755
+ }); })).then(function (j) { return j.flat(); })];
15320
15756
  case 1:
15321
15757
  allJobsPerTrigger = _a.sent();
15322
- allJobs = allJobsPerTrigger
15323
- .flat()
15758
+ allWorkspaceJobs = allJobsPerTrigger
15759
+ .filter(function (j) { return j.context.type === "workspace"; }) // sort by componentName in the same order as they appear in the config
15760
+ // this is purely for better readability in git diffs when you add new components
15761
+ .sort(function (a, b) {
15762
+ var _a;
15763
+ var workspaceNames = Object.keys((_a = config.builds) !== null && _a !== void 0 ? _a : {});
15764
+ var aIndex = workspaceNames.findIndex(function (c) { return c === a.context.name; });
15765
+ var bIndex = workspaceNames.findIndex(function (c) { return c === b.context.name; });
15766
+ return aIndex - bIndex;
15767
+ });
15768
+ allComponentJobs = allJobsPerTrigger
15769
+ .filter(function (j) { return j.context.type === "component"; })
15324
15770
  // sort by componentName in the same order as they appear in the config
15325
15771
  // this is purely for better readability in git diffs when you add new components
15326
15772
  .sort(function (a, b) {
15327
15773
  var componentNames = Object.keys(config.components);
15328
- var aIndex = componentNames.findIndex(function (c) { return c === a.context.componentName; });
15329
- var bIndex = componentNames.findIndex(function (c) { return c === b.context.componentName; });
15774
+ var aIndex = componentNames.findIndex(function (c) { return c === a.context.name; });
15775
+ var bIndex = componentNames.findIndex(function (c) { return c === b.context.name; });
15330
15776
  return aIndex - bIndex;
15331
- })
15332
- .reduce(function (acc, _a) {
15777
+ });
15778
+ allJobs = __spreadArray(__spreadArray([], __read(allWorkspaceJobs), false), __read(allComponentJobs), false).reduce(function (acc, _a) {
15333
15779
  var _b, _c;
15334
15780
  var gitlabJob = _a.gitlabJob, name = _a.name;
15335
15781
  // merge jobs, if a job is already there, merge the rules
@@ -15648,59 +16094,63 @@ var utils_1 = __nccwpck_require__(32497);
15648
16094
  var gitlab_1 = __nccwpck_require__(38490);
15649
16095
  var removeUndefined_1 = __nccwpck_require__(61073);
15650
16096
  exports.GITLAB_ENVIRONMENT_URL_VARIABLE = "CL_GITLAB_ENVIRONMENT_URL";
15651
- var getFullJobName = function (name, componentName, env) {
16097
+ var getFullJobName = function (_a) {
16098
+ var type = _a.type, name = _a.name, baseName = _a.baseName, allJobs = _a.allJobs, env = _a.env;
16099
+ var shouldAddIcon = allJobs.workspaces.length > 0;
16100
+ var icon = type === "component" ? "🔹" : "🔸";
16101
+ var prefix = shouldAddIcon ? icon + " " : "";
15652
16102
  if (env) {
15653
- return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
16103
+ return "".concat(prefix).concat(baseName, " ").concat(name, " | ").concat(env, " ");
15654
16104
  }
15655
- return "".concat(componentName, " ").concat(name);
16105
+ return "".concat(prefix).concat(baseName, " ").concat(name);
15656
16106
  };
15657
- var getFullReferencedJobName = function (referencedJobName, componentName, env, allJobs) {
16107
+ var getFullReferencedJobNameFromComponent = function (referencedJobName, componentName, env, allJobs) {
15658
16108
  var _a, _b;
15659
- var referencedJob = (_b = (_a = allJobs
15660
- .find(function (j) { return j.context.componentName === componentName && j.context.env === env; })) === null || _a === void 0 ? void 0 : _a.jobs) === null || _b === void 0 ? void 0 : _b.find(function (j) { return j.name === referencedJobName; });
16109
+ var referencedJob = (_b = (_a = allJobs.components
16110
+ .find(function (j) { return j.context.name === componentName && j.context.env === env; })) === null || _a === void 0 ? void 0 : _a.jobs) === null || _b === void 0 ? void 0 : _b.find(function (j) { return j.name === referencedJobName; });
15661
16111
  if (!referencedJob) {
15662
16112
  throw new Error("unknown job referenced: '".concat(referencedJobName, "' from '").concat(env, ":").concat(componentName, "'"));
15663
16113
  }
15664
16114
  var envToSet = referencedJob.envMode !== "none" ? env : null;
15665
- return getFullJobName(referencedJobName, componentName, envToSet);
16115
+ return getFullJobName({
16116
+ type: "component",
16117
+ name: referencedJobName,
16118
+ baseName: componentName,
16119
+ env: envToSet,
16120
+ allJobs: allJobs,
16121
+ });
16122
+ };
16123
+ var getFullReferencedJobNameFromWorkspace = function (referencedJobName, workspaceName, env, allJobs) {
16124
+ var _a, _b;
16125
+ var referencedJob = (_b = (_a = allJobs.workspaces
16126
+ .find(function (w) { return w.context.name === workspaceName; })) === null || _a === void 0 ? void 0 : _a.jobs) === null || _b === void 0 ? void 0 : _b.find(function (j) { return j.name === referencedJobName; });
16127
+ if (!referencedJob) {
16128
+ throw new Error("unknown job referenced: '".concat(referencedJobName, "' from workspace ").concat(env, ":").concat(workspaceName, "'"));
16129
+ }
16130
+ var envToSet = referencedJob.envMode !== "none" ? env : null;
16131
+ return getFullJobName({
16132
+ type: "workspace",
16133
+ name: referencedJobName,
16134
+ baseName: workspaceName,
16135
+ env: envToSet,
16136
+ allJobs: allJobs,
16137
+ });
15666
16138
  };
15667
16139
  var getJobName = function (need) {
15668
16140
  return (0, lodash_1.isObject)(need) ? need.job : need;
15669
16141
  };
15670
- var makeGitlabJob = function (context, _a, allJobs, baseRules) {
15671
- var _b, _c;
15672
- var environment = _a.environment, envMode = _a.envMode, needsStages = _a.needsStages, needsOtherComponent = _a.needsOtherComponent, name = _a.name, needs = _a.needs, jobTags = _a.jobTags, script = _a.script, variables = _a.variables, runnerVariables = _a.runnerVariables, when = _a.when, job = __rest(_a, ["environment", "envMode", "needsStages", "needsOtherComponent", "name", "needs", "jobTags", "script", "variables", "runnerVariables", "when"]);
16142
+ var makeGitlabJob = function (context, job, allJobs, baseRules) {
16143
+ var _a, _b;
16144
+ var environment = job.environment, envMode = job.envMode, needsStages = job.needsStages, needsOtherComponent = job.needsOtherComponent, name = job.name, needs = job.needs, jobTags = job.jobTags, script = job.script, variables = job.variables, runnerVariables = job.runnerVariables, when = job.when, rest = __rest(job, ["environment", "envMode", "needsStages", "needsOtherComponent", "name", "needs", "jobTags", "script", "variables", "runnerVariables", "when"]);
15673
16145
  var stage = envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(context.env) : job.stage;
15674
- var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
15675
- var _a, _b, _c;
15676
- var referencedComponentName = context.componentName;
15677
- var allJobNamesFromThatStage = (_c = (_b = (_a = allJobs
15678
- .filter(function (j) {
15679
- return j.context.componentName === referencedComponentName &&
15680
- j.context.env === context.env;
15681
- })
15682
- .flatMap(function (j) { return j.jobs; })) === null || _a === void 0 ? void 0 : _a.filter(function (j) { return j.stage === n.stage; })) === null || _b === void 0 ? void 0 : _b.map(function (j) { return j.name; })) !== null && _c !== void 0 ? _c : [];
15683
- return allJobNamesFromThatStage.map(function (job) {
15684
- var _a;
15685
- return ({
15686
- job: job,
15687
- artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
15688
- componentName: referencedComponentName,
15689
- });
15690
- });
16146
+ var deduplicatedGitlabNeeds = getGitlabNeeds(context, job, allJobs);
16147
+ var fullJobName = getFullJobName({
16148
+ type: context.type,
16149
+ name: name,
16150
+ baseName: context.name,
16151
+ env: envMode !== "none" ? context.env : undefined,
16152
+ allJobs: allJobs,
15691
16153
  });
15692
- var cleanedNeeds = __spreadArray(__spreadArray(__spreadArray([], __read((needsFromStages !== null && needsFromStages !== void 0 ? needsFromStages : [])), false), __read((needs !== null && needs !== void 0 ? needs : [])), false), __read((needsOtherComponent !== null && needsOtherComponent !== void 0 ? needsOtherComponent : [])), false);
15693
- var gitlabNeeds = cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
15694
- var _a;
15695
- return (0, lodash_1.isObject)(n)
15696
- ? {
15697
- job: getFullReferencedJobName(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : context.componentName, context.env, allJobs),
15698
- artifacts: n.artifacts,
15699
- }
15700
- : getFullReferencedJobName(n, context.componentName, context.env, allJobs);
15701
- }).sort(function (a, b) { return getJobName(a).localeCompare(getJobName(b)); });
15702
- var deduplicatedGitlabNeeds = __spreadArray([], __read(new Map(gitlabNeeds.map(function (n) { return [(0, lodash_1.isObject)(n) ? n.job : n, n]; })).values()), false);
15703
- var fullJobName = getFullJobName(name, context.componentName, envMode !== "none" ? context.env : undefined);
15704
16154
  // backwards compatibility, some may still use KUBERNETES_CPU_REQUEST, KUBERNETES_MEMORY_REQUEST, etc. in variables.
15705
16155
  // those should now be set in the runnerVariables as they don't work in the variables key of the catladder job, becuase those get injected
15706
16156
  var PIPELINE_RUNNER_VARIABLES = [
@@ -15723,25 +16173,30 @@ var makeGitlabJob = function (context, _a, allJobs, baseRules) {
15723
16173
  if (Object.keys(legacyRunnerVariables).length > 0) {
15724
16174
  console.warn("Legacy variables detected in ".concat(fullJobName, ": ").concat(Object.keys(legacyRunnerVariables).join(", "), ". Please move them to the runnerVariables key."));
15725
16175
  }
15726
- var rules = __spreadArray(__spreadArray([], __read(((_b = job.rules) !== null && _b !== void 0 ? _b : [])), false), __read((baseRules
16176
+ var rules = __spreadArray(__spreadArray([], __read(((_a = job.rules) !== null && _a !== void 0 ? _a : [])), false), __read((baseRules
15727
16177
  ? baseRules.map(function (rule) { return (__assign({ when: when }, rule)); })
15728
16178
  : when
15729
16179
  ? [{ when: when }]
15730
16180
  : [])), false);
15731
- var modified = addGitlabEnvironment(context, environment, __assign(__assign({}, job), { rules: rules.length > 0 ? rules : undefined, variables: __assign(__assign({}, legacyRunnerVariables), runnerVariables), script: __spreadArray(__spreadArray([], __read(varsInjectScripts), false), __read(((_c = script === null || script === void 0 ? void 0 : script.filter(utils_1.notNil)) !== null && _c !== void 0 ? _c : [])), false), tags: jobTags, stage: stage,
16181
+ var gitlabJob = __assign(__assign({}, rest), { rules: rules.length > 0 ? rules : undefined, variables: __assign(__assign({}, legacyRunnerVariables), runnerVariables), script: __spreadArray(__spreadArray([], __read(varsInjectScripts), false), __read(((_b = script === null || script === void 0 ? void 0 : script.filter(utils_1.notNil)) !== null && _b !== void 0 ? _b : [])), false), tags: jobTags, stage: stage,
15732
16182
  // sort in a predictable manner for snapshot tests
15733
- needs: deduplicatedGitlabNeeds, retry: defaults_1.BASE_RETRY, interruptible: true }), context.componentName, context.env, allJobs);
16183
+ needs: deduplicatedGitlabNeeds, retry: defaults_1.BASE_RETRY, interruptible: true });
16184
+ var modified = addGitlabEnvironment(context, environment, gitlabJob, allJobs);
15734
16185
  return [fullJobName, (0, removeUndefined_1.removeUndefined)(modified)];
15735
16186
  };
15736
16187
  exports.makeGitlabJob = makeGitlabJob;
15737
- var addGitlabEnvironment = function (context, environment, job, componentName, env, // TODO: we could actually pull this from contxt
15738
- allJobs) {
16188
+ var addGitlabEnvironment = function (context, catladderJobEnvironment, job, allJobs) {
15739
16189
  var _a, _b;
15740
- if (!environment) {
16190
+ if (!catladderJobEnvironment) {
16191
+ return job;
16192
+ }
16193
+ if (context.type !== "component") {
16194
+ // don't add enviornment for workspace jobs atm.
15741
16195
  return job;
15742
16196
  }
15743
- var _c = context.environment, url = _c.url, envType = _c.envType;
15744
- var on_stop = environment.on_stop, restEnvironment = __rest(environment, ["on_stop"]);
16197
+ var env = context.env, name = context.name, environment = context.environment;
16198
+ var url = environment.url, envType = environment.envType;
16199
+ var on_stop = catladderJobEnvironment.on_stop, restEnvironment = __rest(catladderJobEnvironment, ["on_stop"]);
15745
16200
  // those can be dynamic, so we therefore have to do this: https://docs.gitlab.com/ee/ci/environments/#set-a-dynamic-environment-url
15746
16201
  var dotEnvFile = "gitlab_environment.env";
15747
16202
  var scriptToAdd = [
@@ -15749,11 +16204,11 @@ allJobs) {
15749
16204
  ];
15750
16205
  // this is NOT a bashVariable since it NEEDS to be used as a string in gitlab
15751
16206
  var gitlabEnvironmentName = envType === "review"
15752
- ? "".concat(env, "/$CI_COMMIT_REF_NAME/").concat(componentName) // FIXME: should be replaced with mr name as well
15753
- : "".concat(env, "/").concat(componentName);
16207
+ ? "".concat(env, "/$CI_COMMIT_REF_NAME/").concat(name) // FIXME: should be replaced with mr name as well
16208
+ : "".concat(env, "/").concat(name);
15754
16209
  return __assign(__assign({}, job), { environment: __assign(__assign({ name: gitlabEnvironmentName, url: "$".concat(exports.GITLAB_ENVIRONMENT_URL_VARIABLE) }, (on_stop
15755
16210
  ? {
15756
- on_stop: getFullReferencedJobName(on_stop, componentName, env, allJobs),
16211
+ on_stop: getFullReferencedJobNameFromComponent(on_stop, name, env, allJobs),
15757
16212
  }
15758
16213
  : {})), restEnvironment), artifacts: (0, lodash_1.merge)((_a = job.artifacts) !== null && _a !== void 0 ? _a : {}, {
15759
16214
  reports: {
@@ -15763,7 +16218,8 @@ allJobs) {
15763
16218
  };
15764
16219
  var createGitlabJobs = function (allJobs, baseRules) { return __awaiter(void 0, void 0, void 0, function () {
15765
16220
  return __generator(this, function (_a) {
15766
- return [2 /*return*/, allJobs.flatMap(function (_a) {
16221
+ // TODO: add workspace jobs
16222
+ return [2 /*return*/, __spreadArray(__spreadArray([], __read(allJobs.workspaces), false), __read(allJobs.components), false).flatMap(function (_a) {
15767
16223
  var context = _a.context, jobs = _a.jobs;
15768
16224
  return jobs.map(function (job) {
15769
16225
  var _a = __read((0, exports.makeGitlabJob)(context, job, allJobs, baseRules), 2), fullJobName = _a[0], gitlabJob = _a[1];
@@ -15777,6 +16233,103 @@ var createGitlabJobs = function (allJobs, baseRules) { return __awaiter(void 0,
15777
16233
  });
15778
16234
  }); };
15779
16235
  exports.createGitlabJobs = createGitlabJobs;
16236
+ function getGitlabNeeds(context, job, allJobs) {
16237
+ var needs = context.type === "workspace"
16238
+ ? getGitlabNeedsForWorkspaceJob(context, job, allJobs)
16239
+ : getGitlabNeedsForComponentJob(context, job, allJobs);
16240
+ return deduplicateNeeds(needs);
16241
+ }
16242
+ function deduplicateNeeds(needs) {
16243
+ return needs
16244
+ ? __spreadArray([], __read(new Map(needs.map(function (n) { return [(0, lodash_1.isObject)(n) ? n.job : n, n]; })).values()), false) : undefined;
16245
+ }
16246
+ function getGitlabNeedsForComponentJob(context, _a, allJobs) {
16247
+ var needsStages = _a.needsStages, needs = _a.needs, needsOtherComponent = _a.needsOtherComponent;
16248
+ var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
16249
+ var _a, _b, _c, _d, _e, _f, _g, _h;
16250
+ var componentName = context.name;
16251
+ if (!n.workspaceName) {
16252
+ var allJobNamesFromThatStage = (_c = (_b = (_a = allJobs.components
16253
+ .filter(function (j) {
16254
+ return j.context.name === componentName && j.context.env === context.env;
16255
+ })
16256
+ .flatMap(function (j) { return j.jobs; })) === null || _a === void 0 ? void 0 : _a.filter(function (j) { return j.stage === n.stage; })) === null || _b === void 0 ? void 0 : _b.map(function (j) { return j.name; })) !== null && _c !== void 0 ? _c : [];
16257
+ return allJobNamesFromThatStage.map(function (job) {
16258
+ var _a;
16259
+ return ({
16260
+ job: job,
16261
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
16262
+ componentName: componentName,
16263
+ });
16264
+ });
16265
+ }
16266
+ else {
16267
+ var allJobNamesFromThatStage = (_h = (_g = (_f = (_e = (_d = allJobs.workspaces
16268
+ .find(function (w) {
16269
+ return w.context.name === n.workspaceName &&
16270
+ w.context.env === context.env;
16271
+ })) === null || _d === void 0 ? void 0 : _d.jobs) === null || _e === void 0 ? void 0 : _e.flatMap(function (j) { return j; })) === null || _f === void 0 ? void 0 : _f.filter(function (j) { return j.stage === n.stage; })) === null || _g === void 0 ? void 0 : _g.map(function (j) { return j.name; })) !== null && _h !== void 0 ? _h : [];
16272
+ return allJobNamesFromThatStage.map(function (job) {
16273
+ var _a;
16274
+ return ({
16275
+ job: job,
16276
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
16277
+ workspaceName: n.workspaceName,
16278
+ });
16279
+ });
16280
+ }
16281
+ });
16282
+ var cleanedNeeds = __spreadArray(__spreadArray(__spreadArray([], __read((needsFromStages !== null && needsFromStages !== void 0 ? needsFromStages : [])), false), __read((needs !== null && needs !== void 0 ? needs : [])), false), __read((needsOtherComponent !== null && needsOtherComponent !== void 0 ? needsOtherComponent : [])), false);
16283
+ return cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
16284
+ var _a;
16285
+ return (0, lodash_1.isObject)(n)
16286
+ ? "workspaceName" in n
16287
+ ? {
16288
+ job: getFullReferencedJobNameFromWorkspace(n.job, n.workspaceName, context.env, allJobs),
16289
+ artifacts: n.artifacts,
16290
+ }
16291
+ : {
16292
+ job: getFullReferencedJobNameFromComponent(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : context.name, context.env, allJobs),
16293
+ artifacts: n.artifacts,
16294
+ }
16295
+ : getFullReferencedJobNameFromComponent(n, context.name, context.env, allJobs);
16296
+ }).sort(function (a, b) { return getJobName(a).localeCompare(getJobName(b)); });
16297
+ }
16298
+ /**
16299
+ *
16300
+ *unclear whether we actually need this. So far jobs in a workspace don't have needs to other jobs from the same workspace
16301
+ */
16302
+ function getGitlabNeedsForWorkspaceJob(context, _a, allJobs) {
16303
+ var needsStages = _a.needsStages, needs = _a.needs;
16304
+ var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
16305
+ var _a, _b, _c, _d;
16306
+ var workspaceName = (_a = n.workspaceName) !== null && _a !== void 0 ? _a : context.name;
16307
+ var allJobNamesFromThatStage = (_d = (_c = (_b = allJobs.workspaces
16308
+ .filter(function (j) {
16309
+ return j.context.name === workspaceName && j.context.env === context.env;
16310
+ })
16311
+ .flatMap(function (j) { return j.jobs; })) === null || _b === void 0 ? void 0 : _b.filter(function (j) { return j.stage === n.stage; })) === null || _c === void 0 ? void 0 : _c.map(function (j) { return j.name; })) !== null && _d !== void 0 ? _d : [];
16312
+ return allJobNamesFromThatStage.map(function (job) {
16313
+ var _a;
16314
+ return ({
16315
+ job: job,
16316
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
16317
+ workspaceName: workspaceName,
16318
+ });
16319
+ });
16320
+ });
16321
+ var cleanedNeeds = __spreadArray(__spreadArray([], __read((needsFromStages !== null && needsFromStages !== void 0 ? needsFromStages : [])), false), __read((needs !== null && needs !== void 0 ? needs : [])), false);
16322
+ return cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
16323
+ return (0, lodash_1.isObject)(n)
16324
+ ? {
16325
+ job: getFullReferencedJobNameFromWorkspace(n.job, "workspaceName" in n && n.workspaceName
16326
+ ? n.workspaceName
16327
+ : context.name, context.env, allJobs),
16328
+ artifacts: n.artifacts,
16329
+ }
16330
+ : getFullReferencedJobNameFromWorkspace(n, context.name, context.env, allJobs);
16331
+ }).sort(function (a, b) { return getJobName(a).localeCompare(getJobName(b)); });
16332
+ }
15780
16333
  //# sourceMappingURL=createGitlabJobs.js.map
15781
16334
 
15782
16335
  /***/ }),
@@ -15993,6 +16546,17 @@ __exportStar(__nccwpck_require__(16564), exports);
15993
16546
 
15994
16547
  "use strict";
15995
16548
 
16549
+ var __assign = (this && this.__assign) || function () {
16550
+ __assign = Object.assign || function(t) {
16551
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
16552
+ s = arguments[i];
16553
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
16554
+ t[p] = s[p];
16555
+ }
16556
+ return t;
16557
+ };
16558
+ return __assign.apply(this, arguments);
16559
+ };
15996
16560
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15997
16561
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15998
16562
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -16055,25 +16619,20 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
16055
16619
  return to.concat(ar || Array.prototype.slice.call(from));
16056
16620
  };
16057
16621
  Object.defineProperty(exports, "__esModule", ({ value: true }));
16058
- exports.getPackageManagerInfoForComponent = void 0;
16622
+ exports.getPackageManagerInfoBase = exports.getPackageManagerInfoForComponent = void 0;
16059
16623
  var fs_1 = __nccwpck_require__(57147);
16060
16624
  var path_1 = __nccwpck_require__(71017);
16061
16625
  var path_equal_1 = __nccwpck_require__(84843);
16062
16626
  var yarnUtils_1 = __nccwpck_require__(97843);
16063
16627
  var getPackageManagerInfoForComponent = function (config, componentName) { return __awaiter(void 0, void 0, void 0, function () {
16064
- var version, isClassic, component, workspaces, currentWorkspace, componentIsInWorkspace, workspaceRoot, packageJson, workspacePackageJson, lockFile, configFiles, configFilePaths, currentWorkspaceDependencies, pathsToCopyInDocker;
16628
+ var baseInfo, workspaces, component, currentWorkspace, componentIsInWorkspace, workspaceRoot, packageJson, workspacePackageJson, lockFile, configFiles, configFilePaths, currentWorkspaceDependencies, pathsToCopyInDocker;
16065
16629
  return __generator(this, function (_a) {
16066
16630
  switch (_a.label) {
16067
- case 0: return [4 /*yield*/, (0, yarnUtils_1.getYarnVersion)()];
16631
+ case 0: return [4 /*yield*/, (0, exports.getPackageManagerInfoBase)()];
16068
16632
  case 1:
16069
- version = _a.sent();
16070
- if (!version)
16071
- throw new Error("could not get yarn version");
16072
- isClassic = version.startsWith("1");
16633
+ baseInfo = _a.sent();
16634
+ workspaces = baseInfo.workspaces;
16073
16635
  component = config.components[componentName];
16074
- return [4 /*yield*/, (0, yarnUtils_1.getWorkspaces)(isClassic)];
16075
- case 2:
16076
- workspaces = _a.sent();
16077
16636
  currentWorkspace = workspaces.find(function (w) {
16078
16637
  return (0, path_equal_1.pathEqual)(component.dir, w.location);
16079
16638
  });
@@ -16096,20 +16655,35 @@ var getPackageManagerInfoForComponent = function (config, componentName) { retur
16096
16655
  ], __read((workspacePackageJson ? [workspacePackageJson] : [])), false), [
16097
16656
  lockFile
16098
16657
  ], false), __read(configFilePaths), false), __read(currentWorkspaceDependencies), false);
16658
+ return [2 /*return*/, __assign(__assign({}, baseInfo), { currentWorkspace: currentWorkspace, currentWorkspaceDependencies: currentWorkspaceDependencies, componentIsInWorkspace: componentIsInWorkspace, pathsToCopyInDocker: pathsToCopyInDocker })];
16659
+ }
16660
+ });
16661
+ }); };
16662
+ exports.getPackageManagerInfoForComponent = getPackageManagerInfoForComponent;
16663
+ // TODO: memoizee
16664
+ var getPackageManagerInfoBase = function () { return __awaiter(void 0, void 0, void 0, function () {
16665
+ var version, isClassic, workspaces;
16666
+ return __generator(this, function (_a) {
16667
+ switch (_a.label) {
16668
+ case 0: return [4 /*yield*/, (0, yarnUtils_1.getYarnVersion)()];
16669
+ case 1:
16670
+ version = _a.sent();
16671
+ if (!version)
16672
+ throw new Error("could not get yarn version");
16673
+ isClassic = version.startsWith("1");
16674
+ return [4 /*yield*/, (0, yarnUtils_1.getWorkspaces)(isClassic)];
16675
+ case 2:
16676
+ workspaces = _a.sent();
16099
16677
  return [2 /*return*/, {
16100
16678
  type: "yarn",
16101
16679
  workspaces: workspaces,
16102
16680
  version: version,
16103
16681
  isClassic: isClassic,
16104
- currentWorkspace: currentWorkspace,
16105
- currentWorkspaceDependencies: currentWorkspaceDependencies,
16106
- componentIsInWorkspace: componentIsInWorkspace,
16107
- pathsToCopyInDocker: pathsToCopyInDocker,
16108
16682
  }];
16109
16683
  }
16110
16684
  });
16111
16685
  }); };
16112
- exports.getPackageManagerInfoForComponent = getPackageManagerInfoForComponent;
16686
+ exports.getPackageManagerInfoBase = getPackageManagerInfoBase;
16113
16687
  //# sourceMappingURL=packageManager.js.map
16114
16688
 
16115
16689
  /***/ }),
@@ -16429,6 +17003,15 @@ exports.isKnowEnvType = isKnowEnvType;
16429
17003
  "use strict";
16430
17004
 
16431
17005
  Object.defineProperty(exports, "__esModule", ({ value: true }));
17006
+ exports.componentContextHasWorkspaceBuild = exports.componentContextIsStandaloneBuild = void 0;
17007
+ var componentContextIsStandaloneBuild = function (context) {
17008
+ return context.build.type === "standalone";
17009
+ };
17010
+ exports.componentContextIsStandaloneBuild = componentContextIsStandaloneBuild;
17011
+ var componentContextHasWorkspaceBuild = function (context) {
17012
+ return context.build.type === "fromWorkspace";
17013
+ };
17014
+ exports.componentContextHasWorkspaceBuild = componentContextHasWorkspaceBuild;
16432
17015
  //# sourceMappingURL=context.js.map
16433
17016
 
16434
17017
  /***/ }),