@catladder/cli 0.0.0-main-7be9a47d → 0.0.0-main-d50a9a7c

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 +886 -269
  2. package/dist/bundles/cli/index.js +899 -306
  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 -2
  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 +1 -25
  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 -4
  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 +2 -2
  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 +77 -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 +2 -2
  130. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +2 -10
  131. package/src/apps/cli/commands/project/setup/setupCloudRun.ts +1 -1
  132. package/src/apps/cli/commands/project/setup/setupContext.ts +2 -4
  133. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +2 -2
  134. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +1 -11
  135. package/src/gcloud/serviceAccounts.ts +3 -3
@@ -2195,6 +2195,94 @@ exports["default"] = replaceAsync;
2195
2195
 
2196
2196
  /***/ }),
2197
2197
 
2198
+ /***/ 8774:
2199
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
2200
+
2201
+ "use strict";
2202
+
2203
+ var __assign = (this && this.__assign) || function () {
2204
+ __assign = Object.assign || function(t) {
2205
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
2206
+ s = arguments[i];
2207
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
2208
+ t[p] = s[p];
2209
+ }
2210
+ return t;
2211
+ };
2212
+ return __assign.apply(this, arguments);
2213
+ };
2214
+ var __read = (this && this.__read) || function (o, n) {
2215
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
2216
+ if (!m) return o;
2217
+ var i = m.call(o), r, ar = [], e;
2218
+ try {
2219
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
2220
+ }
2221
+ catch (error) { e = { error: error }; }
2222
+ finally {
2223
+ try {
2224
+ if (r && !r.done && (m = i["return"])) m.call(i);
2225
+ }
2226
+ finally { if (e) throw e.error; }
2227
+ }
2228
+ return ar;
2229
+ };
2230
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2231
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
2232
+ if (ar || !(i in from)) {
2233
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
2234
+ ar[i] = from[i];
2235
+ }
2236
+ }
2237
+ return to.concat(ar || Array.prototype.slice.call(from));
2238
+ };
2239
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
2240
+ exports.createBuildJobArtifacts = void 0;
2241
+ var path_1 = __nccwpck_require__(1017);
2242
+ var types_1 = __nccwpck_require__(1853);
2243
+ var lodash_1 = __nccwpck_require__(3255);
2244
+ var writeDotEnv_1 = __nccwpck_require__(8052);
2245
+ var createBuildJobArtifacts = function (context) {
2246
+ var _a, _b;
2247
+ var paths = context.type === "workspace"
2248
+ ? context.components.flatMap(function (c) { return getArtifactsPathForComponent(c); })
2249
+ : getArtifactsPathForComponent(context, ["__build_info.json"]);
2250
+ // esxclude .env files if generated
2251
+ var exclude = context.type === "workspace"
2252
+ ? context.components.flatMap(function (c) { return getDotEnvPathsForComponent(c); })
2253
+ : getDotEnvPathsForComponent(context);
2254
+ 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:
2255
+ // TODO: support for junit reports in other builds
2256
+ context.type === "component" && (0, types_1.componentContextIsStandaloneBuild)(context)
2257
+ ? {
2258
+ 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) {
2259
+ return (0, path_1.join)(context.build.dir, p);
2260
+ }),
2261
+ }
2262
+ : {} });
2263
+ };
2264
+ exports.createBuildJobArtifacts = createBuildJobArtifacts;
2265
+ var getArtifactsPathForComponent = function (c, additionalPaths) {
2266
+ var _a, _b;
2267
+ 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) {
2268
+ return c.build
2269
+ // in theory, we only need "direct",
2270
+ // but in some cases project may have packages in the workspace that create build artifacts, which aren't components
2271
+ // this highly depends on the build tool. To be safe, we get all
2272
+ .getComponentDirs("all")
2273
+ .flatMap(function (cDir) { return (0, path_1.join)(cDir, artifact); });
2274
+ });
2275
+ };
2276
+ var getDotEnvPathsForComponent = function (c) {
2277
+ if ((0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(c)) {
2278
+ return [(0, path_1.join)(c.build.dir, ".env")];
2279
+ }
2280
+ return [];
2281
+ };
2282
+ //# sourceMappingURL=createBuildJobArtifact.js.map
2283
+
2284
+ /***/ }),
2285
+
2198
2286
  /***/ 2786:
2199
2287
  /***/ ((__unused_webpack_module, exports) => {
2200
2288
 
@@ -2267,15 +2355,15 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2267
2355
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2268
2356
  exports.createAppBuildJob = void 0;
2269
2357
  var lodash_1 = __nccwpck_require__(3255);
2270
- var path_1 = __nccwpck_require__(1017);
2271
2358
  var __1 = __nccwpck_require__(603);
2272
2359
  var utils_1 = __nccwpck_require__(2497);
2360
+ var createBuildJobArtifact_1 = __nccwpck_require__(8774);
2273
2361
  var yarn_1 = __nccwpck_require__(5043);
2274
2362
  var constants_1 = __nccwpck_require__(2786);
2275
2363
  var writeBuildInfo_1 = __nccwpck_require__(9578);
2276
2364
  var writeDotEnv_1 = __nccwpck_require__(8052);
2277
2365
  var createAppBuildJob = function (context, _a) {
2278
- var _b, _c, _d, _e, _f;
2366
+ var _b, _c, _d;
2279
2367
  var script = _a.script, variables = _a.variables, runnerVariables = _a.runnerVariables, def = __rest(_a, ["script", "variables", "runnerVariables"]);
2280
2368
  return (0, lodash_1.merge)({
2281
2369
  name: constants_1.APP_BUILD_JOB_NAME,
@@ -2284,20 +2372,21 @@ var createAppBuildJob = function (context, _a) {
2284
2372
  image: (0, __1.getRunnerImage)("jobs-default"),
2285
2373
  needs: [],
2286
2374
  cache: [],
2287
- 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 : {})),
2375
+ variables: __assign(__assign({}, (variables !== null && variables !== void 0 ? variables : {})), (context.type === "component"
2376
+ ? __assign(__assign(__assign({}, context.environment.envVars), context.environment.jobOnlyVars.build.envVars), ((_b = context.build.config.extraVars) !== null && _b !== void 0 ? _b : {})) : {})),
2288
2377
  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 : {})),
2289
- script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(((0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(context)
2290
- ? (0, writeDotEnv_1.writeDotEnv)(context)
2291
- : [])), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), [
2378
+ script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((context.type === "component"
2379
+ ? (0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(context)
2380
+ ? (0, writeDotEnv_1.writeDotEnv)(context)
2381
+ : []
2382
+ : context.type === "workspace"
2383
+ ? context.components
2384
+ .filter(function (c) { return (0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(c); })
2385
+ .flatMap(function (c) { return (0, writeDotEnv_1.writeDotEnv)(c); })
2386
+ : [])), false), __read((context.type === "component" ? (0, writeBuildInfo_1.writeBuildInfo)(context) : [])), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), [
2292
2387
  "cd ".concat(context.build.dir)
2293
2388
  ], false), __read(((_d = (0, utils_1.ensureArray)(script)) !== null && _d !== void 0 ? _d : [])), false),
2294
- artifacts: __assign(__assign({ paths: [(0, path_1.join)(context.build.dir, "__build_info.json")] }, ((0, writeDotEnv_1.componentContextNeedsBuildTimeDotEnv)(context)
2295
- ? { exclude: [(0, path_1.join)(context.build.dir, ".env")] }
2296
- : {})), { reports: {
2297
- 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) {
2298
- return (0, path_1.join)(context.build.dir, p);
2299
- }),
2300
- } }),
2389
+ artifacts: (0, createBuildJobArtifact_1.createBuildJobArtifacts)(context),
2301
2390
  }, def);
2302
2391
  };
2303
2392
  exports.createAppBuildJob = createAppBuildJob;
@@ -2413,23 +2502,41 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2413
2502
  return to.concat(ar || Array.prototype.slice.call(from));
2414
2503
  };
2415
2504
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2416
- exports.createBuildJobs = void 0;
2505
+ exports.createWorkspaceBuildJobs = exports.createComponentBuildJobs = void 0;
2417
2506
  var sbom_1 = __nccwpck_require__(4986);
2507
+ var context_1 = __nccwpck_require__(1724);
2418
2508
  var docker_1 = __nccwpck_require__(9641);
2419
2509
  var sbom_2 = __nccwpck_require__(7038);
2420
2510
  var constants_1 = __nccwpck_require__(2786);
2421
2511
  var createAppBuildJob_1 = __nccwpck_require__(7801);
2422
- var createBuildJobs = function (context, definitions) {
2512
+ var createComponentBuildJobs = function (context, definitions) {
2423
2513
  var _a;
2424
- return __spreadArray(__spreadArray(__spreadArray([], __read((definitions.appBuild
2514
+ return __spreadArray(__spreadArray(__spreadArray([], __read((definitions.appBuild && (0, context_1.componentContextIsStandaloneBuild)(context)
2425
2515
  ? [(0, createAppBuildJob_1.createAppBuildJob)(context, definitions.appBuild)]
2426
2516
  : [])), false), __read(((0, docker_1.requiresDockerBuild)(context)
2427
2517
  ? [
2428
- (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) })),
2518
+ (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 &&
2519
+ (0, context_1.componentContextIsStandaloneBuild)(context)
2520
+ ? [constants_1.APP_BUILD_JOB_NAME]
2521
+ : (0, context_1.componentContextHasWorkspaceBuild)(context)
2522
+ ? [
2523
+ {
2524
+ job: constants_1.APP_BUILD_JOB_NAME,
2525
+ artifacts: true,
2526
+ workspaceName: context.build.workspaceName,
2527
+ },
2528
+ ]
2529
+ : [])), false) })),
2429
2530
  ]
2430
2531
  : [])), false), __read(((0, sbom_1.sbomDeactivated)(context) ? [] : [(0, sbom_2.createSbomBuildJob)(context)])), false);
2431
2532
  };
2432
- exports.createBuildJobs = createBuildJobs;
2533
+ exports.createComponentBuildJobs = createComponentBuildJobs;
2534
+ var createWorkspaceBuildJobs = function (context, definitions) {
2535
+ return definitions.appBuild
2536
+ ? [(0, createAppBuildJob_1.createAppBuildJob)(context, definitions.appBuild)]
2537
+ : [];
2538
+ };
2539
+ exports.createWorkspaceBuildJobs = createWorkspaceBuildJobs;
2433
2540
  //# sourceMappingURL=index.js.map
2434
2541
 
2435
2542
  /***/ }),
@@ -2475,6 +2582,7 @@ var __read = (this && this.__read) || function (o, n) {
2475
2582
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2476
2583
  exports.componentContextNeedsBuildTimeDotEnv = exports.writeDotEnv = void 0;
2477
2584
  var lodash_1 = __nccwpck_require__(3255);
2585
+ var gitlab_1 = __nccwpck_require__(8490);
2478
2586
  /**
2479
2587
  * writes a .env file in the components folder
2480
2588
  * @param context
@@ -2494,9 +2602,9 @@ var writeDotEnv = function (context) {
2494
2602
  return "".concat(key, "=").concat(value === null || value === void 0 ? void 0 : value.toString().replaceAll("\n", "\\n"));
2495
2603
  })
2496
2604
  .join("\n");
2497
- return [
2605
+ return (0, gitlab_1.collapseableSection)("write-dotenv-" + context.name, "write dot env")([
2498
2606
  "cat <<EOF > ".concat(context.build.dir, "/.env\n").concat(keyValueString, "\nEOF"),
2499
- ];
2607
+ ]);
2500
2608
  };
2501
2609
  exports.writeDotEnv = writeDotEnv;
2502
2610
  var componentContextNeedsBuildTimeDotEnv = function (context) {
@@ -2539,7 +2647,6 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
2539
2647
  };
2540
2648
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2541
2649
  exports.createCustomBuildJobs = void 0;
2542
- var path_1 = __nccwpck_require__(1017);
2543
2650
  var utils_1 = __nccwpck_require__(2497);
2544
2651
  var docker_1 = __nccwpck_require__(9641);
2545
2652
  var types_1 = __nccwpck_require__(4466);
@@ -2550,12 +2657,12 @@ var RUNNER_BUILD_VARIABLES = {
2550
2657
  KUBERNETES_MEMORY_LIMIT: "4Gi",
2551
2658
  };
2552
2659
  var createCustomBuildJobs = function (context) {
2553
- var _a, _b, _c;
2660
+ var _a;
2554
2661
  var buildConfig = context.build.config;
2555
2662
  if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
2556
2663
  throw new Error("deploy config is not custom");
2557
2664
  }
2558
- return (0, base_1.createBuildJobs)(context, {
2665
+ return (0, base_1.createComponentBuildJobs)(context, {
2559
2666
  appBuild: buildConfig.buildCommand !== null
2560
2667
  ? {
2561
2668
  image: buildConfig.jobImage,
@@ -2563,15 +2670,6 @@ var createCustomBuildJobs = function (context) {
2563
2670
  cache: buildConfig.jobCache,
2564
2671
  services: buildConfig.jobServices,
2565
2672
  script: __spreadArray([], __read(((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : [])), false),
2566
- artifacts: {
2567
- paths: __spreadArray([
2568
- (0, path_1.join)(context.build.dir, "__build_info.json"),
2569
- (0, path_1.join)(context.build.dir, "dist")
2570
- ], __read(((_c = (_b = buildConfig.artifactsPaths) === null || _b === void 0 ? void 0 : _b.map(function (path) {
2571
- return (0, path_1.join)(context.build.dir, path);
2572
- })) !== null && _c !== void 0 ? _c : [])), false),
2573
- expire_in: "1 day",
2574
- },
2575
2673
  }
2576
2674
  : undefined,
2577
2675
  dockerBuild: {
@@ -2793,9 +2891,9 @@ var getDockerImageVariables = function (context) {
2793
2891
  : // gitlab registry:
2794
2892
  {
2795
2893
  DOCKER_REGISTRY: "$CI_REGISTRY",
2796
- DOCKER_CACHE_IMAGE: "$CI_REGISTRY_IMAGE/caches/" + context.componentName,
2894
+ DOCKER_CACHE_IMAGE: "$CI_REGISTRY_IMAGE/caches/" + context.name,
2797
2895
  // ONLY USED IN KUBERNETES
2798
- DOCKER_IMAGE_NAME: context.env + "/" + context.componentName,
2896
+ DOCKER_IMAGE_NAME: context.env + "/" + context.name,
2799
2897
  DOCKER_IMAGE: "$CI_REGISTRY_IMAGE/$DOCKER_IMAGE_NAME",
2800
2898
  })), { DOCKER_IMAGE_TAG: "$CI_COMMIT_SHA" });
2801
2899
  };
@@ -2876,10 +2974,10 @@ var BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS = {
2876
2974
  };
2877
2975
  var getDockerBuildScriptWithBuiltInDockerFile = function (context, defaultType) {
2878
2976
  var _a;
2879
- var type = "docker" in context.componentConfig.build &&
2880
- context.componentConfig.build.docker &&
2881
- "type" in context.componentConfig.build.docker
2882
- ? (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.type
2977
+ var type = "docker" in context.build.config &&
2978
+ context.build.config.docker &&
2979
+ "type" in context.build.config.docker
2980
+ ? (_a = context.build.config.docker) === null || _a === void 0 ? void 0 : _a.type
2883
2981
  : defaultType;
2884
2982
  return (0, exports.getDockerBuildDefaultScript)(context, type ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[type] : null);
2885
2983
  };
@@ -2924,41 +3022,47 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
2924
3022
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2925
3023
  };
2926
3024
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2927
- exports.BUILD_TYPES = void 0;
3025
+ exports.WORKSPACE_BUILD_TYPES = exports.BUILD_TYPES = void 0;
2928
3026
  var custom_1 = __nccwpck_require__(1183);
2929
3027
  var node_1 = __nccwpck_require__(5734);
2930
3028
  var rails_1 = __nccwpck_require__(8513);
2931
- __exportStar(__nccwpck_require__(4466), exports);
2932
3029
  __exportStar(__nccwpck_require__(5734), exports);
3030
+ __exportStar(__nccwpck_require__(4466), exports);
2933
3031
  exports.BUILD_TYPES = {
2934
3032
  node: {
2935
3033
  jobs: node_1.createNodeJobs,
2936
3034
  defaults: function () { return ({
2937
3035
  buildCommand: "yarn build",
2938
3036
  startCommand: "yarn start",
3037
+ artifactsPaths: ["dist", ".next"],
2939
3038
  }); },
2940
3039
  },
2941
3040
  "node-static": {
2942
3041
  jobs: node_1.createNodeJobs,
2943
3042
  defaults: function () { return ({
2944
3043
  buildCommand: "yarn build",
3044
+ artifactsPaths: ["dist"],
2945
3045
  }); },
2946
3046
  },
2947
3047
  storybook: {
2948
3048
  jobs: node_1.createStorybookJobs,
2949
3049
  defaults: function () { return ({
2950
3050
  buildCommand: ["yarn build-storybook --quiet -o ./dist"],
3051
+ artifactsPaths: ["dist"],
2951
3052
  }); },
2952
3053
  },
2953
3054
  meteor: {
2954
3055
  jobs: node_1.createMeteorJobs,
2955
3056
  defaults: function () { return ({
2956
3057
  startCommand: "node main.js",
3058
+ artifactsPaths: ["dist"],
2957
3059
  }); },
2958
3060
  },
2959
3061
  custom: {
2960
3062
  jobs: custom_1.createCustomJobs,
2961
- defaults: function () { return ({}); },
3063
+ defaults: function () { return ({
3064
+ artifactsPaths: ["dist"],
3065
+ }); },
2962
3066
  },
2963
3067
  rails: {
2964
3068
  jobs: rails_1.createRailsJobs,
@@ -2971,6 +3075,20 @@ exports.BUILD_TYPES = {
2971
3075
  }); },
2972
3076
  },
2973
3077
  };
3078
+ exports.WORKSPACE_BUILD_TYPES = {
3079
+ node: {
3080
+ jobs: node_1.createNodeJobs,
3081
+ defaults: function () { return ({
3082
+ buildCommand: "yarn build",
3083
+ lint: {
3084
+ command: "yarn lint",
3085
+ },
3086
+ test: {
3087
+ command: "yarn test",
3088
+ },
3089
+ }); },
3090
+ },
3091
+ };
2974
3092
  //# sourceMappingURL=index.js.map
2975
3093
 
2976
3094
  /***/ }),
@@ -3006,9 +3124,9 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3006
3124
  return to.concat(ar || Array.prototype.slice.call(from));
3007
3125
  };
3008
3126
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3009
- exports.createNodeBuildJobs = void 0;
3010
- var path_1 = __nccwpck_require__(1017);
3127
+ exports.createNodeDockerJobDefinition = exports.createNodeBuildJobDefinition = exports.createNodeBuildJobs = void 0;
3011
3128
  var runner_1 = __nccwpck_require__(4058);
3129
+ var context_1 = __nccwpck_require__(1724);
3012
3130
  var utils_1 = __nccwpck_require__(2497);
3013
3131
  var base_1 = __nccwpck_require__(9366);
3014
3132
  var docker_1 = __nccwpck_require__(9641);
@@ -3017,54 +3135,56 @@ var cache_1 = __nccwpck_require__(2026);
3017
3135
  var constants_1 = __nccwpck_require__(1765);
3018
3136
  var yarn_1 = __nccwpck_require__(5043);
3019
3137
  var createNodeBuildJobs = function (context) {
3020
- var _a, _b, _c, _d, _e;
3138
+ if (context.type === "workspace") {
3139
+ return (0, base_1.createWorkspaceBuildJobs)(context, {
3140
+ appBuild: (0, exports.createNodeBuildJobDefinition)(context),
3141
+ });
3142
+ }
3143
+ return (0, base_1.createComponentBuildJobs)(context, {
3144
+ appBuild: (0, context_1.componentContextIsStandaloneBuild)(context)
3145
+ ? (0, exports.createNodeBuildJobDefinition)(context)
3146
+ : undefined,
3147
+ dockerBuild: (0, exports.createNodeDockerJobDefinition)(context),
3148
+ });
3149
+ };
3150
+ exports.createNodeBuildJobs = createNodeBuildJobs;
3151
+ var createNodeBuildJobDefinition = function (context) {
3152
+ var _a, _b, _c;
3021
3153
  var buildConfig = context.build.config;
3022
3154
  if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
3023
3155
  throw new Error("deploy config is not node, node-static or storybook");
3024
3156
  }
3157
+ if (buildConfig.buildCommand === null)
3158
+ return undefined;
3025
3159
  var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
3026
3160
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
3027
- return (0, base_1.createBuildJobs)(context, {
3028
- appBuild: buildConfig.buildCommand !== null
3029
- ? {
3030
- image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
3031
- runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
3032
- 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),
3033
- script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read(((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])), false),
3034
- artifacts: {
3035
- paths: __spreadArray([
3036
- context.build.dir
3037
- ], __read(((_d = context.packageManagerInfo.currentWorkspaceDependencies) !== null && _d !== void 0 ? _d : [])), false).flatMap(function (dir) {
3038
- var _a, _b;
3039
- return __spreadArray([
3040
- (0, path_1.join)(dir, "__build_info.json"),
3041
- (0, path_1.join)(dir, "dist"),
3042
- (0, path_1.join)(dir, ".next")
3043
- ], __read(((_b = (_a = buildConfig.artifactsPaths) === null || _a === void 0 ? void 0 : _a.map(function (path) {
3044
- return (0, path_1.join)(dir, path);
3045
- })) !== null && _b !== void 0 ? _b : [])), false);
3046
- }),
3047
- expire_in: "1 day",
3048
- when: "always",
3049
- },
3050
- jobTags: buildConfig.jobTags,
3051
- }
3052
- : undefined,
3053
- dockerBuild: {
3054
- script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
3055
- ? "nginx"
3056
- : "node"),
3057
- cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
3058
- variables: {
3059
- // only required for non static
3060
- DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context),
3061
- DOCKER_COPY_WORKSPACE_FILES: (_e = context.packageManagerInfo.pathsToCopyInDocker
3062
- .map(function (dir) { return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir); })) === null || _e === void 0 ? void 0 : _e.join("\n"),
3063
- },
3161
+ return {
3162
+ image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
3163
+ runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
3164
+ 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),
3165
+ script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read(((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : [])), false),
3166
+ jobTags: buildConfig.jobTags,
3167
+ };
3168
+ };
3169
+ exports.createNodeBuildJobDefinition = createNodeBuildJobDefinition;
3170
+ var createNodeDockerJobDefinition = function (context) {
3171
+ var _a, _b;
3172
+ // get the default docker built-in type based on the build type
3173
+ var dockerDefaultBuiltIn = context.build.buildType === "node-static" ||
3174
+ context.build.buildType === "storybook"
3175
+ ? "nginx"
3176
+ : "node";
3177
+ return {
3178
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, dockerDefaultBuiltIn),
3179
+ cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
3180
+ variables: {
3181
+ // only required for non static
3182
+ DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context),
3183
+ 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"),
3064
3184
  },
3065
- });
3185
+ };
3066
3186
  };
3067
- exports.createNodeBuildJobs = createNodeBuildJobs;
3187
+ exports.createNodeDockerJobDefinition = createNodeDockerJobDefinition;
3068
3188
  //# sourceMappingURL=buildJob.js.map
3069
3189
 
3070
3190
  /***/ }),
@@ -3109,7 +3229,8 @@ var path_1 = __nccwpck_require__(1017);
3109
3229
  var slugify_1 = __importDefault(__nccwpck_require__(4035));
3110
3230
  var getYarnCache = function (context, policy) {
3111
3231
  if (policy === void 0) { policy = "pull-push"; }
3112
- var componentIsInWorkspace = context.packageManagerInfo.componentIsInWorkspace;
3232
+ var componentIsInWorkspace = context.type === "component" &&
3233
+ context.packageManagerInfo.componentIsInWorkspace;
3113
3234
  return [
3114
3235
  componentIsInWorkspace
3115
3236
  ? {
@@ -3128,7 +3249,8 @@ exports.getYarnCache = getYarnCache;
3128
3249
  var getNodeModulesCache = function (context, policy) {
3129
3250
  var _a;
3130
3251
  if (policy === void 0) { policy = "pull-push"; }
3131
- var componentIsInWorkspace = context.packageManagerInfo.componentIsInWorkspace;
3252
+ var componentIsInWorkspace = context.type === "component" &&
3253
+ context.packageManagerInfo.componentIsInWorkspace;
3132
3254
  // 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.
3133
3255
  // It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
3134
3256
  return [
@@ -3154,13 +3276,19 @@ var getNodeCache = function (context, policy) {
3154
3276
  return __spreadArray(__spreadArray([], __read((0, exports.getYarnCache)(context, policy)), false), __read((0, exports.getNodeModulesCache)(context, policy)), false);
3155
3277
  };
3156
3278
  exports.getNodeCache = getNodeCache;
3157
- var getNextCache = function (context) { return [
3158
- {
3159
- key: context.componentName + "-next-cache",
3160
- policy: "pull-push",
3161
- paths: [context.build.dir + "/.next/cache/"],
3162
- },
3163
- ]; };
3279
+ var getNextCache = function (context) {
3280
+ var key = context.name + "-next-cache";
3281
+ var paths = context.build
3282
+ .getComponentDirs("direct")
3283
+ .map(function (c) { return (0, path_1.join)(c, ".next/cache"); });
3284
+ return [
3285
+ {
3286
+ key: key,
3287
+ policy: "pull-push",
3288
+ paths: paths,
3289
+ },
3290
+ ];
3291
+ };
3164
3292
  exports.getNextCache = getNextCache;
3165
3293
  //# sourceMappingURL=cache.js.map
3166
3294
 
@@ -3274,7 +3402,7 @@ var cache_1 = __nccwpck_require__(2026);
3274
3402
  var yarn_1 = __nccwpck_require__(5043);
3275
3403
  var getMeteorCache = function (context) { return [
3276
3404
  {
3277
- key: context.componentName + "meteor-build-cache",
3405
+ key: context.name + "meteor-build-cache",
3278
3406
  policy: "pull-push",
3279
3407
  paths: [
3280
3408
  (0, path_1.join)(context.build.dir, ".meteor/local/resolver-result-cache.json"),
@@ -3290,7 +3418,7 @@ var createMeteorBuildJobs = function (context) {
3290
3418
  throw new Error("deploy config is not meteor");
3291
3419
  }
3292
3420
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
3293
- return (0, base_1.createBuildJobs)(context, {
3421
+ return (0, base_1.createComponentBuildJobs)(context, {
3294
3422
  appBuild: buildConfig.buildCommand !== null
3295
3423
  ? {
3296
3424
  cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read(getMeteorCache(context)), false),
@@ -3305,12 +3433,6 @@ var createMeteorBuildJobs = function (context) {
3305
3433
  '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',
3306
3434
  "cp ./__build_info.json ./dist/bundle/programs/server",
3307
3435
  ], false),
3308
- artifacts: {
3309
- paths: [
3310
- context.build.dir + "/__build_info.json",
3311
- context.build.dir + "/dist",
3312
- ],
3313
- },
3314
3436
  }
3315
3437
  : undefined,
3316
3438
  dockerBuild: {
@@ -3370,11 +3492,12 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3370
3492
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3371
3493
  exports.createNodeTestJobs = void 0;
3372
3494
  var runner_1 = __nccwpck_require__(4058);
3495
+ var context_1 = __nccwpck_require__(1724);
3373
3496
  var utils_1 = __nccwpck_require__(2497);
3497
+ var createArtifactsConfig_1 = __nccwpck_require__(2820);
3374
3498
  var cache_1 = __nccwpck_require__(2026);
3375
3499
  var constants_1 = __nccwpck_require__(1765);
3376
3500
  var yarn_1 = __nccwpck_require__(5043);
3377
- var createArtifactsConfig_1 = __nccwpck_require__(2820);
3378
3501
  var createNodeTestJobs = function (context) {
3379
3502
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
3380
3503
  // don't run tests after release
@@ -3382,15 +3505,21 @@ var createNodeTestJobs = function (context) {
3382
3505
  if (context.trigger === "taggedRelease") {
3383
3506
  return [];
3384
3507
  }
3385
- var buildConfig = context.build.config;
3508
+ // if its not a standalone build, we don't need to run tests
3509
+ if (context.type === "component" &&
3510
+ !(0, context_1.componentContextIsStandaloneBuild)(context)) {
3511
+ return [];
3512
+ }
3386
3513
  var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
3387
3514
  var base = {
3388
- variables: __assign(__assign({ APP_PATH: context.build.dir }, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
3515
+ variables: __assign({ APP_PATH: context.build.dir }, (context.type === "component"
3516
+ ? __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), ((_a = context.build.config.extraVars) !== null && _a !== void 0 ? _a : {})) : {})),
3389
3517
  runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
3390
3518
  stage: "test",
3391
3519
  needs: [],
3392
3520
  envMode: "none",
3393
3521
  };
3522
+ var buildConfig = context.build.config;
3394
3523
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
3395
3524
  var auditJob = buildConfig.audit !== false
3396
3525
  ? __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([
@@ -3468,7 +3597,7 @@ var ensureNodeVersion = function (context) {
3468
3597
  exports.ensureNodeVersion = ensureNodeVersion;
3469
3598
  var getYarnInstall = function (context, options) {
3470
3599
  var _a;
3471
- var postInstall = "postInstall" in context.build.config
3600
+ var postInstall = context.type !== "workspace" && "postInstall" in context.build.config
3472
3601
  ? context.build.config.postInstall
3473
3602
  : null;
3474
3603
  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)
@@ -3541,6 +3670,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3541
3670
  };
3542
3671
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3543
3672
  exports.createRailsBuildJobs = void 0;
3673
+ var __1 = __nccwpck_require__(603);
3544
3674
  var base_1 = __nccwpck_require__(9366);
3545
3675
  var docker_1 = __nccwpck_require__(9641);
3546
3676
  var types_1 = __nccwpck_require__(4466);
@@ -3551,8 +3681,12 @@ var createRailsBuildJobs = function (context) {
3551
3681
  // should not happen
3552
3682
  throw new Error("build type is not rails");
3553
3683
  }
3684
+ // if its not a standalone build, we don't need to run tests
3685
+ if (!(0, __1.componentContextIsStandaloneBuild)(context)) {
3686
+ throw new Error("workspace builds are not supported for rails apps");
3687
+ }
3554
3688
  if ((0, docker_1.hasDockerfile)(context)) {
3555
- return (0, base_1.createBuildJobs)(context, {
3689
+ return (0, base_1.createComponentBuildJobs)(context, {
3556
3690
  appBuild: undefined,
3557
3691
  dockerBuild: {
3558
3692
  script: (0, docker_1.getDockerBuildDefaultScript)(context),
@@ -3567,7 +3701,7 @@ var createRailsBuildJobs = function (context) {
3567
3701
  return "--env '".concat(k).concat(v ? "=".concat(v) : "", "'");
3568
3702
  })
3569
3703
  .join(" ");
3570
- return (0, base_1.createBuildJobs)(context, {
3704
+ return (0, base_1.createComponentBuildJobs)(context, {
3571
3705
  appBuild: undefined,
3572
3706
  dockerBuild: {
3573
3707
  variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.build.config.extraVars),
@@ -3674,6 +3808,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3674
3808
  };
3675
3809
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3676
3810
  exports.createRailsTestJobs = void 0;
3811
+ var __1 = __nccwpck_require__(603);
3677
3812
  var utils_1 = __nccwpck_require__(2497);
3678
3813
  var createRailsTestJobs = function (context) {
3679
3814
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
@@ -3682,6 +3817,10 @@ var createRailsTestJobs = function (context) {
3682
3817
  if (context.trigger === "taggedRelease") {
3683
3818
  return [];
3684
3819
  }
3820
+ // if its not a standalone build, we don't need to run tests
3821
+ if (!(0, __1.componentContextIsStandaloneBuild)(context)) {
3822
+ return [];
3823
+ }
3685
3824
  var buildConfig = context.build.config;
3686
3825
  var base = {
3687
3826
  variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), ((_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {})),
@@ -3735,6 +3874,7 @@ exports.createRailsTestJobs = createRailsTestJobs;
3735
3874
 
3736
3875
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3737
3876
  exports.createSbomBuildJob = exports.SBOM_FILE = exports.SBOM_BUILD_JOB_NAME = void 0;
3877
+ var _1 = __nccwpck_require__(7862);
3738
3878
  var utils_1 = __nccwpck_require__(2497);
3739
3879
  exports.SBOM_BUILD_JOB_NAME = "🧾 sbom";
3740
3880
  exports.SBOM_FILE = "__sbom.json";
@@ -3747,10 +3887,14 @@ var createSbomBuildJob = function (context) {
3747
3887
  ? "."
3748
3888
  : context.build.dir),
3749
3889
  ];
3750
- var image = buildConfig.type === "custom" && buildConfig.sbom !== false
3890
+ var image = (0, _1.isStandaloneBuildConfig)(buildConfig) &&
3891
+ buildConfig.type === "custom" &&
3892
+ buildConfig.sbom !== false
3751
3893
  ? (_b = (_a = buildConfig.sbom) === null || _a === void 0 ? void 0 : _a.jobImage) !== null && _b !== void 0 ? _b : defaultImage
3752
3894
  : defaultImage;
3753
- var script = buildConfig.type === "custom" && buildConfig.sbom !== false
3895
+ var script = (0, _1.isStandaloneBuildConfig)(buildConfig) &&
3896
+ buildConfig.type === "custom" &&
3897
+ buildConfig.sbom !== false
3754
3898
  ? (_d = (0, utils_1.ensureArray)((_c = buildConfig.sbom) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : defaultScript
3755
3899
  : defaultScript;
3756
3900
  return {
@@ -3778,12 +3922,20 @@ exports.createSbomBuildJob = createSbomBuildJob;
3778
3922
  "use strict";
3779
3923
 
3780
3924
  Object.defineProperty(exports, "__esModule", ({ value: true }));
3781
- exports.isOfBuildType = void 0;
3925
+ exports.isOfBuildType = exports.isStandaloneBuildConfig = void 0;
3926
+ var isStandaloneBuildConfig = function (t) {
3927
+ if (!t)
3928
+ return false;
3929
+ return !("from" in t);
3930
+ };
3931
+ exports.isStandaloneBuildConfig = isStandaloneBuildConfig;
3782
3932
  var isOfBuildType = function (t) {
3783
3933
  var types = [];
3784
3934
  for (var _i = 1; _i < arguments.length; _i++) {
3785
3935
  types[_i - 1] = arguments[_i];
3786
3936
  }
3937
+ if (!(0, exports.isStandaloneBuildConfig)(t))
3938
+ return false;
3787
3939
  return types.includes(t.type);
3788
3940
  };
3789
3941
  exports.isOfBuildType = isOfBuildType;
@@ -3956,6 +4108,81 @@ exports.DOCKER_REGISTRY = process.env.INLINE_DOCKER_REGISTRY ||
3956
4108
 
3957
4109
  /***/ }),
3958
4110
 
4111
+ /***/ 8375:
4112
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
4113
+
4114
+ "use strict";
4115
+
4116
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4117
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4118
+ return new (P || (P = Promise))(function (resolve, reject) {
4119
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4120
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
4121
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
4122
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
4123
+ });
4124
+ };
4125
+ var __generator = (this && this.__generator) || function (thisArg, body) {
4126
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
4127
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
4128
+ function verb(n) { return function (v) { return step([n, v]); }; }
4129
+ function step(op) {
4130
+ if (f) throw new TypeError("Generator is already executing.");
4131
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
4132
+ 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;
4133
+ if (y = 0, t) op = [op[0] & 2, t.value];
4134
+ switch (op[0]) {
4135
+ case 0: case 1: t = op; break;
4136
+ case 4: _.label++; return { value: op[1], done: false };
4137
+ case 5: _.label++; y = op[1]; op = [0]; continue;
4138
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
4139
+ default:
4140
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
4141
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
4142
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
4143
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
4144
+ if (t[2]) _.ops.pop();
4145
+ _.trys.pop(); continue;
4146
+ }
4147
+ op = body.call(thisArg, _);
4148
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
4149
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
4150
+ }
4151
+ };
4152
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
4153
+ exports.createAllComponentsContext = void 0;
4154
+ var configruedEnvs_1 = __nccwpck_require__(9609);
4155
+ var createComponentContext_1 = __nccwpck_require__(2775);
4156
+ var createAllComponentsContext = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
4157
+ var config = _b.config, trigger = _b.trigger, pipelineType = _b.pipelineType;
4158
+ return __generator(this, function (_c) {
4159
+ switch (_c.label) {
4160
+ case 0: return [4 /*yield*/, Promise.all(Object.keys(config.components).flatMap(function (componentName) {
4161
+ var envs = (0, configruedEnvs_1.getAllEnvsByTrigger)(config, componentName, trigger);
4162
+ return envs.map(function (env) { return __awaiter(void 0, void 0, void 0, function () {
4163
+ return __generator(this, function (_a) {
4164
+ switch (_a.label) {
4165
+ case 0: return [4 /*yield*/, (0, createComponentContext_1.createComponentContext)({
4166
+ config: config,
4167
+ componentName: componentName,
4168
+ env: env,
4169
+ trigger: trigger,
4170
+ pipelineType: pipelineType,
4171
+ })];
4172
+ case 1: return [2 /*return*/, _a.sent()];
4173
+ }
4174
+ });
4175
+ }); });
4176
+ }))];
4177
+ case 1: return [2 /*return*/, _c.sent()];
4178
+ }
4179
+ });
4180
+ }); };
4181
+ exports.createAllComponentsContext = createAllComponentsContext;
4182
+ //# sourceMappingURL=createAllComponentsContext.js.map
4183
+
4184
+ /***/ }),
4185
+
3959
4186
  /***/ 2775:
3960
4187
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
3961
4188
 
@@ -4008,56 +4235,122 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
4008
4235
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
4009
4236
  }
4010
4237
  };
4238
+ var __read = (this && this.__read) || function (o, n) {
4239
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
4240
+ if (!m) return o;
4241
+ var i = m.call(o), r, ar = [], e;
4242
+ try {
4243
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
4244
+ }
4245
+ catch (error) { e = { error: error }; }
4246
+ finally {
4247
+ try {
4248
+ if (r && !r.done && (m = i["return"])) m.call(i);
4249
+ }
4250
+ finally { if (e) throw e.error; }
4251
+ }
4252
+ return ar;
4253
+ };
4254
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
4255
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4256
+ if (ar || !(i in from)) {
4257
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
4258
+ ar[i] = from[i];
4259
+ }
4260
+ }
4261
+ return to.concat(ar || Array.prototype.slice.call(from));
4262
+ };
4011
4263
  Object.defineProperty(exports, "__esModule", ({ value: true }));
4012
- exports.createContext = exports.createComponentContext = void 0;
4264
+ exports.createComponentContext = void 0;
4013
4265
  var lodash_1 = __nccwpck_require__(3255);
4014
4266
  var build_1 = __nccwpck_require__(7862);
4015
4267
  var deploy_1 = __nccwpck_require__(8483);
4268
+ var packageManager_1 = __nccwpck_require__(6451);
4016
4269
  var utils_1 = __nccwpck_require__(2497);
4017
4270
  var getEnvironment_1 = __nccwpck_require__(5699);
4018
4271
  var getEnvironmentContext_1 = __nccwpck_require__(3663);
4019
- var packageManager_1 = __nccwpck_require__(6451);
4020
4272
  var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, void 0, function () {
4021
- var packageManagerInfo, envContext, componentConfigWithoutDefaults, defaults, componentConfig, environment, deploy, build, customJobs, dir, context, resolvedCustomJobs;
4022
- return __generator(this, function (_a) {
4023
- switch (_a.label) {
4273
+ var packageManagerInfo, envContext, componentConfigWithoutDefaults, resolvedBuildType, defaults, componentConfig, environment, deploy, build, customJobs, dir, getComponentDirs, _getBuildContext, buildContext, context, resolvedCustomJobs;
4274
+ var _a;
4275
+ return __generator(this, function (_b) {
4276
+ switch (_b.label) {
4024
4277
  case 0:
4025
4278
  if (!/^[a-z0-9-]+$/.test(ctx.componentName)) {
4026
4279
  throw new Error("componentName may only contain lower case letters, numbers and -");
4027
4280
  }
4028
4281
  return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfoForComponent)(ctx.config, ctx.componentName)];
4029
4282
  case 1:
4030
- packageManagerInfo = _a.sent();
4283
+ packageManagerInfo = _b.sent();
4031
4284
  envContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
4032
4285
  componentConfigWithoutDefaults = envContext.envConfigRaw;
4286
+ resolvedBuildType = (0, build_1.isStandaloneBuildConfig)(componentConfigWithoutDefaults.build)
4287
+ ? componentConfigWithoutDefaults.build.type
4288
+ : (_a = ctx.config.builds) === null || _a === void 0 ? void 0 : _a[componentConfigWithoutDefaults.build.from].type;
4289
+ if (!resolvedBuildType) {
4290
+ throw new Error("build type not found, is the build config correct?");
4291
+ }
4033
4292
  defaults = componentConfigWithoutDefaults.deploy
4034
4293
  ? {
4035
- build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(envContext),
4294
+ build: build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
4036
4295
  deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults(envContext),
4037
4296
  }
4038
4297
  : {
4039
- build: {},
4298
+ build: build_1.BUILD_TYPES[resolvedBuildType].defaults(envContext),
4040
4299
  deploy: {},
4041
4300
  };
4042
4301
  componentConfig = (0, utils_1.mergeWithMergingArrays)(defaults, componentConfigWithoutDefaults);
4043
4302
  return [4 /*yield*/, (0, getEnvironment_1.getEnvironment)(ctx)];
4044
4303
  case 2:
4045
- environment = _a.sent();
4304
+ environment = _b.sent();
4046
4305
  deploy = componentConfig.deploy, build = componentConfig.build, customJobs = componentConfig.customJobs, dir = componentConfig.dir;
4306
+ getComponentDirs = function (mode) {
4307
+ var _a;
4308
+ return __spreadArray([
4309
+ dir
4310
+ ], __read((mode === "all"
4311
+ ? (_a = packageManagerInfo.currentWorkspaceDependencies) !== null && _a !== void 0 ? _a : []
4312
+ : [])), false);
4313
+ };
4314
+ _getBuildContext = function () {
4315
+ var _a;
4316
+ if ((0, build_1.isStandaloneBuildConfig)(build)) {
4317
+ return {
4318
+ dir: dir,
4319
+ getComponentDirs: getComponentDirs,
4320
+ config: build,
4321
+ buildType: build.type,
4322
+ type: "standalone",
4323
+ };
4324
+ }
4325
+ // must be shared build
4326
+ var referencedBuild = (_a = ctx.config.builds) === null || _a === void 0 ? void 0 : _a[build.from];
4327
+ if (!referencedBuild) {
4328
+ throw new Error("build.from not found in config");
4329
+ }
4330
+ return {
4331
+ dir: dir,
4332
+ getComponentDirs: getComponentDirs,
4333
+ config: build,
4334
+ workspaceBuildConfig: referencedBuild,
4335
+ workspaceName: build.from,
4336
+ buildType: referencedBuild.type,
4337
+ type: "fromWorkspace",
4338
+ };
4339
+ };
4340
+ buildContext = _getBuildContext();
4047
4341
  context = {
4342
+ type: "component",
4343
+ name: ctx.componentName,
4344
+ componentName: ctx.componentName,
4345
+ env: ctx.env,
4048
4346
  fullConfig: ctx.config,
4049
4347
  componentConfig: componentConfig,
4050
- env: ctx.env,
4051
- build: {
4052
- dir: dir,
4053
- config: build,
4054
- },
4348
+ build: buildContext,
4055
4349
  deploy: deploy
4056
4350
  ? {
4057
4351
  config: deploy,
4058
4352
  }
4059
4353
  : null,
4060
- componentName: ctx.componentName,
4061
4354
  environment: environment,
4062
4355
  packageManagerInfo: packageManagerInfo,
4063
4356
  pipelineType: ctx.pipelineType,
@@ -4071,14 +4364,103 @@ var createComponentContext = function (ctx) { return __awaiter(void 0, void 0, v
4071
4364
  });
4072
4365
  }); };
4073
4366
  exports.createComponentContext = createComponentContext;
4074
- /**
4075
- * @deprecated use createComponentContext instead
4076
- */
4077
- exports.createContext = exports.createComponentContext;
4078
4367
  //# sourceMappingURL=createComponentContext.js.map
4079
4368
 
4080
4369
  /***/ }),
4081
4370
 
4371
+ /***/ 6558:
4372
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
4373
+
4374
+ "use strict";
4375
+
4376
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
4377
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4378
+ return new (P || (P = Promise))(function (resolve, reject) {
4379
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
4380
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
4381
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
4382
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
4383
+ });
4384
+ };
4385
+ var __generator = (this && this.__generator) || function (thisArg, body) {
4386
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
4387
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
4388
+ function verb(n) { return function (v) { return step([n, v]); }; }
4389
+ function step(op) {
4390
+ if (f) throw new TypeError("Generator is already executing.");
4391
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
4392
+ 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;
4393
+ if (y = 0, t) op = [op[0] & 2, t.value];
4394
+ switch (op[0]) {
4395
+ case 0: case 1: t = op; break;
4396
+ case 4: _.label++; return { value: op[1], done: false };
4397
+ case 5: _.label++; y = op[1]; op = [0]; continue;
4398
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
4399
+ default:
4400
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
4401
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
4402
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
4403
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
4404
+ if (t[2]) _.ops.pop();
4405
+ _.trys.pop(); continue;
4406
+ }
4407
+ op = body.call(thisArg, _);
4408
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
4409
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
4410
+ }
4411
+ };
4412
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
4413
+ exports.createWorkspaceContext = void 0;
4414
+ var __1 = __nccwpck_require__(603);
4415
+ var packageManager_1 = __nccwpck_require__(6451);
4416
+ var utils_1 = __nccwpck_require__(2497);
4417
+ var lodash_1 = __nccwpck_require__(3255);
4418
+ function createWorkspaceContext(_a) {
4419
+ return __awaiter(this, arguments, void 0, function (_b) {
4420
+ var workspaceConfigRaw, defaults, workspaceConfig;
4421
+ var _c;
4422
+ var _d, _e;
4423
+ var env = _b.env, components = _b.components, workspaceName = _b.workspaceName, config = _b.config, pipelineType = _b.pipelineType, trigger = _b.trigger;
4424
+ return __generator(this, function (_f) {
4425
+ switch (_f.label) {
4426
+ case 0:
4427
+ workspaceConfigRaw = (_d = config.builds) === null || _d === void 0 ? void 0 : _d[workspaceName];
4428
+ if (!workspaceConfigRaw) {
4429
+ throw new Error("Workspace ".concat(workspaceName, " not found in config"));
4430
+ }
4431
+ defaults = __1.WORKSPACE_BUILD_TYPES[workspaceConfigRaw.type].defaults();
4432
+ workspaceConfig = (0, utils_1.mergeWithMergingArrays)(defaults, workspaceConfigRaw);
4433
+ _c = {
4434
+ name: workspaceName,
4435
+ pipelineType: pipelineType,
4436
+ trigger: trigger,
4437
+ type: "workspace",
4438
+ workspaceConfig: workspaceConfig,
4439
+ env: env,
4440
+ components: components,
4441
+ fullConfig: config
4442
+ };
4443
+ return [4 /*yield*/, (0, packageManager_1.getPackageManagerInfoBase)()];
4444
+ case 1: return [2 /*return*/, (_c.packageManagerInfo = _f.sent(),
4445
+ _c.build = {
4446
+ type: "workspace",
4447
+ dir: (_e = workspaceConfig.dir) !== null && _e !== void 0 ? _e : ".",
4448
+ getComponentDirs: function (mode) {
4449
+ return (0, lodash_1.uniq)(components.flatMap(function (c) { return c.build.getComponentDirs(mode); }));
4450
+ },
4451
+ buildType: workspaceConfig.type,
4452
+ config: workspaceConfig,
4453
+ },
4454
+ _c)];
4455
+ }
4456
+ });
4457
+ });
4458
+ }
4459
+ exports.createWorkspaceContext = createWorkspaceContext;
4460
+ //# sourceMappingURL=createWorkspaceContext.js.map
4461
+
4462
+ /***/ }),
4463
+
4082
4464
  /***/ 7827:
4083
4465
  /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
4084
4466
 
@@ -4362,6 +4744,7 @@ exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvir
4362
4744
  var lodash_1 = __nccwpck_require__(3255);
4363
4745
  var deploy_1 = __nccwpck_require__(8483);
4364
4746
  var BashExpression_1 = __nccwpck_require__(2376);
4747
+ var types_1 = __nccwpck_require__(4466);
4365
4748
  var getBuildInfoVariables_1 = __nccwpck_require__(7827);
4366
4749
  var getEnvironmentContext_1 = __nccwpck_require__(3663);
4367
4750
  var resolveReferences_1 = __nccwpck_require__(3115);
@@ -4392,7 +4775,8 @@ var getEnvironmentVariables = function (ctx_1) {
4392
4775
  port = (_c = devLocalConfig.port) !== null && _c !== void 0 ? _c : 3000;
4393
4776
  host = "localhost:" + port.toString();
4394
4777
  url = "http://" + host;
4395
- predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), { ENV_SHORT: "local", ROOT_URL: url }), (config.components[componentName].build.type === "rails"
4778
+ predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), { ENV_SHORT: "local", ROOT_URL: url }), ((0, types_1.isStandaloneBuildConfig)(buildConfigRaw) &&
4779
+ buildConfigRaw.type === "rails"
4396
4780
  ? {}
4397
4781
  : { HOST: host })), { HOST_INTERNAL: host, ROOT_URL_INTERNAL: "http://" + host, PORT: port.toString() });
4398
4782
  }
@@ -4403,7 +4787,8 @@ var getEnvironmentVariables = function (ctx_1) {
4403
4787
  HOST_INTERNAL = (_d = additionalEnvVars.HOST_INTERNAL) !== null && _d !== void 0 ? _d : "unknown-host.example.com";
4404
4788
  host = (_e = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _e !== void 0 ? _e : HOST_INTERNAL;
4405
4789
  url = (0, BashExpression_1.joinBashExpressions)(["https://", host]);
4406
- predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), (config.components[componentName].build.type === "rails"
4790
+ predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), ((0, types_1.isStandaloneBuildConfig)(buildConfigRaw) &&
4791
+ buildConfigRaw.type === "rails"
4407
4792
  ? {}
4408
4793
  : { HOST: host })), { ROOT_URL: url, HOST_INTERNAL: HOST_INTERNAL,
4409
4794
  /**@deprecated */
@@ -4437,7 +4822,10 @@ var getEnvironmentVariables = function (ctx_1) {
4437
4822
  secretEnvVarKeys: secretEnvVarKeys
4438
4823
  };
4439
4824
  _b = {};
4440
- return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, (buildConfigRaw && buildConfigRaw.jobVars) || null)];
4825
+ return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, (buildConfigRaw &&
4826
+ (0, types_1.isStandaloneBuildConfig)(buildConfigRaw) &&
4827
+ buildConfigRaw.jobVars) ||
4828
+ null)];
4441
4829
  case 2:
4442
4830
  _b.build = _m.sent();
4443
4831
  return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, (deployConfigRaw && deployConfigRaw.jobVars) || null)];
@@ -4455,7 +4843,7 @@ var sanitizeForEnVar = function (s) { return s.replace(/-/g, "_"); };
4455
4843
  var getSecretVarName = function (env, componentName, key) { return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key); }; // remove dash from component name
4456
4844
  exports.getSecretVarName = getSecretVarName;
4457
4845
  var addIndexVar = function (vars) { return (__assign(__assign({}, vars), { _ALL_ENV_VAR_KEYS: JSON.stringify(Object.keys(vars)) })); };
4458
- var getSecretVarNameForContext = function (context, key) { return (0, exports.getSecretVarName)(context.env, context.componentName, key); };
4846
+ var getSecretVarNameForContext = function (context, key) { return (0, exports.getSecretVarName)(context.env, context.name, key); };
4459
4847
  exports.getSecretVarNameForContext = getSecretVarNameForContext;
4460
4848
  //# sourceMappingURL=getEnvironmentVariables.js.map
4461
4849
 
@@ -4491,8 +4879,8 @@ var sanitize = function (value) {
4491
4879
  return (0, slugify_1.default)(value).toLowerCase();
4492
4880
  };
4493
4881
  var getLabels = function (context) {
4494
- var _a, _b, _c;
4495
- 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.env), "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 : {}));
4882
+ var _a, _b;
4883
+ 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 : {}));
4496
4884
  return labels;
4497
4885
  };
4498
4886
  exports.getLabels = getLabels;
@@ -4949,6 +5337,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
4949
5337
  exports.createDeployJob = exports.DEPLOY_JOB_NAME = void 0;
4950
5338
  var docker_1 = __nccwpck_require__(9641);
4951
5339
  var sbom_1 = __nccwpck_require__(7038);
5340
+ var context_1 = __nccwpck_require__(1724);
4952
5341
  var sbom_2 = __nccwpck_require__(4986);
4953
5342
  var utils_1 = __nccwpck_require__(6054);
4954
5343
  var stop_1 = __nccwpck_require__(2846);
@@ -4991,16 +5380,38 @@ var createDeployJob = function (context, jobDefinition) {
4991
5380
  }); })) !== null && _d !== void 0 ? _d : []
4992
5381
  : [])), false),
4993
5382
  // we don't want to deploy when there is a broken test
4994
- needsStages: [
4995
- {
4996
- stage: "build",
4997
- artifacts: hasDocker ? false : true, // we asume that no-docker deployments need build artifacts,
4998
- },
5383
+ needsStages: __spreadArray(__spreadArray([], __read(((0, context_1.componentContextHasWorkspaceBuild)(context)
5384
+ ? hasDocker // docker build is per component,
5385
+ ? [
5386
+ // we don't need artifacts, but have to wait for the component build
5387
+ {
5388
+ stage: "build",
5389
+ artifacts: false,
5390
+ },
5391
+ ]
5392
+ : [
5393
+ {
5394
+ // pick build artifacts from workspace build
5395
+ stage: "build",
5396
+ artifacts: true,
5397
+ workspaceName: context.build.workspaceName,
5398
+ },
5399
+ ]
5400
+ : [
5401
+ {
5402
+ stage: "build",
5403
+ artifacts: hasDocker ? false : true, // we asume that no-docker deployments need build artifacts,
5404
+ },
5405
+ ])), false), [
4999
5406
  {
5000
5407
  stage: "test",
5001
5408
  artifacts: false,
5409
+ // use test from workspace build
5410
+ workspaceName: (0, context_1.componentContextHasWorkspaceBuild)(context)
5411
+ ? context.build.workspaceName
5412
+ : undefined,
5002
5413
  },
5003
- ], // workaround for https://gitlab.com/gitlab-org/gitlab/-/issues/220758
5414
+ ], false),
5004
5415
  when: whenDeploy === "auto" ? "on_success" : "manual",
5005
5416
  allow_failure: whenDeploy === "manual" ? true : false,
5006
5417
  stage: "deploy",
@@ -5243,7 +5654,7 @@ var getArtifactsRegistryImageName = function (context, lecacyReviewImageName) {
5243
5654
  var gcloudImagePath = __spreadArray([
5244
5655
  dockerUrl,
5245
5656
  context.env,
5246
- context.componentName
5657
+ context.name
5247
5658
  ], __read((context.environment.reviewSlug && !lecacyReviewImageName
5248
5659
  ? [context.environment.reviewSlug]
5249
5660
  : [])), false);
@@ -5253,7 +5664,7 @@ exports.getArtifactsRegistryImageName = getArtifactsRegistryImageName;
5253
5664
  var getArtifactsRegistryBuildCacheImage = function (context) {
5254
5665
  var dockerUrl = (0, exports.getArtifactsRegistryDockerUrl)(context);
5255
5666
  // does not include env, so that after merge, you might get more cache hits (review-->dev)
5256
- var gcloudImagePath = [dockerUrl, "caches", context.componentName];
5667
+ var gcloudImagePath = [dockerUrl, "caches", context.name];
5257
5668
  return gcloudImagePath.join("/");
5258
5669
  };
5259
5670
  exports.getArtifactsRegistryBuildCacheImage = getArtifactsRegistryBuildCacheImage;
@@ -6676,7 +7087,7 @@ var createKubernetesCloudsqlBaseValues = function (context) {
6676
7087
  dbUser: (_g = config.dbUser) !== null && _g !== void 0 ? _g : "postgres",
6677
7088
  instanceConnectionName: config.instanceConnectionName,
6678
7089
  proxyCredentials: proxyCredentials,
6679
- fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName),
7090
+ fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.name),
6680
7091
  },
6681
7092
  };
6682
7093
  }
@@ -6757,7 +7168,7 @@ var createKubernetesDeployJobs = function (context) {
6757
7168
  when: "always",
6758
7169
  },
6759
7170
  }
6760
- : {})), { 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,
7171
+ : {})), { 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,
6761
7172
  /** @deprecated */
6762
7173
  BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID }) });
6763
7174
  var clusterName = "kube-".concat(context.environment.fullName);
@@ -7233,8 +7644,11 @@ exports.processSecretsAsFiles = processSecretsAsFiles;
7233
7644
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7234
7645
  exports.getDependencyTrackDeleteScript = exports.getDependencyTrackUploadScript = exports.sbomDeactivated = void 0;
7235
7646
  var sbom_1 = __nccwpck_require__(7038);
7647
+ var context_1 = __nccwpck_require__(1724);
7236
7648
  var sbomDeactivated = function (context) {
7237
- return context.build.config.type === "custom" && context.build.config.sbom === false;
7649
+ return (0, context_1.componentContextIsStandaloneBuild)(context) &&
7650
+ context.build.config.type === "custom" &&
7651
+ context.build.config.sbom === false;
7238
7652
  };
7239
7653
  exports.sbomDeactivated = sbomDeactivated;
7240
7654
  var getDependencyTrackUploadScript = function (context) {
@@ -7242,7 +7656,7 @@ var getDependencyTrackUploadScript = function (context) {
7242
7656
  ? []
7243
7657
  : [
7244
7658
  "echo 'Uploading SBOM to Dependency Track'",
7245
- "/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"),
7659
+ "/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"),
7246
7660
  ];
7247
7661
  };
7248
7662
  exports.getDependencyTrackUploadScript = getDependencyTrackUploadScript;
@@ -7251,7 +7665,7 @@ var getDependencyTrackDeleteScript = function (context) {
7251
7665
  ? []
7252
7666
  : [
7253
7667
  "echo 'Disabling component in Dependency Track'",
7254
- "/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"),
7668
+ "/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"),
7255
7669
  ];
7256
7670
  };
7257
7671
  exports.getDependencyTrackDeleteScript = getDependencyTrackDeleteScript;
@@ -7466,62 +7880,102 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
7466
7880
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
7467
7881
  }
7468
7882
  };
7883
+ var __read = (this && this.__read) || function (o, n) {
7884
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
7885
+ if (!m) return o;
7886
+ var i = m.call(o), r, ar = [], e;
7887
+ try {
7888
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7889
+ }
7890
+ catch (error) { e = { error: error }; }
7891
+ finally {
7892
+ try {
7893
+ if (r && !r.done && (m = i["return"])) m.call(i);
7894
+ }
7895
+ finally { if (e) throw e.error; }
7896
+ }
7897
+ return ar;
7898
+ };
7899
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
7900
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
7901
+ if (ar || !(i in from)) {
7902
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
7903
+ ar[i] = from[i];
7904
+ }
7905
+ }
7906
+ return to.concat(ar || Array.prototype.slice.call(from));
7907
+ };
7469
7908
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7470
7909
  exports.createAllJobs = void 0;
7471
- var config_1 = __nccwpck_require__(3352);
7472
- var context_1 = __nccwpck_require__(5875);
7910
+ var createAllComponentsContext_1 = __nccwpck_require__(8375);
7911
+ var createWorkspaceContext_1 = __nccwpck_require__(6558);
7912
+ var types_1 = __nccwpck_require__(1853);
7473
7913
  var createJobsForComponent_1 = __nccwpck_require__(2321);
7474
- var createAllComponentContext = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
7475
- var config = _b.config, trigger = _b.trigger, pipelineType = _b.pipelineType;
7476
- return __generator(this, function (_c) {
7477
- switch (_c.label) {
7478
- case 0: return [4 /*yield*/, Promise.all(Object.keys(config.components).flatMap(function (componentName) {
7479
- var envs = (0, config_1.getAllEnvsByTrigger)(config, componentName, trigger);
7480
- return envs.map(function (env) { return __awaiter(void 0, void 0, void 0, function () {
7481
- var context;
7482
- return __generator(this, function (_a) {
7483
- switch (_a.label) {
7484
- case 0: return [4 /*yield*/, (0, context_1.createComponentContext)({
7485
- config: config,
7486
- componentName: componentName,
7487
- env: env,
7488
- trigger: trigger,
7489
- pipelineType: pipelineType,
7490
- })];
7491
- case 1:
7492
- context = _a.sent();
7493
- return [2 /*return*/, {
7494
- env: env,
7495
- componentName: componentName,
7496
- context: context,
7497
- }];
7498
- }
7499
- });
7500
- }); });
7501
- }))];
7502
- case 1: return [2 /*return*/, _c.sent()];
7503
- }
7504
- });
7505
- }); };
7914
+ var createJobsForWorkspace_1 = __nccwpck_require__(803);
7506
7915
  var createAllJobs = function (_a) { return __awaiter(void 0, [_a], void 0, function (_b) {
7507
- var allComponentContext;
7916
+ var allComponentsContext;
7917
+ var _c;
7918
+ var _d;
7508
7919
  var config = _b.config, trigger = _b.trigger, pipelineType = _b.pipelineType;
7509
- return __generator(this, function (_c) {
7510
- switch (_c.label) {
7511
- case 0: return [4 /*yield*/, createAllComponentContext({
7920
+ return __generator(this, function (_e) {
7921
+ switch (_e.label) {
7922
+ case 0: return [4 /*yield*/, (0, createAllComponentsContext_1.createAllComponentsContext)({
7512
7923
  config: config,
7513
7924
  trigger: trigger,
7514
7925
  pipelineType: pipelineType,
7515
7926
  })];
7516
7927
  case 1:
7517
- allComponentContext = _c.sent();
7518
- return [2 /*return*/, allComponentContext.map(function (_a) {
7519
- var context = _a.context;
7520
- return ({
7928
+ allComponentsContext = _e.sent();
7929
+ _c = {};
7930
+ 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 () {
7931
+ var componentsInAllEnvs, allEnvs;
7932
+ return __generator(this, function (_a) {
7933
+ switch (_a.label) {
7934
+ case 0:
7935
+ componentsInAllEnvs = allComponentsContext.filter(function (context) {
7936
+ return (0, types_1.componentContextHasWorkspaceBuild)(context) &&
7937
+ context.build.workspaceName === workspaceName;
7938
+ });
7939
+ allEnvs = __spreadArray([], __read(new Set(componentsInAllEnvs.map(function (_a) {
7940
+ var env = _a.env;
7941
+ return env;
7942
+ }))), false);
7943
+ return [4 /*yield*/, Promise.all(allEnvs.map(function (env) { return __awaiter(void 0, void 0, void 0, function () {
7944
+ var workspaceContext;
7945
+ return __generator(this, function (_a) {
7946
+ switch (_a.label) {
7947
+ case 0: return [4 /*yield*/, (0, createWorkspaceContext_1.createWorkspaceContext)({
7948
+ components: componentsInAllEnvs.filter(function (_a) {
7949
+ var componentEnv = _a.env;
7950
+ return componentEnv === env;
7951
+ }),
7952
+ workspaceName: workspaceName,
7953
+ config: config,
7954
+ trigger: trigger,
7955
+ pipelineType: pipelineType,
7956
+ env: env,
7957
+ })];
7958
+ case 1:
7959
+ workspaceContext = _a.sent();
7960
+ return [2 /*return*/, {
7961
+ context: workspaceContext,
7962
+ jobs: (0, createJobsForWorkspace_1.createJobsForWorkspace)(workspaceContext),
7963
+ }];
7964
+ }
7965
+ });
7966
+ }); }))];
7967
+ case 1: return [2 /*return*/, _a.sent()];
7968
+ }
7969
+ });
7970
+ }); })).then(function (f) { return f.flat(); })];
7971
+ case 2: return [2 /*return*/, (_c.workspaces = _e.sent(),
7972
+ _c.components = allComponentsContext.map(function (context) {
7973
+ return {
7521
7974
  context: context,
7522
7975
  jobs: (0, createJobsForComponent_1.createJobsForComponentContext)(context),
7523
- });
7524
- })];
7976
+ };
7977
+ }),
7978
+ _c)];
7525
7979
  }
7526
7980
  });
7527
7981
  }); };
@@ -7684,10 +8138,9 @@ var getCustomJobs = function (context) {
7684
8138
  return injectDefaultVarsInCustomJobs(context, rawJobs);
7685
8139
  };
7686
8140
  var createJobsForComponentContext = function (context) {
7687
- var _a, _b;
7688
- var buildJobs = build_1.BUILD_TYPES[context.build.config.type].jobs(context);
7689
- var deployJobs = ((_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config)
7690
- ? deploy_1.DEPLOY_TYPES[(_b = context.deploy) === null || _b === void 0 ? void 0 : _b.config.type].jobs(context)
8141
+ var buildJobs = build_1.BUILD_TYPES[context.build.buildType].jobs(context);
8142
+ var deployJobs = context.componentConfig.deploy !== false
8143
+ ? deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context)
7691
8144
  : [];
7692
8145
  var customJobs = getCustomJobs(context);
7693
8146
  return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
@@ -7697,6 +8150,23 @@ exports.createJobsForComponentContext = createJobsForComponentContext;
7697
8150
 
7698
8151
  /***/ }),
7699
8152
 
8153
+ /***/ 803:
8154
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
8155
+
8156
+ "use strict";
8157
+
8158
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
8159
+ exports.createJobsForWorkspace = void 0;
8160
+ var build_1 = __nccwpck_require__(7862);
8161
+ var createJobsForWorkspace = function (context) {
8162
+ var buildJobs = build_1.WORKSPACE_BUILD_TYPES[context.build.buildType].jobs(context);
8163
+ return buildJobs;
8164
+ };
8165
+ exports.createJobsForWorkspace = createJobsForWorkspace;
8166
+ //# sourceMappingURL=createJobsForWorkspace.js.map
8167
+
8168
+ /***/ }),
8169
+
7700
8170
  /***/ 9192:
7701
8171
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
7702
8172
 
@@ -7784,7 +8254,7 @@ var createGitlabJobs_1 = __nccwpck_require__(8862);
7784
8254
  var createGitlabPipeline_1 = __nccwpck_require__(6551);
7785
8255
  var gitlabReleaseJobs_1 = __nccwpck_require__(6564);
7786
8256
  var createMainPipeline = function (pipelineType, config) { return __awaiter(void 0, void 0, void 0, function () {
7787
- var stages, allJobsPerTrigger, allJobs;
8257
+ var stages, allJobsPerTrigger, allWorkspaceJobs, allComponentJobs, allJobs;
7788
8258
  return __generator(this, function (_a) {
7789
8259
  switch (_a.label) {
7790
8260
  case 0:
@@ -7801,20 +8271,30 @@ var createMainPipeline = function (pipelineType, config) { return __awaiter(void
7801
8271
  case 2: return [2 /*return*/, _b.sent()];
7802
8272
  }
7803
8273
  });
7804
- }); }))];
8274
+ }); })).then(function (j) { return j.flat(); })];
7805
8275
  case 1:
7806
8276
  allJobsPerTrigger = _a.sent();
7807
- allJobs = allJobsPerTrigger
7808
- .flat()
8277
+ allWorkspaceJobs = allJobsPerTrigger
8278
+ .filter(function (j) { return j.context.type === "workspace"; }) // sort by componentName in the same order as they appear in the config
8279
+ // this is purely for better readability in git diffs when you add new components
8280
+ .sort(function (a, b) {
8281
+ var _a;
8282
+ var workspaceNames = Object.keys((_a = config.builds) !== null && _a !== void 0 ? _a : {});
8283
+ var aIndex = workspaceNames.findIndex(function (c) { return c === a.context.name; });
8284
+ var bIndex = workspaceNames.findIndex(function (c) { return c === b.context.name; });
8285
+ return aIndex - bIndex;
8286
+ });
8287
+ allComponentJobs = allJobsPerTrigger
8288
+ .filter(function (j) { return j.context.type === "component"; })
7809
8289
  // sort by componentName in the same order as they appear in the config
7810
8290
  // this is purely for better readability in git diffs when you add new components
7811
8291
  .sort(function (a, b) {
7812
8292
  var componentNames = Object.keys(config.components);
7813
- var aIndex = componentNames.findIndex(function (c) { return c === a.context.componentName; });
7814
- var bIndex = componentNames.findIndex(function (c) { return c === b.context.componentName; });
8293
+ var aIndex = componentNames.findIndex(function (c) { return c === a.context.name; });
8294
+ var bIndex = componentNames.findIndex(function (c) { return c === b.context.name; });
7815
8295
  return aIndex - bIndex;
7816
- })
7817
- .reduce(function (acc, _a) {
8296
+ });
8297
+ allJobs = __spreadArray(__spreadArray([], __read(allWorkspaceJobs), false), __read(allComponentJobs), false).reduce(function (acc, _a) {
7818
8298
  var _b, _c;
7819
8299
  var gitlabJob = _a.gitlabJob, name = _a.name;
7820
8300
  // merge jobs, if a job is already there, merge the rules
@@ -8133,59 +8613,63 @@ var utils_1 = __nccwpck_require__(2497);
8133
8613
  var gitlab_1 = __nccwpck_require__(8490);
8134
8614
  var removeUndefined_1 = __nccwpck_require__(1073);
8135
8615
  exports.GITLAB_ENVIRONMENT_URL_VARIABLE = "CL_GITLAB_ENVIRONMENT_URL";
8136
- var getFullJobName = function (name, componentName, env) {
8616
+ var getFullJobName = function (_a) {
8617
+ var type = _a.type, name = _a.name, baseName = _a.baseName, allJobs = _a.allJobs, env = _a.env;
8618
+ var shouldAddIcon = allJobs.workspaces.length > 0;
8619
+ var icon = type === "component" ? "🔹" : "🔸";
8620
+ var prefix = shouldAddIcon ? icon + " " : "";
8137
8621
  if (env) {
8138
- return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
8622
+ return "".concat(prefix).concat(baseName, " ").concat(name, " | ").concat(env, " ");
8139
8623
  }
8140
- return "".concat(componentName, " ").concat(name);
8624
+ return "".concat(prefix).concat(baseName, " ").concat(name);
8141
8625
  };
8142
- var getFullReferencedJobName = function (referencedJobName, componentName, env, allJobs) {
8626
+ var getFullReferencedJobNameFromComponent = function (referencedJobName, componentName, env, allJobs) {
8143
8627
  var _a, _b;
8144
- var referencedJob = (_b = (_a = allJobs
8145
- .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; });
8628
+ var referencedJob = (_b = (_a = allJobs.components
8629
+ .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; });
8146
8630
  if (!referencedJob) {
8147
8631
  throw new Error("unknown job referenced: '".concat(referencedJobName, "' from '").concat(env, ":").concat(componentName, "'"));
8148
8632
  }
8149
8633
  var envToSet = referencedJob.envMode !== "none" ? env : null;
8150
- return getFullJobName(referencedJobName, componentName, envToSet);
8634
+ return getFullJobName({
8635
+ type: "component",
8636
+ name: referencedJobName,
8637
+ baseName: componentName,
8638
+ env: envToSet,
8639
+ allJobs: allJobs,
8640
+ });
8641
+ };
8642
+ var getFullReferencedJobNameFromWorkspace = function (referencedJobName, workspaceName, env, allJobs) {
8643
+ var _a, _b;
8644
+ var referencedJob = (_b = (_a = allJobs.workspaces
8645
+ .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; });
8646
+ if (!referencedJob) {
8647
+ throw new Error("unknown job referenced: '".concat(referencedJobName, "' from workspace ").concat(env, ":").concat(workspaceName, "'"));
8648
+ }
8649
+ var envToSet = referencedJob.envMode !== "none" ? env : null;
8650
+ return getFullJobName({
8651
+ type: "workspace",
8652
+ name: referencedJobName,
8653
+ baseName: workspaceName,
8654
+ env: envToSet,
8655
+ allJobs: allJobs,
8656
+ });
8151
8657
  };
8152
8658
  var getJobName = function (need) {
8153
8659
  return (0, lodash_1.isObject)(need) ? need.job : need;
8154
8660
  };
8155
- var makeGitlabJob = function (context, _a, allJobs, baseRules) {
8156
- var _b, _c;
8157
- 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"]);
8661
+ var makeGitlabJob = function (context, job, allJobs, baseRules) {
8662
+ var _a, _b;
8663
+ 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"]);
8158
8664
  var stage = envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(context.env) : job.stage;
8159
- var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
8160
- var _a, _b, _c;
8161
- var referencedComponentName = context.componentName;
8162
- var allJobNamesFromThatStage = (_c = (_b = (_a = allJobs
8163
- .filter(function (j) {
8164
- return j.context.componentName === referencedComponentName &&
8165
- j.context.env === context.env;
8166
- })
8167
- .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 : [];
8168
- return allJobNamesFromThatStage.map(function (job) {
8169
- var _a;
8170
- return ({
8171
- job: job,
8172
- artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
8173
- componentName: referencedComponentName,
8174
- });
8175
- });
8665
+ var deduplicatedGitlabNeeds = getGitlabNeeds(context, job, allJobs);
8666
+ var fullJobName = getFullJobName({
8667
+ type: context.type,
8668
+ name: name,
8669
+ baseName: context.name,
8670
+ env: envMode !== "none" ? context.env : undefined,
8671
+ allJobs: allJobs,
8176
8672
  });
8177
- 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);
8178
- var gitlabNeeds = cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
8179
- var _a;
8180
- return (0, lodash_1.isObject)(n)
8181
- ? {
8182
- job: getFullReferencedJobName(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : context.componentName, context.env, allJobs),
8183
- artifacts: n.artifacts,
8184
- }
8185
- : getFullReferencedJobName(n, context.componentName, context.env, allJobs);
8186
- }).sort(function (a, b) { return getJobName(a).localeCompare(getJobName(b)); });
8187
- var deduplicatedGitlabNeeds = __spreadArray([], __read(new Map(gitlabNeeds.map(function (n) { return [(0, lodash_1.isObject)(n) ? n.job : n, n]; })).values()), false);
8188
- var fullJobName = getFullJobName(name, context.componentName, envMode !== "none" ? context.env : undefined);
8189
8673
  // backwards compatibility, some may still use KUBERNETES_CPU_REQUEST, KUBERNETES_MEMORY_REQUEST, etc. in variables.
8190
8674
  // 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
8191
8675
  var PIPELINE_RUNNER_VARIABLES = [
@@ -8208,25 +8692,30 @@ var makeGitlabJob = function (context, _a, allJobs, baseRules) {
8208
8692
  if (Object.keys(legacyRunnerVariables).length > 0) {
8209
8693
  console.warn("Legacy variables detected in ".concat(fullJobName, ": ").concat(Object.keys(legacyRunnerVariables).join(", "), ". Please move them to the runnerVariables key."));
8210
8694
  }
8211
- var rules = __spreadArray(__spreadArray([], __read(((_b = job.rules) !== null && _b !== void 0 ? _b : [])), false), __read((baseRules
8695
+ var rules = __spreadArray(__spreadArray([], __read(((_a = job.rules) !== null && _a !== void 0 ? _a : [])), false), __read((baseRules
8212
8696
  ? baseRules.map(function (rule) { return (__assign({ when: when }, rule)); })
8213
8697
  : when
8214
8698
  ? [{ when: when }]
8215
8699
  : [])), false);
8216
- 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,
8700
+ 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,
8217
8701
  // sort in a predictable manner for snapshot tests
8218
- needs: deduplicatedGitlabNeeds, retry: defaults_1.BASE_RETRY, interruptible: true }), context.componentName, context.env, allJobs);
8702
+ needs: deduplicatedGitlabNeeds, retry: defaults_1.BASE_RETRY, interruptible: true });
8703
+ var modified = addGitlabEnvironment(context, environment, gitlabJob, allJobs);
8219
8704
  return [fullJobName, (0, removeUndefined_1.removeUndefined)(modified)];
8220
8705
  };
8221
8706
  exports.makeGitlabJob = makeGitlabJob;
8222
- var addGitlabEnvironment = function (context, environment, job, componentName, env, // TODO: we could actually pull this from contxt
8223
- allJobs) {
8707
+ var addGitlabEnvironment = function (context, catladderJobEnvironment, job, allJobs) {
8224
8708
  var _a, _b;
8225
- if (!environment) {
8709
+ if (!catladderJobEnvironment) {
8710
+ return job;
8711
+ }
8712
+ if (context.type !== "component") {
8713
+ // don't add enviornment for workspace jobs atm.
8226
8714
  return job;
8227
8715
  }
8228
- var _c = context.environment, url = _c.url, envType = _c.envType;
8229
- var on_stop = environment.on_stop, restEnvironment = __rest(environment, ["on_stop"]);
8716
+ var env = context.env, name = context.name, environment = context.environment;
8717
+ var url = environment.url, envType = environment.envType;
8718
+ var on_stop = catladderJobEnvironment.on_stop, restEnvironment = __rest(catladderJobEnvironment, ["on_stop"]);
8230
8719
  // those can be dynamic, so we therefore have to do this: https://docs.gitlab.com/ee/ci/environments/#set-a-dynamic-environment-url
8231
8720
  var dotEnvFile = "gitlab_environment.env";
8232
8721
  var scriptToAdd = [
@@ -8234,11 +8723,11 @@ allJobs) {
8234
8723
  ];
8235
8724
  // this is NOT a bashVariable since it NEEDS to be used as a string in gitlab
8236
8725
  var gitlabEnvironmentName = envType === "review"
8237
- ? "".concat(env, "/$CI_COMMIT_REF_NAME/").concat(componentName) // FIXME: should be replaced with mr name as well
8238
- : "".concat(env, "/").concat(componentName);
8726
+ ? "".concat(env, "/$CI_COMMIT_REF_NAME/").concat(name) // FIXME: should be replaced with mr name as well
8727
+ : "".concat(env, "/").concat(name);
8239
8728
  return __assign(__assign({}, job), { environment: __assign(__assign({ name: gitlabEnvironmentName, url: "$".concat(exports.GITLAB_ENVIRONMENT_URL_VARIABLE) }, (on_stop
8240
8729
  ? {
8241
- on_stop: getFullReferencedJobName(on_stop, componentName, env, allJobs),
8730
+ on_stop: getFullReferencedJobNameFromComponent(on_stop, name, env, allJobs),
8242
8731
  }
8243
8732
  : {})), restEnvironment), artifacts: (0, lodash_1.merge)((_a = job.artifacts) !== null && _a !== void 0 ? _a : {}, {
8244
8733
  reports: {
@@ -8248,7 +8737,8 @@ allJobs) {
8248
8737
  };
8249
8738
  var createGitlabJobs = function (allJobs, baseRules) { return __awaiter(void 0, void 0, void 0, function () {
8250
8739
  return __generator(this, function (_a) {
8251
- return [2 /*return*/, allJobs.flatMap(function (_a) {
8740
+ // TODO: add workspace jobs
8741
+ return [2 /*return*/, __spreadArray(__spreadArray([], __read(allJobs.workspaces), false), __read(allJobs.components), false).flatMap(function (_a) {
8252
8742
  var context = _a.context, jobs = _a.jobs;
8253
8743
  return jobs.map(function (job) {
8254
8744
  var _a = __read((0, exports.makeGitlabJob)(context, job, allJobs, baseRules), 2), fullJobName = _a[0], gitlabJob = _a[1];
@@ -8262,6 +8752,103 @@ var createGitlabJobs = function (allJobs, baseRules) { return __awaiter(void 0,
8262
8752
  });
8263
8753
  }); };
8264
8754
  exports.createGitlabJobs = createGitlabJobs;
8755
+ function getGitlabNeeds(context, job, allJobs) {
8756
+ var needs = context.type === "workspace"
8757
+ ? getGitlabNeedsForWorkspaceJob(context, job, allJobs)
8758
+ : getGitlabNeedsForComponentJob(context, job, allJobs);
8759
+ return deduplicateNeeds(needs);
8760
+ }
8761
+ function deduplicateNeeds(needs) {
8762
+ return needs
8763
+ ? __spreadArray([], __read(new Map(needs.map(function (n) { return [(0, lodash_1.isObject)(n) ? n.job : n, n]; })).values()), false) : undefined;
8764
+ }
8765
+ function getGitlabNeedsForComponentJob(context, _a, allJobs) {
8766
+ var needsStages = _a.needsStages, needs = _a.needs, needsOtherComponent = _a.needsOtherComponent;
8767
+ var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
8768
+ var _a, _b, _c, _d, _e, _f, _g, _h;
8769
+ var componentName = context.name;
8770
+ if (!n.workspaceName) {
8771
+ var allJobNamesFromThatStage = (_c = (_b = (_a = allJobs.components
8772
+ .filter(function (j) {
8773
+ return j.context.name === componentName && j.context.env === context.env;
8774
+ })
8775
+ .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 : [];
8776
+ return allJobNamesFromThatStage.map(function (job) {
8777
+ var _a;
8778
+ return ({
8779
+ job: job,
8780
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
8781
+ componentName: componentName,
8782
+ });
8783
+ });
8784
+ }
8785
+ else {
8786
+ var allJobNamesFromThatStage = (_h = (_g = (_f = (_e = (_d = allJobs.workspaces
8787
+ .find(function (w) {
8788
+ return w.context.name === n.workspaceName &&
8789
+ w.context.env === context.env;
8790
+ })) === 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 : [];
8791
+ return allJobNamesFromThatStage.map(function (job) {
8792
+ var _a;
8793
+ return ({
8794
+ job: job,
8795
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
8796
+ workspaceName: n.workspaceName,
8797
+ });
8798
+ });
8799
+ }
8800
+ });
8801
+ 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);
8802
+ return cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
8803
+ var _a;
8804
+ return (0, lodash_1.isObject)(n)
8805
+ ? "workspaceName" in n
8806
+ ? {
8807
+ job: getFullReferencedJobNameFromWorkspace(n.job, n.workspaceName, context.env, allJobs),
8808
+ artifacts: n.artifacts,
8809
+ }
8810
+ : {
8811
+ job: getFullReferencedJobNameFromComponent(n.job, (_a = n.componentName) !== null && _a !== void 0 ? _a : context.name, context.env, allJobs),
8812
+ artifacts: n.artifacts,
8813
+ }
8814
+ : getFullReferencedJobNameFromComponent(n, context.name, context.env, allJobs);
8815
+ }).sort(function (a, b) { return getJobName(a).localeCompare(getJobName(b)); });
8816
+ }
8817
+ /**
8818
+ *
8819
+ *unclear whether we actually need this. So far jobs in a workspace don't have needs to other jobs from the same workspace
8820
+ */
8821
+ function getGitlabNeedsForWorkspaceJob(context, _a, allJobs) {
8822
+ var needsStages = _a.needsStages, needs = _a.needs;
8823
+ var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
8824
+ var _a, _b, _c, _d;
8825
+ var workspaceName = (_a = n.workspaceName) !== null && _a !== void 0 ? _a : context.name;
8826
+ var allJobNamesFromThatStage = (_d = (_c = (_b = allJobs.workspaces
8827
+ .filter(function (j) {
8828
+ return j.context.name === workspaceName && j.context.env === context.env;
8829
+ })
8830
+ .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 : [];
8831
+ return allJobNamesFromThatStage.map(function (job) {
8832
+ var _a;
8833
+ return ({
8834
+ job: job,
8835
+ artifacts: (_a = n.artifacts) !== null && _a !== void 0 ? _a : false,
8836
+ workspaceName: workspaceName,
8837
+ });
8838
+ });
8839
+ });
8840
+ var cleanedNeeds = __spreadArray(__spreadArray([], __read((needsFromStages !== null && needsFromStages !== void 0 ? needsFromStages : [])), false), __read((needs !== null && needs !== void 0 ? needs : [])), false);
8841
+ return cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
8842
+ return (0, lodash_1.isObject)(n)
8843
+ ? {
8844
+ job: getFullReferencedJobNameFromWorkspace(n.job, "workspaceName" in n && n.workspaceName
8845
+ ? n.workspaceName
8846
+ : context.name, context.env, allJobs),
8847
+ artifacts: n.artifacts,
8848
+ }
8849
+ : getFullReferencedJobNameFromWorkspace(n, context.name, context.env, allJobs);
8850
+ }).sort(function (a, b) { return getJobName(a).localeCompare(getJobName(b)); });
8851
+ }
8265
8852
  //# sourceMappingURL=createGitlabJobs.js.map
8266
8853
 
8267
8854
  /***/ }),
@@ -8478,6 +9065,17 @@ __exportStar(__nccwpck_require__(6564), exports);
8478
9065
 
8479
9066
  "use strict";
8480
9067
 
9068
+ var __assign = (this && this.__assign) || function () {
9069
+ __assign = Object.assign || function(t) {
9070
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
9071
+ s = arguments[i];
9072
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
9073
+ t[p] = s[p];
9074
+ }
9075
+ return t;
9076
+ };
9077
+ return __assign.apply(this, arguments);
9078
+ };
8481
9079
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
8482
9080
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
8483
9081
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -8540,25 +9138,20 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
8540
9138
  return to.concat(ar || Array.prototype.slice.call(from));
8541
9139
  };
8542
9140
  Object.defineProperty(exports, "__esModule", ({ value: true }));
8543
- exports.getPackageManagerInfoForComponent = void 0;
9141
+ exports.getPackageManagerInfoBase = exports.getPackageManagerInfoForComponent = void 0;
8544
9142
  var fs_1 = __nccwpck_require__(7147);
8545
9143
  var path_1 = __nccwpck_require__(1017);
8546
9144
  var path_equal_1 = __nccwpck_require__(4843);
8547
9145
  var yarnUtils_1 = __nccwpck_require__(7843);
8548
9146
  var getPackageManagerInfoForComponent = function (config, componentName) { return __awaiter(void 0, void 0, void 0, function () {
8549
- var version, isClassic, component, workspaces, currentWorkspace, componentIsInWorkspace, workspaceRoot, packageJson, workspacePackageJson, lockFile, configFiles, configFilePaths, currentWorkspaceDependencies, pathsToCopyInDocker;
9147
+ var baseInfo, workspaces, component, currentWorkspace, componentIsInWorkspace, workspaceRoot, packageJson, workspacePackageJson, lockFile, configFiles, configFilePaths, currentWorkspaceDependencies, pathsToCopyInDocker;
8550
9148
  return __generator(this, function (_a) {
8551
9149
  switch (_a.label) {
8552
- case 0: return [4 /*yield*/, (0, yarnUtils_1.getYarnVersion)()];
9150
+ case 0: return [4 /*yield*/, (0, exports.getPackageManagerInfoBase)()];
8553
9151
  case 1:
8554
- version = _a.sent();
8555
- if (!version)
8556
- throw new Error("could not get yarn version");
8557
- isClassic = version.startsWith("1");
9152
+ baseInfo = _a.sent();
9153
+ workspaces = baseInfo.workspaces;
8558
9154
  component = config.components[componentName];
8559
- return [4 /*yield*/, (0, yarnUtils_1.getWorkspaces)(isClassic)];
8560
- case 2:
8561
- workspaces = _a.sent();
8562
9155
  currentWorkspace = workspaces.find(function (w) {
8563
9156
  return (0, path_equal_1.pathEqual)(component.dir, w.location);
8564
9157
  });
@@ -8581,20 +9174,35 @@ var getPackageManagerInfoForComponent = function (config, componentName) { retur
8581
9174
  ], __read((workspacePackageJson ? [workspacePackageJson] : [])), false), [
8582
9175
  lockFile
8583
9176
  ], false), __read(configFilePaths), false), __read(currentWorkspaceDependencies), false);
9177
+ return [2 /*return*/, __assign(__assign({}, baseInfo), { currentWorkspace: currentWorkspace, currentWorkspaceDependencies: currentWorkspaceDependencies, componentIsInWorkspace: componentIsInWorkspace, pathsToCopyInDocker: pathsToCopyInDocker })];
9178
+ }
9179
+ });
9180
+ }); };
9181
+ exports.getPackageManagerInfoForComponent = getPackageManagerInfoForComponent;
9182
+ // TODO: memoizee
9183
+ var getPackageManagerInfoBase = function () { return __awaiter(void 0, void 0, void 0, function () {
9184
+ var version, isClassic, workspaces;
9185
+ return __generator(this, function (_a) {
9186
+ switch (_a.label) {
9187
+ case 0: return [4 /*yield*/, (0, yarnUtils_1.getYarnVersion)()];
9188
+ case 1:
9189
+ version = _a.sent();
9190
+ if (!version)
9191
+ throw new Error("could not get yarn version");
9192
+ isClassic = version.startsWith("1");
9193
+ return [4 /*yield*/, (0, yarnUtils_1.getWorkspaces)(isClassic)];
9194
+ case 2:
9195
+ workspaces = _a.sent();
8584
9196
  return [2 /*return*/, {
8585
9197
  type: "yarn",
8586
9198
  workspaces: workspaces,
8587
9199
  version: version,
8588
9200
  isClassic: isClassic,
8589
- currentWorkspace: currentWorkspace,
8590
- currentWorkspaceDependencies: currentWorkspaceDependencies,
8591
- componentIsInWorkspace: componentIsInWorkspace,
8592
- pathsToCopyInDocker: pathsToCopyInDocker,
8593
9201
  }];
8594
9202
  }
8595
9203
  });
8596
9204
  }); };
8597
- exports.getPackageManagerInfoForComponent = getPackageManagerInfoForComponent;
9205
+ exports.getPackageManagerInfoBase = getPackageManagerInfoBase;
8598
9206
  //# sourceMappingURL=packageManager.js.map
8599
9207
 
8600
9208
  /***/ }),
@@ -8914,6 +9522,15 @@ exports.isKnowEnvType = isKnowEnvType;
8914
9522
  "use strict";
8915
9523
 
8916
9524
  Object.defineProperty(exports, "__esModule", ({ value: true }));
9525
+ exports.componentContextHasWorkspaceBuild = exports.componentContextIsStandaloneBuild = void 0;
9526
+ var componentContextIsStandaloneBuild = function (context) {
9527
+ return context.build.type === "standalone";
9528
+ };
9529
+ exports.componentContextIsStandaloneBuild = componentContextIsStandaloneBuild;
9530
+ var componentContextHasWorkspaceBuild = function (context) {
9531
+ return context.build.type === "fromWorkspace";
9532
+ };
9533
+ exports.componentContextHasWorkspaceBuild = componentContextHasWorkspaceBuild;
8917
9534
  //# sourceMappingURL=context.js.map
8918
9535
 
8919
9536
  /***/ }),