@catladder/cli 0.0.0-refactor-gitlab-jobs-a7359bde → 0.0.0-remove-undefined-66ca1336

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 (26) hide show
  1. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +22 -62
  2. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
  3. package/dist/apps/cli/commands/project/commandConfigSecrets.js +15 -4
  4. package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -1
  5. package/dist/apps/cli/commands/project/commandGetShell.js +9 -6
  6. package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -1
  7. package/dist/apps/cli/commands/project/setup/setupContext.js +3 -10
  8. package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -1
  9. package/dist/apps/cli/commands/project/setup/setupKubernetes.js +16 -5
  10. package/dist/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
  11. package/dist/apps/cli/verify/migration/migrateSecrets.js +3 -1
  12. package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -1
  13. package/dist/bundles/catenv/index.js +345 -93
  14. package/dist/bundles/cli/index.js +873 -650
  15. package/dist/tsconfig.tsbuildinfo +1 -1
  16. package/package.json +2 -2
  17. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +18 -43
  18. package/src/apps/cli/commands/project/commandConfigSecrets.ts +16 -2
  19. package/src/apps/cli/commands/project/commandGetShell.ts +8 -5
  20. package/src/apps/cli/commands/project/setup/setupContext.ts +2 -5
  21. package/src/apps/cli/commands/project/setup/setupKubernetes.ts +27 -6
  22. package/src/apps/cli/verify/migration/migrateSecrets.ts +6 -1
  23. package/dist/apps/cli/commands/project/setup/setupCloudSQL.d.ts +0 -3
  24. package/dist/apps/cli/commands/project/setup/setupCloudSQL.js +0 -56
  25. package/dist/apps/cli/commands/project/setup/setupCloudSQL.js.map +0 -1
  26. package/src/apps/cli/commands/project/setup/setupCloudSQL.ts +0 -22
@@ -38952,13 +38952,131 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
38952
38952
  exports.__esModule = true;
38953
38953
  exports.createCustomJobs = void 0;
38954
38954
  var buildJob_1 = __nccwpck_require__(2644);
38955
+ var testJob_1 = __nccwpck_require__(2253);
38955
38956
  var createCustomJobs = function (context) {
38956
- return __spreadArray([], __read((0, buildJob_1.createCustomBuildJobs)(context)), false);
38957
+ return __spreadArray(__spreadArray([], __read((0, testJob_1.createCustomTestJobs)(context)), false), __read((0, buildJob_1.createCustomBuildJobs)(context)), false);
38957
38958
  };
38958
38959
  exports.createCustomJobs = createCustomJobs;
38959
38960
 
38960
38961
  /***/ }),
38961
38962
 
38963
+ /***/ 2253:
38964
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
38965
+
38966
+ "use strict";
38967
+
38968
+
38969
+ var __assign = this && this.__assign || function () {
38970
+ __assign = Object.assign || function (t) {
38971
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
38972
+ s = arguments[i];
38973
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
38974
+ }
38975
+ return t;
38976
+ };
38977
+ return __assign.apply(this, arguments);
38978
+ };
38979
+ var __read = this && this.__read || function (o, n) {
38980
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
38981
+ if (!m) return o;
38982
+ var i = m.call(o),
38983
+ r,
38984
+ ar = [],
38985
+ e;
38986
+ try {
38987
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
38988
+ } catch (error) {
38989
+ e = {
38990
+ error: error
38991
+ };
38992
+ } finally {
38993
+ try {
38994
+ if (r && !r.done && (m = i["return"])) m.call(i);
38995
+ } finally {
38996
+ if (e) throw e.error;
38997
+ }
38998
+ }
38999
+ return ar;
39000
+ };
39001
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
39002
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
39003
+ if (ar || !(i in from)) {
39004
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
39005
+ ar[i] = from[i];
39006
+ }
39007
+ }
39008
+ return to.concat(ar || Array.prototype.slice.call(from));
39009
+ };
39010
+ exports.__esModule = true;
39011
+ exports.createCustomTestJobs = void 0;
39012
+ var path_1 = __nccwpck_require__(1017);
39013
+ var utils_1 = __nccwpck_require__(7461);
39014
+ var types_1 = __nccwpck_require__(1197);
39015
+ var RUNNER_CUSTOM_TEST_VARIABLES = {
39016
+ KUBERNETES_CPU_REQUEST: "0.5",
39017
+ KUBERNETES_CPU_LIMIT: "2",
39018
+ KUBERNETES_MEMORY_REQUEST: "2Gi",
39019
+ KUBERNETES_MEMORY_LIMIT: "4Gi"
39020
+ };
39021
+ var createCustomTestJobs = function (context) {
39022
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
39023
+ // don't run tests after release
39024
+ if (((_a = context.commitInfo) === null || _a === void 0 ? void 0 : _a.trigger) === "taggedRelease") {
39025
+ return [];
39026
+ }
39027
+ var buildConfig = context.componentConfig.build;
39028
+ if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
39029
+ throw new Error("deploy config is not custom");
39030
+ }
39031
+ var base = {
39032
+ variables: __assign(__assign({
39033
+ APP_PATH: context.componentConfig.dir
39034
+ }, RUNNER_CUSTOM_TEST_VARIABLES), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
39035
+ services: buildConfig.jobServices,
39036
+ cache: buildConfig.jobCache,
39037
+ stage: "test",
39038
+ needs: [],
39039
+ envMode: "none"
39040
+ };
39041
+ var auditJob = buildConfig.audit ? __assign(__assign(__assign({
39042
+ name: "🛡 audit"
39043
+ }, base), {
39044
+ image: (_d = (_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.jobImage) !== null && _d !== void 0 ? _d : buildConfig.jobImage,
39045
+ cache: undefined,
39046
+ script: __spreadArray([], __read((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : []), false),
39047
+ allow_failure: true
39048
+ }), createArtifactsConfig(context.componentConfig.dir, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifactsReports)) : null;
39049
+ var lintJob = buildConfig.lint ? __assign(__assign(__assign({
39050
+ name: "👮 lint"
39051
+ }, base), {
39052
+ image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : buildConfig.jobImage,
39053
+ script: __spreadArray([], __read((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : []), false)
39054
+ }), createArtifactsConfig(context.componentConfig.dir, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifactsReports)) : null;
39055
+ var testJob = buildConfig.test ? __assign(__assign(__assign({
39056
+ name: "🧪 test"
39057
+ }, base), {
39058
+ image: (_p = (_o = buildConfig.test) === null || _o === void 0 ? void 0 : _o.jobImage) !== null && _p !== void 0 ? _p : buildConfig.jobImage,
39059
+ script: __spreadArray([], __read((_r = (0, utils_1.ensureArray)((_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.command)) !== null && _r !== void 0 ? _r : []), false)
39060
+ }), createArtifactsConfig(context.componentConfig.dir, (_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.artifactsReports)) : null;
39061
+ return [auditJob, lintJob, testJob].filter(utils_1.notNil);
39062
+ };
39063
+ exports.createCustomTestJobs = createCustomTestJobs;
39064
+ var createArtifactsConfig = function (rootPath, artifactsReports) {
39065
+ var _a, _b;
39066
+ return artifactsReports ? {
39067
+ artifacts: {
39068
+ paths: [],
39069
+ reports: {
39070
+ junit: (_b = (_a = artifactsReports === null || artifactsReports === void 0 ? void 0 : artifactsReports.junit) === null || _a === void 0 ? void 0 : _a.map(function (p) {
39071
+ return (0, path_1.join)(rootPath, p);
39072
+ })) !== null && _b !== void 0 ? _b : []
39073
+ }
39074
+ }
39075
+ } : undefined;
39076
+ };
39077
+
39078
+ /***/ }),
39079
+
38962
39080
  /***/ 3219:
38963
39081
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
38964
39082
 
@@ -39053,18 +39171,22 @@ var requiresDockerBuild = function (context) {
39053
39171
  return false;
39054
39172
  };
39055
39173
  exports.requiresDockerBuild = requiresDockerBuild;
39174
+ var getDockerBaseVariables = function () {
39175
+ return {
39176
+ DOCKER_HOST: "tcp://0.0.0.0:2375",
39177
+ DOCKER_TLS_CERTDIR: "",
39178
+ DOCKER_DRIVER: "overlay2",
39179
+ DOCKER_BUILDKIT: "1"
39180
+ };
39181
+ };
39056
39182
  var getDockerBuildVariables = function (context) {
39057
39183
  var _a, _b, _c, _d;
39058
- return __assign(__assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
39059
- DOCKER_BUILDKIT: "1",
39184
+ return __assign(__assign(__assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
39060
39185
  DOCKERFILE_ADDITIONS: (_b = (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.additionsBegin) === null || _b === void 0 ? void 0 : _b.join("\n"),
39061
39186
  DOCKERFILE_ADDITIONS_END: (_d = (_c = context.componentConfig.build.docker) === null || _c === void 0 ? void 0 : _c.additionsEnd) === null || _d === void 0 ? void 0 : _d.join("\n"),
39062
39187
  APP_DIR: context.componentConfig.dir,
39063
- DOCKER_HOST: "tcp://0.0.0.0:2375",
39064
- DOCKER_TLS_CERTDIR: "",
39065
- DOCKER_DIR: ".",
39066
- DOCKER_DRIVER: "overlay2"
39067
- }), (0, exports.getDockerImageVariables)(context));
39188
+ DOCKER_DIR: "."
39189
+ }), getDockerBaseVariables()), (0, exports.getDockerImageVariables)(context));
39068
39190
  };
39069
39191
  exports.getDockerBuildVariables = getDockerBuildVariables;
39070
39192
  exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
@@ -39075,7 +39197,7 @@ var getDockerJobBaseProps = function (context) {
39075
39197
  name: "docker:20-dind",
39076
39198
  command: ["--tls=false"]
39077
39199
  }],
39078
- variables: (0, exports.getDockerBuildVariables)(context)
39200
+ variables: getDockerBaseVariables()
39079
39201
  };
39080
39202
  };
39081
39203
  exports.getDockerJobBaseProps = getDockerJobBaseProps;
@@ -39088,7 +39210,9 @@ var createDockerBuildJobBase = function (context, _a) {
39088
39210
  stage: "build"
39089
39211
  }, (0, exports.getDockerJobBaseProps)(context)), {
39090
39212
  script: script || []
39091
- }), def);
39213
+ }), {
39214
+ variables: (0, exports.getDockerBuildVariables)(context)
39215
+ }, def);
39092
39216
  };
39093
39217
  exports.createDockerBuildJobBase = createDockerBuildJobBase;
39094
39218
  exports.gitlabDockerLogin = "docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY";
@@ -39267,13 +39391,7 @@ var createNodeBuildJobs = function (context) {
39267
39391
  cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
39268
39392
  variables: {
39269
39393
  // only required for non static
39270
- YARN_INSTALL: (0, yarn_1.getYarnInstallCommand)(context, {
39271
- prodOnly: true
39272
- }),
39273
- YARN_INSTALL_WITHOUT_SCRIPTS: (0, yarn_1.getYarnInstallCommand)(context, {
39274
- prodOnly: true,
39275
- noScripts: true
39276
- }),
39394
+ DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context),
39277
39395
  DOCKER_COPY_WORKSPACE_FILES: (_e = (_d = context.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.pathsToCopyInDocker.map(function (dir) {
39278
39396
  return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir);
39279
39397
  })) === null || _e === void 0 ? void 0 : _e.join("\n")
@@ -39676,31 +39794,43 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
39676
39794
  return to.concat(ar || Array.prototype.slice.call(from));
39677
39795
  };
39678
39796
  exports.__esModule = true;
39679
- exports.getYarnInstall = exports.ensureNodeVersion = exports.getYarnInstallCommand = void 0;
39680
- var getYarnInstallCommand = function (context, options) {
39797
+ exports.getDockerAppCopyAndBuildScript = exports.getYarnInstall = exports.ensureNodeVersion = void 0;
39798
+ var YARN_INSTALL_CLASSIC = "yarn install --frozen-lockfile";
39799
+ // FIXME: check why and when rebuild is needed
39800
+ var YARN_BERRY_PROD_REBUILD = "yarn workspaces focus --production && yarn rebuild";
39801
+ var getYarnInstallCommand = function (context) {
39681
39802
  var _a;
39682
39803
  if ((_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.isClassic) {
39683
- return "yarn install --frozen-lockfile ".concat((options === null || options === void 0 ? void 0 : options.prodOnly) ? "--production" : "", " ").concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "--ignore-scripts" : "");
39804
+ return YARN_INSTALL_CLASSIC;
39684
39805
  }
39685
- // is modern
39686
- // yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
39687
- // trying to import those fail on this version
39688
- var doesNotShipWithBuiltInPlugins = ["2", "3"].some(function (v) {
39689
- var _a;
39690
- return (_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.version.startsWith(v);
39691
- });
39692
- return (options === null || options === void 0 ? void 0 : options.prodOnly) ? "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "").concat(doesNotShipWithBuiltInPlugins ? "yarn plugin import workspace-tools && " : " ", "yarn workspaces focus --production && yarn rebuild") // needs yarn plugin import workspace-tools
39693
- : "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "", "yarn install --immutable");
39806
+ return "yarn install --immutable";
39694
39807
  };
39695
- exports.getYarnInstallCommand = getYarnInstallCommand;
39696
39808
  var ensureNodeVersion = function (context) {
39697
39809
  return ["if [ -f ./.nvmrc ]; then source /root/.nvm/nvm.sh && nvm install <<< .nvmrc; fi"];
39698
39810
  };
39699
39811
  exports.ensureNodeVersion = ensureNodeVersion;
39700
39812
  var getYarnInstall = function (context) {
39701
- return __spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), [(0, exports.getYarnInstallCommand)(context)], false);
39813
+ return __spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), [getYarnInstallCommand(context)], false);
39702
39814
  };
39703
39815
  exports.getYarnInstall = getYarnInstall;
39816
+ var DOCKER_COPY_FILES = "COPY --chown=node:node $APP_DIR .";
39817
+ var getDockerAppCopyAndBuildScript = function (context) {
39818
+ var _a;
39819
+ if ((_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.isClassic) {
39820
+ return "\nRUN ".concat(YARN_INSTALL_CLASSIC, " --production --ignore-scripts\n").concat(DOCKER_COPY_FILES, "\nRUN ").concat(YARN_INSTALL_CLASSIC, " --production \n ").trim();
39821
+ }
39822
+ // yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
39823
+ // trying to import those fail on this version
39824
+ var doesNotShipWithBuiltInPlugins = ["2", "3"].some(function (v) {
39825
+ var _a;
39826
+ return (_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.version.startsWith(v);
39827
+ });
39828
+ var maybeAddWorkspaceToolsCommand = doesNotShipWithBuiltInPlugins ? "RUN yarn plugin import workspace-tools" : "";
39829
+ // copy first everything and then install
39830
+ // rebuild first does not work as it will run postinstall and that might require files in the app
39831
+ return "\n".concat(DOCKER_COPY_FILES, "\n").concat(maybeAddWorkspaceToolsCommand, "\nRUN ").concat(YARN_BERRY_PROD_REBUILD, "\n\n ").trim();
39832
+ };
39833
+ exports.getDockerAppCopyAndBuildScript = getDockerAppCopyAndBuildScript;
39704
39834
 
39705
39835
  /***/ }),
39706
39836
 
@@ -39737,29 +39867,25 @@ exports.createRailsBuildJobs = void 0;
39737
39867
  var types_1 = __nccwpck_require__(1197);
39738
39868
  var docker_1 = __nccwpck_require__(3219);
39739
39869
  var createRailsBuildJobs = function (context) {
39740
- var _a, _b, _c, _d, _e, _f;
39870
+ var _a, _b, _c;
39741
39871
  var buildConfig = context.componentConfig.build;
39742
39872
  if (!(0, types_1.isOfBuildType)(buildConfig, "rails")) {
39743
39873
  // should not happen
39744
39874
  throw new Error("build type is not rails");
39745
39875
  }
39746
39876
  var cnbConf = buildConfig.cnbBuilder;
39747
- // backwards compatabilty with CNB_ENV_VARS
39748
- // TODO: remove when all projects are migrated
39749
- var packEnvArgs = (_c = (_b = (_a = buildConfig.extraVars) === null || _a === void 0 ? void 0 : _a.CNB_ENV_VARS) === null || _b === void 0 ? void 0 : _b.split(" ").map(function (v) {
39750
- return "--env '".concat(v, "'");
39751
- })) !== null && _c !== void 0 ? _c : Object.entries((_d = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.buildVars) !== null && _d !== void 0 ? _d : {}).map(function (_a) {
39877
+ var packEnvArgs = Object.entries((_a = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.buildVars) !== null && _a !== void 0 ? _a : {}).map(function (_a) {
39752
39878
  var _b = __read(_a, 2),
39753
39879
  k = _b[0],
39754
39880
  v = _b[1];
39755
39881
  return "--env '".concat(k).concat(v ? "=".concat(v) : "", "'");
39756
- });
39882
+ }).join(" ");
39757
39883
  return [(0, docker_1.createDockerBuildJobBase)(context, {
39758
39884
  variables: context.componentConfig.build.extraVars,
39759
39885
  // custom script
39760
39886
  script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
39761
39887
  // replace private git ssh gem sources with https to make bundler with credentials via env var work
39762
- "sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs.join(" "), " ").concat((_f = (_e = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _e === void 0 ? void 0 : _e.join(" ")) !== null && _f !== void 0 ? _f : "")]
39888
+ "sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs, " ").concat((_c = (_b = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : "")]
39763
39889
  })];
39764
39890
  };
39765
39891
  exports.createRailsBuildJobs = createRailsBuildJobs;
@@ -39883,9 +40009,8 @@ var createRailsTestJobs = function (context) {
39883
40009
  var bundlerCache = {
39884
40010
  key: {
39885
40011
  files: ["Gemfile.lock"],
39886
- prefix: "$CI_JOB_IMAGE" // a changed image might have different OS libraries which no longer work with the cached gems
40012
+ prefix: "$CI_JOB_IMAGE"
39887
40013
  },
39888
-
39889
40014
  paths: [bundlerCacheDir]
39890
40015
  };
39891
40016
  var auditJob = buildConfig.audit !== false ? __assign(__assign({
@@ -40106,7 +40231,7 @@ exports.readConfigSync = readConfigSync;
40106
40231
 
40107
40232
  exports.__esModule = true;
40108
40233
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
40109
- exports.PIPELINE_IMAGE_TAG = "refactor-gitlab-jobs-a7359bde" || 0;
40234
+ exports.PIPELINE_IMAGE_TAG = "remove-undefined-66ca1336" || 0;
40110
40235
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
40111
40236
 
40112
40237
  /***/ }),
@@ -40563,8 +40688,13 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
40563
40688
  }
40564
40689
  publicEnvVarsRaw = (_e = (_d = envConfigRaw.vars) === null || _d === void 0 ? void 0 : _d.public) !== null && _e !== void 0 ? _e : {};
40565
40690
  additionalSecretKeys = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].additionalSecretKeys(environmentContext) : [];
40566
- secretEnvVarKeys = __spreadArray(__spreadArray([], __read((_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.secret) !== null && _g !== void 0 ? _g : []), false), __read(additionalSecretKeys), false);
40567
- secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
40691
+ secretEnvVarKeys = __spreadArray(__spreadArray([], __read(((_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.secret) !== null && _g !== void 0 ? _g : []).map(function (key) {
40692
+ return {
40693
+ key: key
40694
+ };
40695
+ })), false), __read(additionalSecretKeys), false);
40696
+ secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (_a) {
40697
+ var key = _a.key;
40568
40698
  return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
40569
40699
  }));
40570
40700
  legacyFromComponents = (_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.fromComponents) !== null && _j !== void 0 ? _j : {};
@@ -41419,6 +41549,7 @@ var createGoogleCloudRunDeployJobs = function (context) {
41419
41549
  };
41420
41550
  var getCreateScheduleScripts = function () {
41421
41551
  return jobsWithSchedule.map(function (_a) {
41552
+ var _b;
41422
41553
  var job = _a.job,
41423
41554
  jobName = _a.jobName,
41424
41555
  schedulerName = _a.schedulerName;
@@ -41426,6 +41557,7 @@ var createGoogleCloudRunDeployJobs = function (context) {
41426
41557
  project: deployConfig.projectId,
41427
41558
  location: deployConfig.region,
41428
41559
  schedule: "\"".concat(job.schedule, "\""),
41560
+ "max-retry-attempts": (_b = job.maxRetryAttempts) !== null && _b !== void 0 ? _b : 0,
41429
41561
  uri: "\"https://".concat(deployConfig.region, "-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/").concat(deployConfig.projectId, "/jobs/").concat(jobName, ":run\""),
41430
41562
  "http-method": "POST",
41431
41563
  "oauth-service-account-email": "$GCLOUD_PROJECT_NUMBER-compute@developer.gserviceaccount.com"
@@ -41441,13 +41573,15 @@ var createGoogleCloudRunDeployJobs = function (context) {
41441
41573
  });
41442
41574
  return jobsWithSchedule.map(function (_a) {
41443
41575
  var schedulerName = _a.schedulerName;
41444
- return __spreadArray([], __read((0, gitlab_1.allowFailureInScripts)(["gcloud scheduler jobs delete ".concat(schedulerName, " ").concat(argsString)])), false);
41576
+ return ["gcloud scheduler jobs delete ".concat(schedulerName, " ").concat(argsString)];
41445
41577
  }).flat();
41446
41578
  };
41447
41579
  var getDeleteJobsScripts = function () {
41448
- return jobsWithNames.map(function (_a) {
41580
+ return jobsWithNames.flatMap(function (_a) {
41449
41581
  var jobName = _a.jobName;
41450
- return "gcloud beta run jobs delete ".concat(jobName, " ").concat(commonArgsString);
41582
+ return [
41583
+ // first delete all job executions. Otherwise delete might fail if one of those is still running
41584
+ "gcloud beta run jobs executions list ".concat(commonArgsString, " --job ").concat(jobName, " --format=\"value(name)\" | xargs -I {} gcloud beta run jobs executions delete {} --quiet ").concat(commonArgsString), "gcloud beta run jobs delete ".concat(jobName, " ").concat(commonArgsString)];
41451
41585
  });
41452
41586
  };
41453
41587
  var deployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(setExtraVarsScripts(deployConfig)), false), __read(pushImageToArtifactsRegistry), false), ["echo \"$ENV_VARS\" > ____envvars.yaml"], false), __read(deployConfig.cloudSql ? (0, database_1.getDatabaseCreateScript)(context, deployConfig) // we create the db, so that we can also delete it afterwards
@@ -41481,7 +41615,7 @@ var createGoogleCloudRunDeployJobs = function (context) {
41481
41615
  variables: {
41482
41616
  CLOUDSDK_CORE_DISABLE_PROMPTS: "1"
41483
41617
  },
41484
- script: stopScripts
41618
+ script: (0, gitlab_1.allowFailureInScripts)(stopScripts)
41485
41619
  })];
41486
41620
  };
41487
41621
  exports.createGoogleCloudRunDeployJobs = createGoogleCloudRunDeployJobs;
@@ -41539,20 +41673,21 @@ exports.__esModule = true;
41539
41673
  exports.GCLOUD_RUN_DEPLOY_TYPE = exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = void 0;
41540
41674
  var context_1 = __nccwpck_require__(2041);
41541
41675
  var gitlab_1 = __nccwpck_require__(4997);
41676
+ var utils_1 = __nccwpck_require__(463);
41542
41677
  var deployJob_1 = __nccwpck_require__(2256);
41543
41678
  var jobName_1 = __nccwpck_require__(7311);
41544
41679
  exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
41545
41680
  exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
41546
41681
  var getCloudSqlVariables = function (_a) {
41547
- var _b, _c, _d, _e;
41682
+ var _b, _c;
41548
41683
  var deployConfigRaw = _a.deployConfigRaw,
41549
41684
  environmentSlugPrefix = _a.environmentSlugPrefix,
41550
41685
  env = _a.env,
41551
41686
  componentName = _a.componentName,
41552
41687
  fullConfig = _a.fullConfig;
41553
41688
  if (deployConfigRaw && deployConfigRaw.cloudSql) {
41554
- var DB_NAME = [(_b = deployConfigRaw.cloudSql.dbNamePrefix) !== null && _b !== void 0 ? _b : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlugPrefix, (_c = deployConfigRaw.cloudSql.dbBaseName) !== null && _c !== void 0 ? _c : componentName].filter(Boolean).join("-");
41555
- var additionalQueryParamsString = Object.entries((_d = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _d !== void 0 ? _d : {}).map(function (_a) {
41689
+ var DB_NAME = (0, utils_1.getFullDbName)(deployConfigRaw.cloudSql, fullConfig, environmentSlugPrefix, componentName);
41690
+ var additionalQueryParamsString = Object.entries((_b = deployConfigRaw.cloudSql.dbAdditionalQueryParams) !== null && _b !== void 0 ? _b : {}).map(function (_a) {
41556
41691
  var _b = __read(_a, 2),
41557
41692
  key = _b[0],
41558
41693
  value = _b[1];
@@ -41561,7 +41696,7 @@ var getCloudSqlVariables = function (_a) {
41561
41696
  return {
41562
41697
  CLOUD_SQL_INSTANCE_CONNECTION_NAME: deployConfigRaw.cloudSql.instanceConnectionName,
41563
41698
  DB_NAME: DB_NAME,
41564
- DB_USER: (_e = deployConfigRaw.cloudSql.dbUser) !== null && _e !== void 0 ? _e : "postgres",
41699
+ DB_USER: (_c = deployConfigRaw.cloudSql.dbUser) !== null && _c !== void 0 ? _c : "postgres",
41565
41700
  DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD"),
41566
41701
  DATABASE_URL: "postgresql://$DB_USER:$DB_PASSWORD@localhost/$DB_NAME?host=/cloudsql/$CLOUD_SQL_INSTANCE_CONNECTION_NAME".concat(additionalQueryParamsString),
41567
41702
  DATABASE_JDBC_URL: "jdbc:postgresql:///$DB_NAME?cloudSqlInstance=$CLOUD_SQL_INSTANCE_CONNECTION_NAME&socketFactory=com.google.cloud.sql.postgres.SocketFactory&user=$DB_USER&password=$DB_PASSWORD".concat(additionalQueryParamsString)
@@ -41584,7 +41719,15 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
41584
41719
  return {};
41585
41720
  },
41586
41721
  additionalSecretKeys: function (ctx) {
41587
- return __spreadArray([exports.GCLOUD_DEPLOY_CREDENTIALS_KEY], __read(ctx.deployConfigRaw && ctx.deployConfigRaw.cloudSql ? ["DB_PASSWORD"] : []), false);
41722
+ return __spreadArray([{
41723
+ key: exports.GCLOUD_DEPLOY_CREDENTIALS_KEY,
41724
+ hidden: true
41725
+ }, {
41726
+ key: exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX,
41727
+ hidden: true
41728
+ }], __read(ctx.deployConfigRaw && ctx.deployConfigRaw.cloudSql ? [{
41729
+ key: "DB_PASSWORD"
41730
+ }] : []), false);
41588
41731
  },
41589
41732
  getAdditionalEnvVars: function (ctx) {
41590
41733
  var _a;
@@ -41772,6 +41915,22 @@ exports.getCloudRunJobName = getCloudRunJobName;
41772
41915
 
41773
41916
  /***/ }),
41774
41917
 
41918
+ /***/ 463:
41919
+ /***/ ((__unused_webpack_module, exports) => {
41920
+
41921
+ "use strict";
41922
+
41923
+
41924
+ exports.__esModule = true;
41925
+ exports.getFullDbName = void 0;
41926
+ var getFullDbName = function (cloudSqlConfig, fullConfig, environmentSlugPrefix, componentName) {
41927
+ var _a, _b;
41928
+ return [(_a = cloudSqlConfig.dbNamePrefix) !== null && _a !== void 0 ? _a : "".concat(fullConfig.customerName, "-").concat(fullConfig.appName), environmentSlugPrefix, (_b = cloudSqlConfig.dbBaseName) !== null && _b !== void 0 ? _b : componentName].filter(Boolean).join("-");
41929
+ };
41930
+ exports.getFullDbName = getFullDbName;
41931
+
41932
+ /***/ }),
41933
+
41775
41934
  /***/ 6531:
41776
41935
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
41777
41936
 
@@ -41817,7 +41976,7 @@ var runner_1 = __nccwpck_require__(5071);
41817
41976
  var base_1 = __nccwpck_require__(9177);
41818
41977
  var types_1 = __nccwpck_require__(3109);
41819
41978
  var createCustomDeployJobs = function (context) {
41820
- var _a, _b;
41979
+ var _a, _b, _c;
41821
41980
  var deployConfig = context.componentConfig.deploy;
41822
41981
  if (deployConfig === false) {
41823
41982
  return [];
@@ -41828,11 +41987,14 @@ var createCustomDeployJobs = function (context) {
41828
41987
  }
41829
41988
  var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
41830
41989
  var yarnInstall = (0, yarn_1.getYarnInstall)(context);
41831
- return [(0, lodash_1.merge)({}, baseDeploymentJob, {
41990
+ return __spreadArray([(0, lodash_1.merge)({}, baseDeploymentJob, {
41832
41991
  image: (_a = deployConfig.jobImage) !== null && _a !== void 0 ? _a : (0, runner_1.getRunnerImage)("jobs-default"),
41833
41992
  cache: (_b = deployConfig.jobCache) !== null && _b !== void 0 ? _b : [],
41834
41993
  script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(deployConfig.requiresYarnInstall ? yarnInstall : []), false), __read(deployConfig.script), false)
41835
- })];
41994
+ })], __read(deployConfig.stopScript ? [(0, lodash_1.merge)({}, (0, base_1.getBaseDeploymentStopJob)(context), {
41995
+ image: (_c = deployConfig.jobImage) !== null && _c !== void 0 ? _c : (0, runner_1.getRunnerImage)("jobs-default"),
41996
+ script: deployConfig.stopScript
41997
+ })] : []), false);
41836
41998
  };
41837
41999
  exports.createCustomDeployJobs = createCustomDeployJobs;
41838
42000
 
@@ -41982,7 +42144,11 @@ var additionalKubernetesSecretKeys = function (_a) {
41982
42144
  keys.push("POSTGRESQL_PASSWORD");
41983
42145
  keys.push("cloudsqlProxyCredentials");
41984
42146
  }
41985
- return keys;
42147
+ return keys.map(function (key) {
42148
+ return {
42149
+ key: key
42150
+ };
42151
+ });
41986
42152
  };
41987
42153
  exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
41988
42154
 
@@ -41995,8 +42161,9 @@ exports.additionalKubernetesSecretKeys = additionalKubernetesSecretKeys;
41995
42161
 
41996
42162
 
41997
42163
  exports.__esModule = true;
41998
- exports.createCloudsqlBaseConfig = exports.getKubernetesCloudSQLConfig = exports.hasKubernetesCloudSQL = void 0;
42164
+ exports.createKubernetesCloudsqlBaseValues = exports.hasKubernetesCloudSQL = void 0;
41999
42165
  var context_1 = __nccwpck_require__(2041);
42166
+ var utils_1 = __nccwpck_require__(463);
42000
42167
  var types_1 = __nccwpck_require__(3109);
42001
42168
  var hasKubernetesCloudSQL = function (context) {
42002
42169
  var _a, _b;
@@ -42006,22 +42173,42 @@ var hasKubernetesCloudSQL = function (context) {
42006
42173
  return false;
42007
42174
  };
42008
42175
  exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
42009
- var getKubernetesCloudSQLConfig = function (context) {
42010
- var _a;
42011
- if ((0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
42012
- return (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql;
42176
+ var createKubernetesCloudsqlBaseValues = function (context) {
42177
+ var _a, _b, _c, _d, _e;
42178
+ if (!(0, types_1.isOfDeployType)(context.componentConfig.deploy, "kubernetes")) {
42179
+ throw new Error("cannot get cloud sql config");
42180
+ }
42181
+ var config = (_a = context.componentConfig.deploy.values) === null || _a === void 0 ? void 0 : _a.cloudsql;
42182
+ if (!config) {
42183
+ throw new Error("cannot get cloud sql config");
42184
+ }
42185
+ var proxyCredentials = "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"));
42186
+ if ((config === null || config === void 0 ? void 0 : config.type) !== "unmanaged") {
42187
+ var instanceConnectionName = "".concat((_b = config.projectId) !== null && _b !== void 0 ? _b : "skynet-164509", ":").concat((_c = config.region) !== null && _c !== void 0 ? _c : "europe-west6", ":").concat((_d = config.instanceId) !== null && _d !== void 0 ? _d : context.environment.envVars.KUBE_NAMESPACE);
42188
+ return {
42189
+ cloudsql: {
42190
+ enabled: config.enabled,
42191
+ dbUser: "postgres",
42192
+ instanceConnectionName: instanceConnectionName,
42193
+ proxyCredentials: proxyCredentials,
42194
+ fullDbName: context.environment.envVars.KUBE_APP_NAME
42195
+ }
42196
+ };
42197
+ } else if (config.type === "unmanaged") {
42198
+ return {
42199
+ cloudsql: {
42200
+ enabled: config.enabled,
42201
+ dbUser: (_e = config.dbUser) !== null && _e !== void 0 ? _e : "postgres",
42202
+ instanceConnectionName: config.instanceConnectionName,
42203
+ proxyCredentials: proxyCredentials,
42204
+ fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.componentName)
42205
+ }
42206
+ };
42207
+ } else {
42208
+ throw new Error("unknonw type");
42013
42209
  }
42014
- throw new Error("cannot get cloud sql config");
42015
- };
42016
- exports.getKubernetesCloudSQLConfig = getKubernetesCloudSQLConfig;
42017
- var createCloudsqlBaseConfig = function (context) {
42018
- return {
42019
- cloudsql: {
42020
- proxyCredentials: "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"))
42021
- }
42022
- };
42023
42210
  };
42024
- exports.createCloudsqlBaseConfig = createCloudsqlBaseConfig;
42211
+ exports.createKubernetesCloudsqlBaseValues = createKubernetesCloudsqlBaseValues;
42025
42212
 
42026
42213
  /***/ }),
42027
42214
 
@@ -42340,33 +42527,36 @@ var kubeEnv_1 = __nccwpck_require__(9449);
42340
42527
  var mongodb_1 = __nccwpck_require__(7601);
42341
42528
  var processSecretsAsFiles_1 = __nccwpck_require__(5187);
42342
42529
  var createAppConfig = function (context, application) {
42343
- var _a, _b, _c;
42344
42530
  if (application === false) {
42345
42531
  return {
42346
42532
  enabled: false
42347
42533
  };
42348
42534
  }
42535
+ var _a = application !== null && application !== void 0 ? application : {},
42536
+ healthRoute = _a.healthRoute,
42537
+ command = _a.command,
42538
+ rest = __rest(_a, ["healthRoute", "command"]);
42349
42539
  return (0, utils_1.mergeWithMergingArrays)({
42350
42540
  host: context.environment.host,
42351
- command: context.componentConfig.build.startCommand,
42541
+ command: command !== null && command !== void 0 ? command : context.componentConfig.build.startCommand,
42352
42542
  livenessProbe: {
42353
42543
  httpGet: {
42354
- path: (_a = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _a !== void 0 ? _a : "__health"
42544
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
42355
42545
  }
42356
42546
  },
42357
42547
  readinessProbe: {
42358
42548
  httpGet: {
42359
- path: (_b = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _b !== void 0 ? _b : "__health"
42549
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
42360
42550
  }
42361
42551
  },
42362
42552
  startupProbe: {
42363
42553
  httpGet: {
42364
- path: (_c = application === null || application === void 0 ? void 0 : application.healthRoute) !== null && _c !== void 0 ? _c : "__health"
42554
+ path: healthRoute !== null && healthRoute !== void 0 ? healthRoute : "__health"
42365
42555
  }
42366
42556
  }
42367
42557
  },
42368
42558
  // default
42369
- application // merge rest in
42559
+ rest // merge rest in
42370
42560
  );
42371
42561
  };
42372
42562
 
@@ -42401,7 +42591,7 @@ var createKubeValues = function (context) {
42401
42591
  var defaultKubeValues = (0, lodash_1.merge)({
42402
42592
  env: env,
42403
42593
  application: createAppConfig(context, application)
42404
- }, (0, cloudSql_1.hasKubernetesCloudSQL)(context) ? (0, cloudSql_1.createCloudsqlBaseConfig)(context) : {}, ((_b = (_a = deployConfig.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled) ? (0, mongodb_1.createMongodbBaseConfig)(context) : {});
42594
+ }, (0, cloudSql_1.hasKubernetesCloudSQL)(context) ? (0, cloudSql_1.createKubernetesCloudsqlBaseValues)(context) : {}, ((_b = (_a = deployConfig.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled) ? (0, mongodb_1.createMongodbBaseConfig)(context) : {});
42405
42595
  var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, __assign({
42406
42596
  jobs: removeFalsy(jobs),
42407
42597
  cronjobs: removeFalsy(cronjobs)
@@ -43548,6 +43738,7 @@ exports.__esModule = true;
43548
43738
  exports.createJobsForComponent = void 0;
43549
43739
  var lodash_1 = __nccwpck_require__(3255);
43550
43740
  var build_1 = __nccwpck_require__(3760);
43741
+ var reporting_1 = __nccwpck_require__(3545);
43551
43742
  var context_1 = __nccwpck_require__(2041);
43552
43743
  var deploy_1 = __nccwpck_require__(223);
43553
43744
  var getCommitInfo_1 = __nccwpck_require__(5923);
@@ -43570,13 +43761,11 @@ var getCustomJobs = function (context) {
43570
43761
  return injectDefaultVarsInCustomJobs(context, rawJobs);
43571
43762
  };
43572
43763
  var createRawJobs = function (context) {
43573
- if (context.componentConfig.deploy === false) {
43574
- return [];
43575
- }
43576
43764
  var buildJobs = build_1.BUILD_TYPES[context.componentConfig.build.type].jobs(context);
43577
- var deployJobs = deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context);
43765
+ var deployJobs = context.componentConfig.deploy !== false ? deploy_1.DEPLOY_TYPES[context.componentConfig.deploy.type].jobs(context) : [];
43766
+ var reportingJobs = (0, reporting_1.createReportingJobs)(context);
43578
43767
  var customJobs = getCustomJobs(context);
43579
- return __spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(customJobs), false);
43768
+ return __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(buildJobs), false), __read(deployJobs), false), __read(reportingJobs), false), __read(customJobs), false);
43580
43769
  };
43581
43770
  var createJobsForComponent = function (config, componentName, env, trigger) {
43582
43771
  return __awaiter(void 0, void 0, void 0, function () {
@@ -43779,6 +43968,13 @@ exports.__esModule = true;
43779
43968
  exports.createGitlabJobs = exports.makeGitlabJob = void 0;
43780
43969
  var lodash_1 = __nccwpck_require__(3255);
43781
43970
  var defaults_1 = __nccwpck_require__(7383);
43971
+ var removeUndefined = function (obj) {
43972
+ return Object.fromEntries(Object.entries(obj).filter(function (_a) {
43973
+ var _b = __read(_a, 2),
43974
+ value = _b[1];
43975
+ return value !== undefined;
43976
+ }));
43977
+ };
43782
43978
  var getFullJobName = function (name, componentName, env) {
43783
43979
  if (env) {
43784
43980
  return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
@@ -43836,7 +44032,7 @@ var makeGitlabJob = function (componentName, env, _a, allJobs) {
43836
44032
  return getJobName(a).localeCompare(getJobName(b));
43837
44033
  });
43838
44034
  var fullJobName = getFullJobName(name, componentName, envMode !== "none" ? env : undefined);
43839
- var gitlabJob = __assign(__assign({}, job), {
44035
+ var gitlabJob = removeUndefined(__assign(__assign({}, job), {
43840
44036
  stage: stage,
43841
44037
  environment: ((_b = job.environment) === null || _b === void 0 ? void 0 : _b.on_stop) ? __assign(__assign({}, job.environment), {
43842
44038
  on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allJobs)
@@ -43845,7 +44041,7 @@ var makeGitlabJob = function (componentName, env, _a, allJobs) {
43845
44041
  needs: gitlabNeeds,
43846
44042
  retry: defaults_1.BASE_RETRY,
43847
44043
  interruptible: true
43848
- });
44044
+ }));
43849
44045
  return [fullJobName, gitlabJob];
43850
44046
  };
43851
44047
  exports.makeGitlabJob = makeGitlabJob;
@@ -44059,7 +44255,7 @@ var path_equal_1 = __nccwpck_require__(4843);
44059
44255
  var yarnUtils_1 = __nccwpck_require__(1369);
44060
44256
  var getPackageManagerInfo = function (config, componentName) {
44061
44257
  return __awaiter(void 0, void 0, void 0, function () {
44062
- var version, isClassic, component, workspaces, currentWorkspace, componentIsInWorkspace, workspaceRoot, packageJson, workspacePackageJson, lockFile, configFiles, rcFiles, workspaceDependencies, pathsToCopyInDocker;
44258
+ var version, isClassic, component, workspaces, currentWorkspace, componentIsInWorkspace, workspaceRoot, packageJson, workspacePackageJson, lockFile, configFiles, configFilePaths, workspaceDependencies, pathsToCopyInDocker;
44063
44259
  return __generator(this, function (_a) {
44064
44260
  switch (_a.label) {
44065
44261
  case 0:
@@ -44081,9 +44277,9 @@ var getPackageManagerInfo = function (config, componentName) {
44081
44277
  workspacePackageJson = componentIsInWorkspace ? (0, path_1.join)(workspaceRoot, "package.json") : null;
44082
44278
  lockFile = componentIsInWorkspace ? (0, path_1.join)(workspaceRoot, "yarn.lock") : (0, path_1.join)(component.dir, "yarn.lock");
44083
44279
  configFiles = [".yarnrc", ".yarnrc.yml", ".npmrc", ".yarn"];
44084
- rcFiles = (componentIsInWorkspace ? configFiles : configFiles.map(function (f) {
44280
+ configFilePaths = __spreadArray(__spreadArray([], __read(configFiles), false), __read(configFiles.map(function (f) {
44085
44281
  return (0, path_1.join)(component.dir, f);
44086
- })).filter(function (f) {
44282
+ })), false).filter(function (f) {
44087
44283
  return (0, fs_1.existsSync)(f);
44088
44284
  });
44089
44285
  workspaceDependencies = currentWorkspace ? __spreadArray(__spreadArray([], __read(currentWorkspace.workspaceDependencies), false), __read(currentWorkspace.mismatchedWorkspaceDependencies), false).map(function (name) {
@@ -44092,7 +44288,7 @@ var getPackageManagerInfo = function (config, componentName) {
44092
44288
  return w.name === name;
44093
44289
  })) === null || _a === void 0 ? void 0 : _a.location;
44094
44290
  }).filter(Boolean) : [];
44095
- pathsToCopyInDocker = __spreadArray(__spreadArray(__spreadArray(__spreadArray([packageJson], __read(workspacePackageJson ? [workspacePackageJson] : []), false), [lockFile], false), __read(rcFiles), false), __read(workspaceDependencies), false);
44291
+ pathsToCopyInDocker = __spreadArray(__spreadArray(__spreadArray(__spreadArray([packageJson], __read(workspacePackageJson ? [workspacePackageJson] : []), false), [lockFile], false), __read(configFilePaths), false), __read(workspaceDependencies), false);
44096
44292
  return [2 /*return*/, {
44097
44293
  type: "yarn",
44098
44294
  workspaces: workspaces,
@@ -44317,7 +44513,7 @@ exports.getWorkspaces = (0, memoizee_1["default"])(function (isClassic) {
44317
44513
 
44318
44514
 
44319
44515
  exports.__esModule = true;
44320
- exports.RULES_RELEASE = exports.RULE_CONDITION_MAIN_BRANCH = exports.RULES_ALWAYS = exports.RULE_NEVER_ON_RELEASE_COMMIT = void 0;
44516
+ exports.RULES_RELEASE = exports.RULE_CONDITION_HOTFIX_BRANCH = exports.RULE_CONDITION_MAIN_BRANCH = exports.RULES_ALWAYS = exports.RULE_NEVER_ON_RELEASE_COMMIT = void 0;
44321
44517
  exports.RULE_NEVER_ON_RELEASE_COMMIT = {
44322
44518
  "if": "$CI_COMMIT_MESSAGE =~ /^chore\\(release\\).*/",
44323
44519
  when: "never"
@@ -44332,6 +44528,7 @@ exports.RULES_ALWAYS = [{
44332
44528
  "if": "$CI_MERGE_REQUEST_ID"
44333
44529
  }];
44334
44530
  exports.RULE_CONDITION_MAIN_BRANCH = "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH";
44531
+ exports.RULE_CONDITION_HOTFIX_BRANCH = "$CI_COMMIT_BRANCH =~ /^[0-9]+.([0-9]+|x).x$/";
44335
44532
  exports.RULES_RELEASE = [exports.RULE_NEVER_ON_RELEASE_COMMIT, {
44336
44533
  "if": exports.RULE_CONDITION_MAIN_BRANCH + ' && $AUTO_RELEASE == "true"',
44337
44534
  when: "on_success"
@@ -44339,7 +44536,7 @@ exports.RULES_RELEASE = [exports.RULE_NEVER_ON_RELEASE_COMMIT, {
44339
44536
  "if": exports.RULE_CONDITION_MAIN_BRANCH,
44340
44537
  when: "manual"
44341
44538
  }, {
44342
- "if": "$CI_COMMIT_BRANCH =~ /^[0-9]+.([0-9]+|x).x$/",
44539
+ "if": exports.RULE_CONDITION_HOTFIX_BRANCH,
44343
44540
  when: "manual"
44344
44541
  }];
44345
44542
 
@@ -44558,7 +44755,7 @@ var sanitizeForBashVariable = function (name) {
44558
44755
  };
44559
44756
  exports.sanitizeForBashVariable = sanitizeForBashVariable;
44560
44757
  var repeatOnFailure = function (command, options) {
44561
- return "\n until ".concat(command, " &> /dev/null\n do\n echo \"Trying again.\"\n sleep ").concat(options.pauseInSeconds, "\n done\n ");
44758
+ return "\n until ".concat(command, "\n do\n echo \"Trying again.\"\n sleep ").concat(options.pauseInSeconds, "\n done\n ");
44562
44759
  };
44563
44760
  exports.repeatOnFailure = repeatOnFailure;
44564
44761
 
@@ -44622,6 +44819,61 @@ exports.mergeWithMergingArrays = mergeWithMergingArrays;
44622
44819
 
44623
44820
  /***/ }),
44624
44821
 
44822
+ /***/ 3545:
44823
+ /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => {
44824
+
44825
+ "use strict";
44826
+
44827
+
44828
+ exports.__esModule = true;
44829
+ exports.createReportingJobs = void 0;
44830
+ var base_1 = __nccwpck_require__(9177);
44831
+ var utils_1 = __nccwpck_require__(7461);
44832
+ var STAGE = "verify";
44833
+ var SBOM_GENERATE_JOB_NAME = "🧾 sbom";
44834
+ var SBOM_FILE = "__sbom.json";
44835
+ var createSbomGenerateJob = function (context) {
44836
+ var _a, _b, _c, _d, _e;
44837
+ var buildConfig = context.componentConfig.build;
44838
+ var defaultImage = "aquasec/trivy:0.38.3";
44839
+ var defaultScript = ["trivy fs --quiet --format cyclonedx --output \"".concat(SBOM_FILE, "\" ").concat(((_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace) ? "." : context.componentConfig.dir)];
44840
+ var image = buildConfig.type === "custom" && buildConfig.sbom !== false ? (_c = (_b = buildConfig.sbom) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage : defaultImage;
44841
+ var script = buildConfig.type === "custom" && buildConfig.sbom !== false ? (_e = (0, utils_1.ensureArray)((_d = buildConfig.sbom) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : defaultScript : defaultScript;
44842
+ return {
44843
+ name: SBOM_GENERATE_JOB_NAME,
44844
+ stage: STAGE,
44845
+ needs: context.componentConfig.deploy !== false ? [base_1.DEPLOY_JOB_NAME] : [],
44846
+ envMode: "jobPerEnv",
44847
+ variables: {},
44848
+ cache: undefined,
44849
+ image: image,
44850
+ script: script,
44851
+ allow_failure: true,
44852
+ artifacts: {
44853
+ paths: [SBOM_FILE]
44854
+ }
44855
+ };
44856
+ };
44857
+ var createSbomUploadJob = function (context) {
44858
+ return {
44859
+ name: "🧾 sbom upload",
44860
+ stage: STAGE,
44861
+ needs: [SBOM_GENERATE_JOB_NAME],
44862
+ envMode: "jobPerEnv",
44863
+ variables: {},
44864
+ cache: undefined,
44865
+ image: "git.panter.ch:5001/open-source/dependency-track-uploader:dtrackuploader-v0.2.1",
44866
+ script: ["/dtrackuploader https://dep.panter.dev/ \"$DT_KEY\" upload \"".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName, "/").concat(context.componentName, "\" \"").concat(context.environment.shortName, "\" \"").concat(SBOM_FILE, "\" vex.json")],
44867
+ allow_failure: true
44868
+ };
44869
+ };
44870
+ var createReportingJobs = function (context) {
44871
+ return context.componentConfig.build.type === "custom" && context.componentConfig.build.sbom === false ? [] : [createSbomGenerateJob(context), createSbomUploadJob(context)];
44872
+ };
44873
+ exports.createReportingJobs = createReportingJobs;
44874
+
44875
+ /***/ }),
44876
+
44625
44877
  /***/ 9904:
44626
44878
  /***/ ((module) => {
44627
44879