@catladder/cli 0.0.0-refactor-image-ca767657 → 0.0.0-refactor-gcloud-auth-no-file-b43bf0d9

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.
@@ -39131,7 +39131,6 @@ exports.RUNNER_BUILD_RESOURCE_VARIABLES = exports.APP_BUILD_JOB_NAME = void 0;
39131
39131
  exports.APP_BUILD_JOB_NAME = "🔨 app";
39132
39132
  exports.RUNNER_BUILD_RESOURCE_VARIABLES = {
39133
39133
  KUBERNETES_CPU_REQUEST: "0.5",
39134
- KUBERNETES_CPU_LIMIT: "2",
39135
39134
  KUBERNETES_MEMORY_REQUEST: "1Gi",
39136
39135
  KUBERNETES_MEMORY_LIMIT: "4Gi"
39137
39136
  };
@@ -39487,7 +39486,6 @@ var types_1 = __nccwpck_require__(1197);
39487
39486
  var base_1 = __nccwpck_require__(8035);
39488
39487
  var RUNNER_BUILD_VARIABLES = {
39489
39488
  KUBERNETES_CPU_REQUEST: "0.5",
39490
- KUBERNETES_CPU_LIMIT: "2",
39491
39489
  KUBERNETES_MEMORY_REQUEST: "2Gi",
39492
39490
  KUBERNETES_MEMORY_LIMIT: "4Gi"
39493
39491
  };
@@ -39512,7 +39510,7 @@ var createCustomBuildJobs = function (context) {
39512
39510
  }
39513
39511
  } : undefined,
39514
39512
  dockerBuild: {
39515
- script: (0, docker_1.getDockerBuildDefaultScript)(((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
39513
+ script: (0, docker_1.getDockerBuildDefaultScript)(context, ((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
39516
39514
  variables: {}
39517
39515
  }
39518
39516
  });
@@ -39623,7 +39621,6 @@ var types_1 = __nccwpck_require__(1197);
39623
39621
  var createArtifactsConfig_1 = __nccwpck_require__(5669);
39624
39622
  var RUNNER_CUSTOM_TEST_VARIABLES = {
39625
39623
  KUBERNETES_CPU_REQUEST: "0.5",
39626
- KUBERNETES_CPU_LIMIT: "2",
39627
39624
  KUBERNETES_MEMORY_REQUEST: "2Gi",
39628
39625
  KUBERNETES_MEMORY_LIMIT: "4Gi"
39629
39626
  };
@@ -39697,26 +39694,73 @@ var __rest = this && this.__rest || function (s, e) {
39697
39694
  }
39698
39695
  return t;
39699
39696
  };
39697
+ var __read = this && this.__read || function (o, n) {
39698
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
39699
+ if (!m) return o;
39700
+ var i = m.call(o),
39701
+ r,
39702
+ ar = [],
39703
+ e;
39704
+ try {
39705
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
39706
+ } catch (error) {
39707
+ e = {
39708
+ error: error
39709
+ };
39710
+ } finally {
39711
+ try {
39712
+ if (r && !r.done && (m = i["return"])) m.call(i);
39713
+ } finally {
39714
+ if (e) throw e.error;
39715
+ }
39716
+ }
39717
+ return ar;
39718
+ };
39719
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
39720
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
39721
+ if (ar || !(i in from)) {
39722
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
39723
+ ar[i] = from[i];
39724
+ }
39725
+ }
39726
+ return to.concat(ar || Array.prototype.slice.call(from));
39727
+ };
39728
+ var __importDefault = this && this.__importDefault || function (mod) {
39729
+ return mod && mod.__esModule ? mod : {
39730
+ "default": mod
39731
+ };
39732
+ };
39700
39733
  exports.__esModule = true;
39701
- exports.getDockerBuildDefaultScript = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
39734
+ exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
39702
39735
  var lodash_1 = __nccwpck_require__(3255);
39703
39736
  var deploy_1 = __nccwpck_require__(223);
39704
39737
  var runner_1 = __nccwpck_require__(5071);
39738
+ var fs_1 = __nccwpck_require__(7147);
39739
+ var path_1 = __importDefault(__nccwpck_require__(1017));
39740
+ var gitlab_1 = __nccwpck_require__(4997);
39741
+ var artifactsRegistry_1 = __nccwpck_require__(8159);
39742
+ var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(2607);
39705
39743
  var DOCKER_RUNNER_BUILD_VARIABLES = {
39706
39744
  KUBERNETES_CPU_REQUEST: "0.5",
39707
- KUBERNETES_CPU_LIMIT: "1",
39708
39745
  KUBERNETES_MEMORY_REQUEST: "1Gi",
39709
39746
  KUBERNETES_MEMORY_LIMIT: "2Gi"
39710
39747
  };
39711
39748
  var getDockerImageVariables = function (context) {
39712
- return {
39749
+ return __assign(__assign({}, (0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ? {
39750
+ DOCKER_REGISTRY: (0, artifactsRegistry_1.getArtifactsRegistryHost)(context),
39751
+ DOCKER_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryImageName)(context),
39752
+ DOCKER_CACHE_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryBuildCacheImage)(context)
39753
+ } :
39754
+ // gitlab registry:
39755
+ {
39713
39756
  DOCKER_REGISTRY: "$CI_REGISTRY",
39714
- DOCKER_REGISTRY_IMAGE_PATH: "$CI_REGISTRY_IMAGE",
39715
- DOCKER_CACHE_IMAGE: "$DOCKER_REGISTRY_IMAGE_PATH/caches/" + context.componentName,
39757
+ DOCKER_CACHE_IMAGE: "$CI_REGISTRY_IMAGE/caches/" + context.componentName,
39758
+ // ONLY USED IN KUBERNETES
39716
39759
  DOCKER_IMAGE_NAME: context.environment.shortName + "/" + context.componentName,
39717
- DOCKER_IMAGE: "$DOCKER_REGISTRY_IMAGE_PATH/$DOCKER_IMAGE_NAME",
39760
+ DOCKER_IMAGE: "$CI_REGISTRY_IMAGE/$DOCKER_IMAGE_NAME"
39761
+ }), {
39718
39762
  DOCKER_IMAGE_TAG: "$CI_COMMIT_SHA"
39719
- };
39763
+ });
39720
39764
  };
39721
39765
  exports.getDockerImageVariables = getDockerImageVariables;
39722
39766
  /**
@@ -39750,7 +39794,7 @@ var getDockerJobBaseProps = function (context) {
39750
39794
  return {
39751
39795
  image: (0, runner_1.getRunnerImage)("docker-build"),
39752
39796
  services: [{
39753
- name: "docker:20-dind",
39797
+ name: "docker:24.0.6-dind",
39754
39798
  command: ["--tls=false"]
39755
39799
  }],
39756
39800
  variables: getDockerBaseVariables()
@@ -39771,11 +39815,19 @@ var createDockerBuildJobBase = function (context, _a) {
39771
39815
  }, def);
39772
39816
  };
39773
39817
  exports.createDockerBuildJobBase = createDockerBuildJobBase;
39774
- exports.gitlabDockerLogin = "docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY";
39775
- var getDockerBuildDefaultScript = function (ensureDockerFileScript) {
39776
- return [ensureDockerFileScript, exports.gitlabDockerLogin, "docker version", "docker build --network host --cache-from $DOCKER_CACHE_IMAGE --tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1", "docker push $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_CACHE_IMAGE", "docker push $DOCKER_CACHE_IMAGE"].filter(Boolean);
39818
+ var gitlabDockerLogin = function (context) {
39819
+ return (0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ? __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), ["gcloud auth configure-docker ".concat((0, artifactsRegistry_1.getArtifactsRegistryHost)(context))], false) : ["docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY"];
39820
+ };
39821
+ exports.gitlabDockerLogin = gitlabDockerLogin;
39822
+ var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
39823
+ return __spreadArray(__spreadArray(__spreadArray([ensureDockerFileScript], __read((0, gitlab_1.collapseableSection)("docker-login", "Docker Login")((0, exports.gitlabDockerLogin)(context))), false), __read((0, gitlab_1.collapseableSection)("docker-build", "Docker build")(["docker build --network host --cache-from $DOCKER_CACHE_IMAGE --tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1" //BUILDKIT_INLINE_CACHE, see https://testdriven.io/blog/faster-ci-builds-with-docker-cache/
39824
+ ])), false), __read((0, gitlab_1.collapseableSection)("docker-push", "Docker push and tag")(["docker push $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_CACHE_IMAGE", "docker push $DOCKER_CACHE_IMAGE"])), false).filter(Boolean);
39777
39825
  };
39778
39826
  exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
39827
+ var hasDockerfile = function (context) {
39828
+ return (0, fs_1.existsSync)(path_1["default"].join(context.componentConfig.dir, "Dockerfile"));
39829
+ };
39830
+ exports.hasDockerfile = hasDockerfile;
39779
39831
 
39780
39832
  /***/ }),
39781
39833
 
@@ -39853,8 +39905,8 @@ exports.BUILD_TYPES = {
39853
39905
  return {
39854
39906
  startCommand: "/cnb/process/web",
39855
39907
  cnbBuilder: {
39856
- image: "heroku/buildpacks:20",
39857
- packVersion: "0.28.0"
39908
+ image: "heroku/builder:22",
39909
+ packVersion: "0.32.1"
39858
39910
  }
39859
39911
  };
39860
39912
  }
@@ -39936,15 +39988,19 @@ var createNodeBuildJobs = function (context) {
39936
39988
  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),
39937
39989
  script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : []), false),
39938
39990
  artifacts: {
39939
- paths: __spreadArray([(0, path_1.join)(context.componentConfig.dir, "__build_info.json"), (0, path_1.join)(context.componentConfig.dir, "dist"), (0, path_1.join)(context.componentConfig.dir, ".next")], __read((_e = (_d = buildConfig.artifactsPaths) === null || _d === void 0 ? void 0 : _d.map(function (path) {
39940
- return (0, path_1.join)(context.componentConfig.dir, path);
39941
- })) !== null && _e !== void 0 ? _e : []), false),
39942
- expire_in: "1 day"
39991
+ paths: __spreadArray([context.componentConfig.dir], __read((_e = (_d = context.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.currentWorkspaceDependencies) !== null && _e !== void 0 ? _e : []), false).flatMap(function (dir) {
39992
+ var _a, _b;
39993
+ return __spreadArray([(0, path_1.join)(dir, "__build_info.json"), (0, path_1.join)(dir, "dist"), (0, path_1.join)(dir, ".next")], __read((_b = (_a = buildConfig.artifactsPaths) === null || _a === void 0 ? void 0 : _a.map(function (path) {
39994
+ return (0, path_1.join)(dir, path);
39995
+ })) !== null && _b !== void 0 ? _b : []), false);
39996
+ }),
39997
+ expire_in: "1 day",
39998
+ when: "always"
39943
39999
  },
39944
40000
  jobTags: buildConfig.jobTags
39945
40001
  } : undefined,
39946
40002
  dockerBuild: {
39947
- script: (0, docker_1.getDockerBuildDefaultScript)(buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "ensureNginxDockerfile" : "ensureNodeDockerfile"),
40003
+ script: (0, docker_1.getDockerBuildDefaultScript)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "ensureNginxDockerfile" : "ensureNodeDockerfile"),
39948
40004
  cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
39949
40005
  variables: {
39950
40006
  // only required for non static
@@ -40006,6 +40062,7 @@ exports.__esModule = true;
40006
40062
  exports.getNextCache = exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void 0;
40007
40063
  var path_1 = __nccwpck_require__(1017);
40008
40064
  var slugify_1 = __importDefault(__nccwpck_require__(4035));
40065
+ var lodash_1 = __nccwpck_require__(3255);
40009
40066
  var getYarnCache = function (context, policy) {
40010
40067
  var _a;
40011
40068
  if (policy === void 0) {
@@ -40035,9 +40092,9 @@ var getNodeModulesCache = function (context, policy) {
40035
40092
  // if component is in a shared workspace, use workspace cache. use individual cache else
40036
40093
  key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1["default"])(context.componentConfig.dir) + "-node-modules",
40037
40094
  policy: policy,
40038
- paths: __spreadArray([], __read(componentIsInWorkspace ? __spreadArray(["node_modules"], __read((_c = (_b = context.packageManagerInfo) === null || _b === void 0 ? void 0 : _b.workspaces.map(function (w) {
40095
+ paths: __spreadArray([], __read(componentIsInWorkspace ? (0, lodash_1.uniq)(__spreadArray(["node_modules"], __read((_c = (_b = context.packageManagerInfo) === null || _b === void 0 ? void 0 : _b.workspaces.map(function (w) {
40039
40096
  return (0, path_1.join)(w.location, "node_modules");
40040
- })) !== null && _c !== void 0 ? _c : []), false) : [(0, path_1.join)(context.componentConfig.dir, "node_modules")]), false)
40097
+ })) !== null && _c !== void 0 ? _c : []), false)) : [(0, path_1.join)(context.componentConfig.dir, "node_modules")]), false)
40041
40098
  }];
40042
40099
  };
40043
40100
  exports.getNodeModulesCache = getNodeModulesCache;
@@ -40069,7 +40126,6 @@ exports.__esModule = true;
40069
40126
  exports.NODE_RUNNER_BUILD_VARIABLES = void 0;
40070
40127
  exports.NODE_RUNNER_BUILD_VARIABLES = {
40071
40128
  KUBERNETES_CPU_REQUEST: "0.5",
40072
- KUBERNETES_CPU_LIMIT: "2",
40073
40129
  KUBERNETES_MEMORY_REQUEST: "2Gi",
40074
40130
  KUBERNETES_MEMORY_LIMIT: "4Gi"
40075
40131
  };
@@ -40205,7 +40261,7 @@ var createMeteorBuildJobs = function (context) {
40205
40261
  }
40206
40262
  } : undefined,
40207
40263
  dockerBuild: {
40208
- script: (0, docker_1.getDockerBuildDefaultScript)("ensureMeteorDockerfile"),
40264
+ script: (0, docker_1.getDockerBuildDefaultScript)(context, "ensureMeteorDockerfile"),
40209
40265
  variables: {
40210
40266
  METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? "true" : ""
40211
40267
  }
@@ -40302,14 +40358,14 @@ var createNodeTestJobs = function (context) {
40302
40358
  }, base), {
40303
40359
  image: (_l = (_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.jobImage) !== null && _l !== void 0 ? _l : defaultImage,
40304
40360
  cache: (0, cache_1.getNodeCache)(context),
40305
- script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(yarnInstall), false), __read((_o = (0, utils_1.ensureArray)((_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.command)) !== null && _o !== void 0 ? _o : ["yarn lint"]), false)
40361
+ script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read(yarnInstall), false), __read((_o = (0, utils_1.ensureArray)((_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.command)) !== null && _o !== void 0 ? _o : ["yarn lint"]), false)
40306
40362
  }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.artifactsReports, (_q = buildConfig.lint) === null || _q === void 0 ? void 0 : _q.artifacts)) : null;
40307
40363
  var testJob = buildConfig.test !== false ? __assign(__assign(__assign({
40308
40364
  name: "🧪 test"
40309
40365
  }, base), {
40310
40366
  image: (_s = (_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.jobImage) !== null && _s !== void 0 ? _s : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
40311
40367
  cache: (0, cache_1.getNodeCache)(context),
40312
- script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(yarnInstall), false), __read((_u = (0, utils_1.ensureArray)((_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.command)) !== null && _u !== void 0 ? _u : ["yarn test"]), false)
40368
+ script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read(yarnInstall), false), __read((_u = (0, utils_1.ensureArray)((_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.command)) !== null && _u !== void 0 ? _u : ["yarn test"]), false)
40313
40369
  }), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.artifactsReports, (_w = buildConfig.test) === null || _w === void 0 ? void 0 : _w.artifacts)) : null;
40314
40370
  return [auditJob, lintJob, testJob].filter(utils_1.notNil);
40315
40371
  };
@@ -40357,6 +40413,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
40357
40413
  exports.__esModule = true;
40358
40414
  exports.getDockerAppCopyAndBuildScript = exports.getYarnInstall = exports.ensureNodeVersion = void 0;
40359
40415
  var utils_1 = __nccwpck_require__(7461);
40416
+ var gitlab_1 = __nccwpck_require__(4997);
40360
40417
  var YARN_INSTALL_CLASSIC = "yarn install --frozen-lockfile";
40361
40418
  // FIXME: check why and when rebuild is needed
40362
40419
  var YARN_BERRY_PROD_REBUILD = "yarn workspaces focus --production && yarn rebuild";
@@ -40368,13 +40425,13 @@ var getYarnInstallCommand = function (context) {
40368
40425
  return "yarn install --immutable";
40369
40426
  };
40370
40427
  var ensureNodeVersion = function (context) {
40371
- return ["if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi", "if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi"];
40428
+ return (0, gitlab_1.collapseableSection)("nodeinstall", "Ensure node version")(["if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi", "if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi"]);
40372
40429
  };
40373
40430
  exports.ensureNodeVersion = ensureNodeVersion;
40374
40431
  var getYarnInstall = function (context, options) {
40375
40432
  var _a;
40376
40433
  var postInstall = "postInstall" in context.componentConfig.build ? context.componentConfig.build.postInstall : null;
40377
- return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), [getYarnInstallCommand(context)], false), __read(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall) ? (_a = (0, utils_1.ensureArray)(postInstall)) !== null && _a !== void 0 ? _a : [] : []), false);
40434
+ 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) ? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((_a = (0, utils_1.ensureArray)(postInstall)) !== null && _a !== void 0 ? _a : []) : []), false);
40378
40435
  };
40379
40436
  exports.getYarnInstall = getYarnInstall;
40380
40437
  var DOCKER_COPY_FILES = "COPY --chown=node:node $APP_DIR .";
@@ -40436,6 +40493,15 @@ var __read = this && this.__read || function (o, n) {
40436
40493
  }
40437
40494
  return ar;
40438
40495
  };
40496
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
40497
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
40498
+ if (ar || !(i in from)) {
40499
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
40500
+ ar[i] = from[i];
40501
+ }
40502
+ }
40503
+ return to.concat(ar || Array.prototype.slice.call(from));
40504
+ };
40439
40505
  exports.__esModule = true;
40440
40506
  exports.createRailsBuildJobs = void 0;
40441
40507
  var base_1 = __nccwpck_require__(8035);
@@ -40448,6 +40514,15 @@ var createRailsBuildJobs = function (context) {
40448
40514
  // should not happen
40449
40515
  throw new Error("build type is not rails");
40450
40516
  }
40517
+ if ((0, docker_1.hasDockerfile)(context)) {
40518
+ return (0, base_1.createBuildJobs)(context, {
40519
+ appBuild: undefined,
40520
+ dockerBuild: {
40521
+ script: (0, docker_1.getDockerBuildDefaultScript)(context),
40522
+ variables: {}
40523
+ }
40524
+ });
40525
+ }
40451
40526
  var cnbConf = buildConfig.cnbBuilder;
40452
40527
  var packEnvArgs = Object.entries((_a = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.buildVars) !== null && _a !== void 0 ? _a : {}).map(function (_a) {
40453
40528
  var _b = __read(_a, 2),
@@ -40460,9 +40535,9 @@ var createRailsBuildJobs = function (context) {
40460
40535
  dockerBuild: {
40461
40536
  variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.componentConfig.build.extraVars),
40462
40537
  // custom script
40463
- 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",
40538
+ script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), ["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",
40464
40539
  // replace private git ssh gem sources with https to make bundler with credentials via env var work
40465
- "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 : "")]
40540
+ "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 : "")], false)
40466
40541
  }
40467
40542
  });
40468
40543
  };
@@ -40845,7 +40920,7 @@ exports.readConfigSync = readConfigSync;
40845
40920
 
40846
40921
  exports.__esModule = true;
40847
40922
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
40848
- exports.PIPELINE_IMAGE_TAG = "refactor-image-ca767657" || 0;
40923
+ exports.PIPELINE_IMAGE_TAG = "refactor-gcloud-auth-no-file-b43bf0d9" || 0;
40849
40924
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
40850
40925
 
40851
40926
  /***/ }),
@@ -41276,7 +41351,7 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
41276
41351
  alreadyVisited = {};
41277
41352
  }
41278
41353
  return __awaiter(void 0, void 0, void 0, function () {
41279
- var environmentContext, envConfigRaw, deployConfigRaw, buildConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegacyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
41354
+ var environmentContext, envConfigRaw, deployConfigRaw, buildConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars, HOST_INTERNAL, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegacyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
41280
41355
  var _a, _b;
41281
41356
  var _c, _d, _e, _f, _g, _h, _j, _k, _l;
41282
41357
  return __generator(this, function (_m) {
@@ -41300,16 +41375,21 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
41300
41375
  predefinedVariables = {
41301
41376
  ENV_SHORT: "local",
41302
41377
  ROOT_URL: url,
41378
+ HOST_INTERNAL: host,
41379
+ ROOT_URL_INTERNAL: "http://" + host,
41303
41380
  PORT: port.toString()
41304
41381
  };
41305
41382
  } else {
41306
41383
  additionalEnvVars = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext) : {};
41307
- host = (_e = (_d = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _d !== void 0 ? _d : additionalEnvVars.HOST_CANONICAL) !== null && _e !== void 0 ? _e : "unknown-host.example.com";
41384
+ HOST_INTERNAL = (_d = additionalEnvVars.HOST_INTERNAL) !== null && _d !== void 0 ? _d : "unknown-host.example.com";
41385
+ host = (_e = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _e !== void 0 ? _e : HOST_INTERNAL;
41308
41386
  url = "https://".concat(host);
41309
41387
  predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), config.components[componentName].build.type === "rails" ? {} : {
41310
41388
  HOST: host
41311
41389
  }), {
41312
- ROOT_URL: url
41390
+ ROOT_URL: url,
41391
+ HOST_CANONICAL: HOST_INTERNAL,
41392
+ ROOT_URL_INTERNAL: "https://" + HOST_INTERNAL
41313
41393
  }), additionalEnvVars);
41314
41394
  }
41315
41395
  publicEnvVarsRaw = (_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.public) !== null && _g !== void 0 ? _g : {};
@@ -42160,7 +42240,7 @@ var createDeployJob = function (context, jobDefinition) {
42160
42240
  var _a, _b, _c, _d;
42161
42241
  var hasDocker = (0, docker_1.requiresDockerBuild)(context);
42162
42242
  var isStoppable = (0, utils_1.contextIsStoppable)(context);
42163
- var autoStop = context.environment.envType === "review" ? "2 week" : context.environment.envType === "dev" ? "4 weeks" : undefined;
42243
+ var autoStop = context.environment.envType === "review" ? "1 week" : context.environment.envType === "dev" ? "4 weeks" : undefined;
42164
42244
  // if auto or manual is configured explicitly, use that
42165
42245
  var whenDeployDefined = context.componentConfig.deploy && context.componentConfig.deploy.when ? context.componentConfig.deploy.when : undefined;
42166
42246
  // otherwise auto deploy if env is not prod. If its prod, deploy automatically if stage is disabled
@@ -42364,13 +42444,269 @@ exports.__esModule = true;
42364
42444
  exports.DEPLOY_RUNNER_VARIABLES = void 0;
42365
42445
  exports.DEPLOY_RUNNER_VARIABLES = {
42366
42446
  KUBERNETES_CPU_REQUEST: "0.5",
42367
- KUBERNETES_CPU_LIMIT: "1",
42368
42447
  KUBERNETES_MEMORY_REQUEST: "200Mi",
42369
42448
  KUBERNETES_MEMORY_LIMIT: "400Mi"
42370
42449
  };
42371
42450
 
42372
42451
  /***/ }),
42373
42452
 
42453
+ /***/ 8159:
42454
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
42455
+
42456
+ "use strict";
42457
+
42458
+
42459
+ var __read = this && this.__read || function (o, n) {
42460
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
42461
+ if (!m) return o;
42462
+ var i = m.call(o),
42463
+ r,
42464
+ ar = [],
42465
+ e;
42466
+ try {
42467
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
42468
+ } catch (error) {
42469
+ e = {
42470
+ error: error
42471
+ };
42472
+ } finally {
42473
+ try {
42474
+ if (r && !r.done && (m = i["return"])) m.call(i);
42475
+ } finally {
42476
+ if (e) throw e.error;
42477
+ }
42478
+ }
42479
+ return ar;
42480
+ };
42481
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
42482
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
42483
+ if (ar || !(i in from)) {
42484
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
42485
+ ar[i] = from[i];
42486
+ }
42487
+ }
42488
+ return to.concat(ar || Array.prototype.slice.call(from));
42489
+ };
42490
+ exports.__esModule = true;
42491
+ exports.getDeleteUnusedImagesCommands = exports.getArtifactsRegistryImage = exports.getArtifactsRegistryBuildCacheImage = exports.getArtifactsRegistryImageName = exports.getArtifactsRegistryDockerUrl = exports.getArtifactsRegistryHost = void 0;
42492
+ var gitlab_1 = __nccwpck_require__(4997);
42493
+ var types_1 = __nccwpck_require__(3109);
42494
+ var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(7547);
42495
+ var getArtifactsRegistryHost = function (_a) {
42496
+ var deploy = _a.componentConfig.deploy;
42497
+ if (!(0, types_1.isOfDeployType)(deploy, "google-cloudrun")) {
42498
+ // should not happen
42499
+ throw new Error("deploy config is wrong");
42500
+ }
42501
+ return "".concat(deploy.region, "-docker.pkg.dev");
42502
+ };
42503
+ exports.getArtifactsRegistryHost = getArtifactsRegistryHost;
42504
+ var getArtifactsRegistryDockerUrl = function (context) {
42505
+ var deployConfig = context.componentConfig.deploy;
42506
+ if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
42507
+ // should not happen
42508
+ throw new Error("deploy config is wrong");
42509
+ }
42510
+ var fullAppName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName);
42511
+ return "".concat((0, exports.getArtifactsRegistryHost)(context), "/").concat(deployConfig.projectId, "/catladder-deploy/").concat(fullAppName);
42512
+ };
42513
+ exports.getArtifactsRegistryDockerUrl = getArtifactsRegistryDockerUrl;
42514
+ /**
42515
+ *
42516
+ * lecacyReviewImageName is only temporary. In old versions the images had no reviewslug in review apps, which makes cleanup harder. We delete all those images now, but need the path
42517
+ */
42518
+ var getArtifactsRegistryImageName = function (context, lecacyReviewImageName) {
42519
+ var _a;
42520
+ if (lecacyReviewImageName === void 0) {
42521
+ lecacyReviewImageName = false;
42522
+ }
42523
+ if (lecacyReviewImageName && context.environment.envType !== "review") {
42524
+ throw new Error("lecacyReviewImageName is only allowed for review app");
42525
+ }
42526
+ var dockerUrl = (0, exports.getArtifactsRegistryDockerUrl)(context);
42527
+ var gcloudImagePath = __spreadArray([dockerUrl, context.environment.shortName, context.componentName], __read(context.environment.envType === "review" && !lecacyReviewImageName ? [(_a = context.commitInfo) === null || _a === void 0 ? void 0 : _a.reviewSlug] : []), false);
42528
+ return gcloudImagePath.join("/");
42529
+ };
42530
+ exports.getArtifactsRegistryImageName = getArtifactsRegistryImageName;
42531
+ var getArtifactsRegistryBuildCacheImage = function (context) {
42532
+ var dockerUrl = (0, exports.getArtifactsRegistryDockerUrl)(context);
42533
+ // does not include env, so that after merge, you might get more cache hits (review-->dev)
42534
+ var gcloudImagePath = [dockerUrl, "caches", context.componentName];
42535
+ return gcloudImagePath.join("/");
42536
+ };
42537
+ exports.getArtifactsRegistryBuildCacheImage = getArtifactsRegistryBuildCacheImage;
42538
+ var getArtifactsRegistryImage = function (context) {
42539
+ return "".concat((0, exports.getArtifactsRegistryImageName)(context), ":$DOCKER_IMAGE_TAG");
42540
+ };
42541
+ exports.getArtifactsRegistryImage = getArtifactsRegistryImage;
42542
+ var getDeleteImageCommands = function (fullImageName, keepNewest) {
42543
+ if (keepNewest === void 0) {
42544
+ keepNewest = 0;
42545
+ }
42546
+ if (keepNewest === 0) {
42547
+ // no need to list tags, we delete the whole thing
42548
+ return ["gcloud artifacts docker images delete ".concat(fullImageName, " --quiet --delete-tags")];
42549
+ }
42550
+ // delete unused tags
42551
+ var listAllImagesCommand = "gcloud artifacts docker images list ".concat(fullImageName, " --sort-by=~CREATE_TIME --format=\"value(version)\"");
42552
+ var listImagesToDeletecommand = (0, removeFirstLinesFromCommandOutput_1.removeFirstLinesFromCommandOutput)(listAllImagesCommand, keepNewest);
42553
+ var deleteImageCommand = "gcloud artifacts docker images delete ".concat(fullImageName, "@$version --quiet --delete-tags");
42554
+ var deleteImagesCommand = "".concat(listImagesToDeletecommand, " | while read -r version; do ").concat(deleteImageCommand, "; done");
42555
+ return [deleteImagesCommand];
42556
+ };
42557
+ /**
42558
+ * commands to delete unused images.
42559
+ *
42560
+ * @param context
42561
+ * @param keep how many of the newest images to keep
42562
+ * @returns
42563
+ */
42564
+ var getDeleteUnusedImagesCommands = function (context, keep) {
42565
+ if (keep === void 0) {
42566
+ keep = 0;
42567
+ }
42568
+ var deployConfig = context.componentConfig.deploy;
42569
+ if (deployConfig === false) {
42570
+ return [];
42571
+ }
42572
+ if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
42573
+ // should not happen
42574
+ throw new Error("deploy config is wrong");
42575
+ }
42576
+ var fullImageName = (0, exports.getArtifactsRegistryImageName)(context);
42577
+ var buildCacheImageName = (0, exports.getArtifactsRegistryBuildCacheImage)(context);
42578
+ return __spreadArray(__spreadArray(__spreadArray([], __read(getDeleteImageCommands(fullImageName, keep)), false), __read(getDeleteImageCommands(buildCacheImageName, 1)), false), __read(context.environment.envType === "review" ? (0, gitlab_1.allowFailureInScripts)(getDeleteImageCommands((0, exports.getArtifactsRegistryImageName)(context, true), 0)) : []), false);
42579
+ };
42580
+ exports.getDeleteUnusedImagesCommands = getDeleteUnusedImagesCommands;
42581
+
42582
+ /***/ }),
42583
+
42584
+ /***/ 964:
42585
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
42586
+
42587
+ "use strict";
42588
+
42589
+
42590
+ var __read = this && this.__read || function (o, n) {
42591
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
42592
+ if (!m) return o;
42593
+ var i = m.call(o),
42594
+ r,
42595
+ ar = [],
42596
+ e;
42597
+ try {
42598
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
42599
+ } catch (error) {
42600
+ e = {
42601
+ error: error
42602
+ };
42603
+ } finally {
42604
+ try {
42605
+ if (r && !r.done && (m = i["return"])) m.call(i);
42606
+ } finally {
42607
+ if (e) throw e.error;
42608
+ }
42609
+ }
42610
+ return ar;
42611
+ };
42612
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
42613
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
42614
+ if (ar || !(i in from)) {
42615
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
42616
+ ar[i] = from[i];
42617
+ }
42618
+ }
42619
+ return to.concat(ar || Array.prototype.slice.call(from));
42620
+ };
42621
+ exports.__esModule = true;
42622
+ exports.getRemoveOldRevisionsAndImagesCommand = void 0;
42623
+ var artifactsRegistry_1 = __nccwpck_require__(8159);
42624
+ var cloudRunRevisions_1 = __nccwpck_require__(1101);
42625
+ var getRemoveOldRevisionsAndImagesCommand = function (context, when) {
42626
+ if (when === "onStop") {
42627
+ // service is already deleted, so we don't need to delete old revisions, just delete all images
42628
+ return (0, artifactsRegistry_1.getDeleteUnusedImagesCommands)(context);
42629
+ }
42630
+ // this number only targets inactive revisions
42631
+ var revisionsToKeep = context.environment.envType === "prod" ? 5 : 0;
42632
+ // this number needs to be higher than inactive after deploy, so we add one
42633
+ var imagesToKeep = revisionsToKeep + 1;
42634
+ var deleteOldRevisionsCommands = (0, cloudRunRevisions_1.getDeleteUnusedRevisionsCommands)(context, revisionsToKeep);
42635
+ var deleteOldImagesCommands = (0, artifactsRegistry_1.getDeleteUnusedImagesCommands)(context, imagesToKeep);
42636
+ return __spreadArray(__spreadArray([], __read(deleteOldRevisionsCommands), false), __read(deleteOldImagesCommands), false);
42637
+ };
42638
+ exports.getRemoveOldRevisionsAndImagesCommand = getRemoveOldRevisionsAndImagesCommand;
42639
+
42640
+ /***/ }),
42641
+
42642
+ /***/ 1101:
42643
+ /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
42644
+
42645
+ "use strict";
42646
+
42647
+
42648
+ var __assign = this && this.__assign || function () {
42649
+ __assign = Object.assign || function (t) {
42650
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
42651
+ s = arguments[i];
42652
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
42653
+ }
42654
+ return t;
42655
+ };
42656
+ return __assign.apply(this, arguments);
42657
+ };
42658
+ exports.__esModule = true;
42659
+ exports.getDeleteUnusedRevisionsCommands = void 0;
42660
+ var types_1 = __nccwpck_require__(3109);
42661
+ var createArgsString_1 = __nccwpck_require__(8686);
42662
+ var getServiceName_1 = __nccwpck_require__(9391);
42663
+ var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(7547);
42664
+ var getListRevisionsCommand = function (context, args) {
42665
+ var serviceName = (0, getServiceName_1.getServiceName)(context);
42666
+ var deployConfig = context.componentConfig.deploy;
42667
+ if (!deployConfig || !(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
42668
+ // should not happen
42669
+ throw new Error("deploy config is wrong");
42670
+ }
42671
+ var filterRevisionArgs = __assign({
42672
+ project: deployConfig.projectId,
42673
+ region: deployConfig.region,
42674
+ // only show inactive revisions
42675
+ service: serviceName,
42676
+ limit: "unlimited",
42677
+ "sort-by": "metadata.creationTimestamp"
42678
+ }, args);
42679
+ // this prints out all inactive images of the given app
42680
+ return "gcloud run revisions list ".concat((0, createArgsString_1.createArgsString)(filterRevisionArgs));
42681
+ };
42682
+ var getDeleteUnusedRevisionsCommands = function (context, keep) {
42683
+ var deployConfig = context.componentConfig.deploy;
42684
+ if (deployConfig === false) {
42685
+ return [];
42686
+ }
42687
+ if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
42688
+ // should not happen
42689
+ throw new Error("deploy config is wrong");
42690
+ }
42691
+ // this prints out all inactive images of the given app
42692
+ var listAllInactiveRevisionsCmd = getListRevisionsCommand(context, {
42693
+ format: "\"value(name)\"",
42694
+ filter: "'(status.conditions.status=False OR status.conditions.status=Unknown)'"
42695
+ });
42696
+ // this removes the newest `revisionsToKeep` images
42697
+ var listRevisionsToDeleteCmd = (0, removeFirstLinesFromCommandOutput_1.removeFirstLinesFromCommandOutput)(listAllInactiveRevisionsCmd, keep);
42698
+ var deleteRevisionCmd = "gcloud run revisions delete ".concat((0, createArgsString_1.createArgsString)({
42699
+ project: deployConfig.projectId,
42700
+ region: deployConfig.region,
42701
+ quiet: true
42702
+ }), " $revisionname ");
42703
+ var deleteRevisionsCmd = "".concat(listRevisionsToDeleteCmd, " | while read -r revisionname; do ").concat(deleteRevisionCmd, "; done");
42704
+ return [deleteRevisionsCmd];
42705
+ };
42706
+ exports.getDeleteUnusedRevisionsCommands = getDeleteUnusedRevisionsCommands;
42707
+
42708
+ /***/ }),
42709
+
42374
42710
  /***/ 2256:
42375
42711
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
42376
42712
 
@@ -42434,9 +42770,20 @@ var createArgsString_1 = __nccwpck_require__(8686);
42434
42770
  var database_1 = __nccwpck_require__(1384);
42435
42771
  var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(2607);
42436
42772
  var jobName_1 = __nccwpck_require__(7311);
42437
- var setExtraVarsScripts = function (deployConfig) {
42773
+ var artifactsRegistry_1 = __nccwpck_require__(8159);
42774
+ var getServiceName_1 = __nccwpck_require__(9391);
42775
+ var cleanup_1 = __nccwpck_require__(964);
42776
+ var setGoogleProjectNumberScript = function (deployConfig) {
42438
42777
  return ["export GCLOUD_PROJECT_NUMBER=$(gcloud projects describe ".concat(deployConfig.projectId, " --format=\"value(projectNumber)\")"), "echo \"GCLOUD_PROJECT_NUMBER: $GCLOUD_PROJECT_NUMBER\""];
42439
42778
  };
42779
+ var makeLabelString = function (obj) {
42780
+ return Object.entries(obj).map(function (_a) {
42781
+ var _b = __read(_a, 2),
42782
+ key = _b[0],
42783
+ value = _b[1];
42784
+ return "".concat(key, "=").concat(value);
42785
+ }).join(",");
42786
+ };
42440
42787
  var createGoogleCloudRunDeployJobs = function (context) {
42441
42788
  var _a, _b, _c;
42442
42789
  var deployConfig = context.componentConfig.deploy;
@@ -42447,28 +42794,17 @@ var createGoogleCloudRunDeployJobs = function (context) {
42447
42794
  // should not happen
42448
42795
  throw new Error("deploy config is wrong");
42449
42796
  }
42450
- var fullAppName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName);
42451
- var dockerUrl = "".concat(deployConfig.region, "-docker.pkg.dev/").concat(deployConfig.projectId, "/catladder-deploy/").concat(fullAppName);
42452
- var gcloudImageName = "".concat(dockerUrl, "/").concat(context.environment.shortName, "/").concat(context.componentName, ":$DOCKER_IMAGE_TAG");
42453
- var pushImageToArtifactsRegistry = [docker_1.gitlabDockerLogin, "gcloud auth configure-docker ".concat(deployConfig.region, "-docker.pkg.dev"), "docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG ".concat(gcloudImageName), "docker push ".concat(gcloudImageName)];
42454
42797
  var allEnvVars = (0, lodash_1.omit)(context.environment.envVars, _1.GCLOUD_DEPLOY_CREDENTIALS_KEY);
42455
- var labelsString = Object.entries((0, getLabels_1.getLabels)(context)).map(function (_a) {
42456
- var _b = __read(_a, 2),
42457
- key = _b[0],
42458
- value = _b[1];
42459
- return "".concat(key, "=").concat(value);
42460
- }).join(",");
42461
42798
  var commonArgs = {
42462
42799
  project: deployConfig.projectId,
42463
42800
  region: deployConfig.region
42464
42801
  };
42465
42802
  var commonDeployArgs = __assign(__assign({
42466
- image: gcloudImageName
42803
+ image: (0, artifactsRegistry_1.getArtifactsRegistryImage)(context)
42467
42804
  }, commonArgs), {
42468
- "set-cloudsql-instances": deployConfig.cloudSql ? deployConfig.cloudSql.instanceConnectionName : undefined,
42469
- labels: labelsString
42805
+ "set-cloudsql-instances": deployConfig.cloudSql ? deployConfig.cloudSql.instanceConnectionName : undefined
42470
42806
  });
42471
- var serviceName = context.environment.fullName.toLowerCase();
42807
+ var serviceName = (0, getServiceName_1.getServiceName)(context);
42472
42808
  var getFullJobName = function (name) {
42473
42809
  return (0, jobName_1.getCloudRunJobName)(context.environment.fullName, name);
42474
42810
  };
@@ -42497,30 +42833,41 @@ var createGoogleCloudRunDeployJobs = function (context) {
42497
42833
  };
42498
42834
  });
42499
42835
  var getServiceDeployScript = function (service, nameSuffix) {
42500
- var _a, _b, _c, _d;
42836
+ var _a, _b, _c, _d, _e;
42501
42837
  var customConfig = service !== true ? service : undefined;
42502
42838
  var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand : undefined;
42839
+ var commandArray = command ? Array.isArray(command) ? command : command.split(" ") : undefined;
42840
+ var fullServiceName = "".concat(serviceName).concat(nameSuffix !== null && nameSuffix !== void 0 ? nameSuffix : "");
42503
42841
  var argsString = (0, createArgsString_1.createArgsString)(__assign(__assign({
42504
42842
  // command as empty string resets it to default (uses the image's entrypoint)
42505
- command: command ? '"' + command.split(" ").join(",") + '"' : '""'
42843
+ command: commandArray ? '"' + commandArray.join(",") + '"' : '""'
42506
42844
  }, commonDeployArgs), {
42845
+ labels: makeLabelString(__assign(__assign({}, (0, getLabels_1.getLabels)(context)), {
42846
+ "cloud-run-service-name": fullServiceName
42847
+ })),
42507
42848
  "env-vars-file": "____envvars.yaml",
42508
42849
  "min-instances": (_b = customConfig === null || customConfig === void 0 ? void 0 : customConfig.minInstances) !== null && _b !== void 0 ? _b : 0,
42509
42850
  "max-instances": (_c = customConfig === null || customConfig === void 0 ? void 0 : customConfig.maxInstances) !== null && _c !== void 0 ? _c : 100,
42510
42851
  "cpu-throttling": (customConfig === null || customConfig === void 0 ? void 0 : customConfig.noCpuThrottling) !== true,
42511
42852
  memory: customConfig === null || customConfig === void 0 ? void 0 : customConfig.memory,
42512
42853
  "allow-unauthenticated": (_d = customConfig === null || customConfig === void 0 ? void 0 : customConfig.allowUnauthenticated) !== null && _d !== void 0 ? _d : true,
42854
+ ingress: (_e = customConfig === null || customConfig === void 0 ? void 0 : customConfig.ingress) !== null && _e !== void 0 ? _e : "all",
42513
42855
  "cpu-boost": true
42514
42856
  }));
42515
- return "gcloud run deploy ".concat(serviceName).concat(nameSuffix !== null && nameSuffix !== void 0 ? nameSuffix : "", " ").concat(argsString);
42857
+ return "gcloud run deploy ".concat(fullServiceName, " ").concat(argsString);
42516
42858
  };
42517
42859
  var getJobCreateScriptsForJob = function (jobName, job) {
42518
42860
  // due to some oversight from google, jobs create does not accept `--env-vars-file` 🤦
42519
42861
  // lucky, update on the other hand accepts it... so let's just imediatly update it
42520
42862
  // also we cannot upsert a job, so we have to create it and catch the error and then update
42863
+ var commandArray = Array.isArray(job.command) ? job.command : job.command.split(" ");
42521
42864
  var commonDeployArgsString = (0, createArgsString_1.createArgsString)(__assign(__assign({
42522
- command: '"' + job.command.split(" ").join(",") + '"'
42865
+ command: '"' + commandArray.join(",") + '"'
42523
42866
  }, commonDeployArgs), {
42867
+ labels: makeLabelString(__assign(__assign({}, (0, getLabels_1.getLabels)(context)), {
42868
+ "cloud-run-job-name": jobName
42869
+ })),
42870
+ image: job.image || commonDeployArgs.image,
42524
42871
  memory: job.memory || "512Mi",
42525
42872
  "task-timeout": job.timeout || "10m"
42526
42873
  }));
@@ -42535,8 +42882,8 @@ var createGoogleCloudRunDeployJobs = function (context) {
42535
42882
  return getJobCreateScriptsForJob(jobName, job);
42536
42883
  }).flat();
42537
42884
  };
42538
- var getJobRunScriptForJob = function (jobName) {
42539
- return "gcloud beta run jobs execute ".concat(jobName, " ").concat(commonArgsString);
42885
+ var getJobRunScriptForJob = function (jobName, wait) {
42886
+ return "gcloud beta run jobs execute ".concat(jobName, " ").concat(commonArgsString).concat(wait ? " --wait" : "");
42540
42887
  };
42541
42888
  var getJobRunScripts = function (when) {
42542
42889
  return jobsWithNames.filter(function (_a) {
@@ -42544,7 +42891,9 @@ var createGoogleCloudRunDeployJobs = function (context) {
42544
42891
  return job.when === when;
42545
42892
  }).map(function (_a) {
42546
42893
  var jobName = _a.jobName;
42547
- return getJobRunScriptForJob(jobName);
42894
+ return getJobRunScriptForJob(jobName,
42895
+ // wait for completin on stop jobs, since stop will delete the jobs afterwards, so they will fail
42896
+ ["preStop", "postStop"].includes(when));
42548
42897
  });
42549
42898
  };
42550
42899
  var getCreateScheduleScripts = function () {
@@ -42584,18 +42933,19 @@ var createGoogleCloudRunDeployJobs = function (context) {
42584
42933
  "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)];
42585
42934
  });
42586
42935
  };
42587
- var deployScripts = __spreadArray(__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
42936
+ var deployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gitlab_1.collapseableSection)("prepare", "Prepare...")(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(setGoogleProjectNumberScript(deployConfig)), false))), false), __read((0, gitlab_1.collapseableSection)("deploy", "Deploy to cloud run")(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(["echo \"$ENV_VARS\" > ____envvars.yaml"], __read(deployConfig.cloudSql ? (0, database_1.getDatabaseCreateScript)(context, deployConfig) // we create the db, so that we can also delete it afterwards
42588
42937
  : []), false), __read(getCreateScheduleScripts()), false), __read(getJobCreateScripts()), false), __read(getJobRunScripts("preDeploy")), false), __read(deployConfig.service !== false ? [getServiceDeployScript(deployConfig.service)] : []), false), __read(Object.entries((_b = deployConfig.additionalServices) !== null && _b !== void 0 ? _b : {}).map(function (_a) {
42589
42938
  var _b = __read(_a, 2),
42590
42939
  name = _b[0],
42591
42940
  service = _b[1];
42592
42941
  return getServiceDeployScript(service, "-" + name);
42593
- })), false), __read(getJobRunScripts("postDeploy")), false), ["docker image rm ".concat(gcloudImageName)], false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false);
42594
- var stopScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(deployConfig.service !== false ? ["gcloud run services delete ".concat(serviceName, " ").concat(commonArgsString)] : []), false), __read(Object.entries((_c = deployConfig.additionalServices) !== null && _c !== void 0 ? _c : {}).map(function (_a) {
42942
+ })), false), __read(getJobRunScripts("postDeploy")), false))), false), __read((0, gitlab_1.collapseableSection)("cleanup", "Cleanup")((0, cleanup_1.getRemoveOldRevisionsAndImagesCommand)(context, "postDeploy") // we cleanup inactive images both on deploy and stop
42943
+ )), false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false);
42944
+ var stopScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(getJobRunScripts("preStop")), false), __read(deployConfig.service !== false ? ["gcloud run services delete ".concat(serviceName, " ").concat(commonArgsString)] : []), false), __read(Object.entries((_c = deployConfig.additionalServices) !== null && _c !== void 0 ? _c : {}).map(function (_a) {
42595
42945
  var _b = __read(_a, 1),
42596
42946
  name = _b[0];
42597
42947
  return "gcloud run services delete ".concat(serviceName, "-").concat(name, " ").concat(commonArgsString);
42598
- })), false), __read(getDeleteSchedulesScripts()), false), __read(getDeleteJobsScripts()), false), __read(deployConfig.cloudSql && deployConfig.cloudSql.deleteDatabaseOnStop ? (0, database_1.getDatabaseDeleteScript)(context, deployConfig) : []), false), __read((0, sbom_1.getDependencyTrackDeleteScript)(context)), false);
42948
+ })), false), __read(getJobRunScripts("postStop")), false), __read(getDeleteSchedulesScripts()), false), __read(getDeleteJobsScripts()), false), __read(deployConfig.cloudSql && deployConfig.cloudSql.deleteDatabaseOnStop ? (0, database_1.getDatabaseDeleteScript)(context, deployConfig) : []), false), __read((0, cleanup_1.getRemoveOldRevisionsAndImagesCommand)(context, "onStop")), false), __read((0, sbom_1.getDependencyTrackDeleteScript)(context)), false);
42599
42949
  return (0, base_1.createDeployementJobs)(context, {
42600
42950
  deploy: (0, lodash_1.merge)((0, docker_1.getDockerJobBaseProps)(context), {
42601
42951
  artifacts: {
@@ -42680,6 +43030,7 @@ var utils_1 = __nccwpck_require__(463);
42680
43030
  var deployJob_1 = __nccwpck_require__(2256);
42681
43031
  var jobName_1 = __nccwpck_require__(7311);
42682
43032
  exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
43033
+ // FIXME: rename to internalHostSuffix, but this means that project-setup needs to be rerun, so its kindof a breaking change
42683
43034
  exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
42684
43035
  var getCloudSqlVariables = function (_a) {
42685
43036
  var _b, _c;
@@ -42738,7 +43089,7 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
42738
43089
  env = ctx.env,
42739
43090
  componentName = ctx.componentName,
42740
43091
  deployConfigRaw = ctx.deployConfigRaw;
42741
- var HOST_CANONICAL = fullName.toLowerCase() + "-" + ((_a = process.env[(0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)]) !== null && _a !== void 0 ? _a : "unknown-host.example.com");
43092
+ var HOST_INTERNAL = fullName.toLowerCase() + "-" + ((_a = process.env[(0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)]) !== null && _a !== void 0 ? _a : "unknown-host.example.com");
42742
43093
  var jobTriggers = deployConfigRaw && deployConfigRaw.jobs ? Object.fromEntries(Object.entries(deployConfigRaw.jobs).map(function (_a) {
42743
43094
  var _b = __read(_a, 2),
42744
43095
  name = _b[0],
@@ -42746,7 +43097,7 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
42746
43097
  return ["CLOUD_RUN_JOB_TRIGGER_URL_" + (0, gitlab_1.sanitizeForBashVariable)(name), "https://".concat(deployConfigRaw.region, "-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/").concat(deployConfigRaw.projectId, "/jobs/").concat((0, jobName_1.getCloudRunJobName)(fullName, name), ":run")];
42747
43098
  })) : {};
42748
43099
  return __assign(__assign({
42749
- HOST_CANONICAL: HOST_CANONICAL
43100
+ HOST_INTERNAL: HOST_INTERNAL
42750
43101
  }, getCloudSqlVariables(ctx)), jobTriggers);
42751
43102
  }
42752
43103
  };
@@ -42897,12 +43248,27 @@ exports.gcloudServiceAccountLoginCommands = void 0;
42897
43248
  var __1 = __nccwpck_require__(1344);
42898
43249
  var context_1 = __nccwpck_require__(2041);
42899
43250
  var gcloudServiceAccountLoginCommands = function (context) {
42900
- return ["echo $".concat((0, context_1.getSecretVarNameForContext)(context, __1.GCLOUD_DEPLOY_CREDENTIALS_KEY), " > ./____keyfile.json\n "), "gcloud auth activate-service-account --key-file=\"./____keyfile.json\""];
43251
+ return ["gcloud auth activate-service-account --key-file=<(echo \"$".concat((0, context_1.getSecretVarNameForContext)(context, __1.GCLOUD_DEPLOY_CREDENTIALS_KEY), "\")")];
42901
43252
  };
42902
43253
  exports.gcloudServiceAccountLoginCommands = gcloudServiceAccountLoginCommands;
42903
43254
 
42904
43255
  /***/ }),
42905
43256
 
43257
+ /***/ 9391:
43258
+ /***/ ((__unused_webpack_module, exports) => {
43259
+
43260
+ "use strict";
43261
+
43262
+
43263
+ exports.__esModule = true;
43264
+ exports.getServiceName = void 0;
43265
+ var getServiceName = function (context) {
43266
+ return context.environment.fullName.toLowerCase();
43267
+ };
43268
+ exports.getServiceName = getServiceName;
43269
+
43270
+ /***/ }),
43271
+
42906
43272
  /***/ 7311:
42907
43273
  /***/ ((__unused_webpack_module, exports) => {
42908
43274
 
@@ -42918,6 +43284,29 @@ exports.getCloudRunJobName = getCloudRunJobName;
42918
43284
 
42919
43285
  /***/ }),
42920
43286
 
43287
+ /***/ 7547:
43288
+ /***/ ((__unused_webpack_module, exports) => {
43289
+
43290
+ "use strict";
43291
+
43292
+
43293
+ exports.__esModule = true;
43294
+ exports.removeFirstLinesFromCommandOutput = void 0;
43295
+ /**
43296
+ *
43297
+ * takes a command and removes the first keep lines from the output
43298
+ *
43299
+ * @param cmd the command, its stdout is then limited
43300
+ * @param removeFirstN how many lines to remove at the start of the command
43301
+ * @returns
43302
+ */
43303
+ var removeFirstLinesFromCommandOutput = function (cmd, removeFirstN) {
43304
+ return removeFirstN === 0 ? cmd : "".concat(cmd, " | tail -n +").concat(removeFirstN + 1);
43305
+ };
43306
+ exports.removeFirstLinesFromCommandOutput = removeFirstLinesFromCommandOutput;
43307
+
43308
+ /***/ }),
43309
+
42921
43310
  /***/ 463:
42922
43311
  /***/ ((__unused_webpack_module, exports) => {
42923
43312
 
@@ -43050,6 +43439,37 @@ var __assign = this && this.__assign || function () {
43050
43439
  };
43051
43440
  return __assign.apply(this, arguments);
43052
43441
  };
43442
+ var __read = this && this.__read || function (o, n) {
43443
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
43444
+ if (!m) return o;
43445
+ var i = m.call(o),
43446
+ r,
43447
+ ar = [],
43448
+ e;
43449
+ try {
43450
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
43451
+ } catch (error) {
43452
+ e = {
43453
+ error: error
43454
+ };
43455
+ } finally {
43456
+ try {
43457
+ if (r && !r.done && (m = i["return"])) m.call(i);
43458
+ } finally {
43459
+ if (e) throw e.error;
43460
+ }
43461
+ }
43462
+ return ar;
43463
+ };
43464
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
43465
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
43466
+ if (ar || !(i in from)) {
43467
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
43468
+ ar[i] = from[i];
43469
+ }
43470
+ }
43471
+ return to.concat(ar || Array.prototype.slice.call(from));
43472
+ };
43053
43473
  exports.__esModule = true;
43054
43474
  exports.createDockerTagDeployJobs = void 0;
43055
43475
  var docker_1 = __nccwpck_require__(3219);
@@ -43067,7 +43487,7 @@ var createDockerTagDeployJobs = function (context) {
43067
43487
  var tag = deployConfig.tag;
43068
43488
  return (0, base_1.createDeployementJobs)(context, {
43069
43489
  deploy: __assign(__assign({}, (0, docker_1.getDockerJobBaseProps)(context)), {
43070
- script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_IMAGE:".concat(tag), "docker push $DOCKER_IMAGE:".concat(tag), "echo \"pushed as $DOCKER_IMAGE:".concat(tag, "\"")]
43490
+ script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), ["docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_IMAGE:".concat(tag), "docker push $DOCKER_IMAGE:".concat(tag), "echo \"pushed as $DOCKER_IMAGE:".concat(tag, "\"")], false)
43071
43491
  })
43072
43492
  });
43073
43493
  };
@@ -43389,12 +43809,12 @@ exports.KUBERNETES_DEPLOY_TYPE = {
43389
43809
  var domainCanonical = deployConfigRaw && ((_b = deployConfigRaw.cluster) === null || _b === void 0 ? void 0 : _b.domainCanonical) ||
43390
43810
  // for convenience, we allow clusters to define a canonical domain, because a cluster has a fixed ip and you will usually have a domain pointing to that cluster
43391
43811
  fullConfig.domainCanonical || "panter.cloud";
43392
- var HOST_CANONICAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(fullConfig.appName, ".").concat(fullConfig.customerName, ".").concat(domainCanonical); // default for kubernetes and rest
43812
+ var HOST_INTERNAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(fullConfig.appName, ".").concat(fullConfig.customerName, ".").concat(domainCanonical); // default for kubernetes and rest
43393
43813
  return {
43394
43814
  KUBE_NAMESPACE: KUBE_NAMESPACE,
43395
43815
  KUBE_APP_NAME: KUBE_APP_NAME,
43396
43816
  KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX,
43397
- HOST_CANONICAL: HOST_CANONICAL
43817
+ HOST_INTERNAL: HOST_INTERNAL
43398
43818
  };
43399
43819
  }
43400
43820
  };
@@ -44600,7 +45020,8 @@ var createChildPipeline = function (type, trigger, config) {
44600
45020
  _a = {
44601
45021
  image: (0, runner_1.getRunnerImage)("jobs-default"),
44602
45022
  variables: {
44603
- FF_USE_FASTZIP: "true"
45023
+ FF_USE_FASTZIP: "true",
45024
+ GIT_DEPTH: 1
44604
45025
  },
44605
45026
  workflow: {
44606
45027
  rules: rules_1.RULES_ALWAYS
@@ -45318,7 +45739,7 @@ var path_equal_1 = __nccwpck_require__(4843);
45318
45739
  var yarnUtils_1 = __nccwpck_require__(1369);
45319
45740
  var getPackageManagerInfo = function (config, componentName) {
45320
45741
  return __awaiter(void 0, void 0, void 0, function () {
45321
- var version, isClassic, component, workspaces, currentWorkspace, componentIsInWorkspace, workspaceRoot, packageJson, workspacePackageJson, lockFile, configFiles, configFilePaths, workspaceDependencies, pathsToCopyInDocker;
45742
+ var version, isClassic, component, workspaces, currentWorkspace, componentIsInWorkspace, workspaceRoot, packageJson, workspacePackageJson, lockFile, configFiles, configFilePaths, currentWorkspaceDependencies, pathsToCopyInDocker;
45322
45743
  return __generator(this, function (_a) {
45323
45744
  switch (_a.label) {
45324
45745
  case 0:
@@ -45345,19 +45766,15 @@ var getPackageManagerInfo = function (config, componentName) {
45345
45766
  })), false).filter(function (f) {
45346
45767
  return (0, fs_1.existsSync)(f);
45347
45768
  });
45348
- workspaceDependencies = currentWorkspace ? __spreadArray(__spreadArray([], __read(currentWorkspace.workspaceDependencies), false), __read(currentWorkspace.mismatchedWorkspaceDependencies), false).map(function (name) {
45349
- var _a;
45350
- return (_a = workspaces.find(function (w) {
45351
- return w.name === name;
45352
- })) === null || _a === void 0 ? void 0 : _a.location;
45353
- }).filter(Boolean) : [];
45354
- pathsToCopyInDocker = __spreadArray(__spreadArray(__spreadArray(__spreadArray([packageJson], __read(workspacePackageJson ? [workspacePackageJson] : []), false), [lockFile], false), __read(configFilePaths), false), __read(workspaceDependencies), false);
45769
+ currentWorkspaceDependencies = currentWorkspace ? (0, yarnUtils_1.getWorkspaceDependencies)(currentWorkspace, workspaces) : [];
45770
+ pathsToCopyInDocker = __spreadArray(__spreadArray(__spreadArray(__spreadArray([packageJson], __read(workspacePackageJson ? [workspacePackageJson] : []), false), [lockFile], false), __read(configFilePaths), false), __read(currentWorkspaceDependencies), false);
45355
45771
  return [2 /*return*/, {
45356
45772
  type: "yarn",
45357
45773
  workspaces: workspaces,
45358
45774
  version: version,
45359
45775
  isClassic: isClassic,
45360
45776
  currentWorkspace: currentWorkspace,
45777
+ currentWorkspaceDependencies: currentWorkspaceDependencies,
45361
45778
  componentIsInWorkspace: componentIsInWorkspace,
45362
45779
  pathsToCopyInDocker: pathsToCopyInDocker
45363
45780
  }];
@@ -45490,13 +45907,44 @@ var __generator = this && this.__generator || function (thisArg, body) {
45490
45907
  };
45491
45908
  }
45492
45909
  };
45910
+ var __read = this && this.__read || function (o, n) {
45911
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
45912
+ if (!m) return o;
45913
+ var i = m.call(o),
45914
+ r,
45915
+ ar = [],
45916
+ e;
45917
+ try {
45918
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
45919
+ } catch (error) {
45920
+ e = {
45921
+ error: error
45922
+ };
45923
+ } finally {
45924
+ try {
45925
+ if (r && !r.done && (m = i["return"])) m.call(i);
45926
+ } finally {
45927
+ if (e) throw e.error;
45928
+ }
45929
+ }
45930
+ return ar;
45931
+ };
45932
+ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
45933
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
45934
+ if (ar || !(i in from)) {
45935
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
45936
+ ar[i] = from[i];
45937
+ }
45938
+ }
45939
+ return to.concat(ar || Array.prototype.slice.call(from));
45940
+ };
45493
45941
  var __importDefault = this && this.__importDefault || function (mod) {
45494
45942
  return mod && mod.__esModule ? mod : {
45495
45943
  "default": mod
45496
45944
  };
45497
45945
  };
45498
45946
  exports.__esModule = true;
45499
- exports.getWorkspaces = exports.getYarnVersion = void 0;
45947
+ exports.getWorkspaceDependencies = exports.getWorkspaces = exports.getYarnVersion = void 0;
45500
45948
  var child_process_promise_1 = __nccwpck_require__(5763);
45501
45949
  var memoizee_1 = __importDefault(__nccwpck_require__(5839));
45502
45950
  var execOrFail = function (cmd, onFail) {
@@ -45566,6 +46014,20 @@ exports.getWorkspaces = (0, memoizee_1["default"])(function (isClassic) {
45566
46014
  }, {
45567
46015
  promise: true
45568
46016
  });
46017
+ // recursivly get all workspace dependencies
46018
+ var getWorkspaceDependencies = function (ws, allWorkspaces) {
46019
+ return ws ? __spreadArray(__spreadArray([], __read(ws.workspaceDependencies), false), __read(ws.mismatchedWorkspaceDependencies), false).flatMap(function (location) {
46020
+ // we have to do this recursivly
46021
+ var otherWorkspace = allWorkspaces.find(function (w) {
46022
+ return w.location === location;
46023
+ });
46024
+ if (otherWorkspace) {
46025
+ return __spreadArray(__spreadArray([], __read((0, exports.getWorkspaceDependencies)(otherWorkspace, allWorkspaces)), false), [otherWorkspace.location], false);
46026
+ }
46027
+ return [];
46028
+ }).filter(Boolean) : [];
46029
+ };
46030
+ exports.getWorkspaceDependencies = getWorkspaceDependencies;
45569
46031
 
45570
46032
  /***/ }),
45571
46033
 
@@ -45807,7 +46269,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
45807
46269
  return to.concat(ar || Array.prototype.slice.call(from));
45808
46270
  };
45809
46271
  exports.__esModule = true;
45810
- exports.repeatOnFailure = exports.sanitizeForBashVariable = exports.allowFailureInScripts = void 0;
46272
+ exports.collapseableSection = exports.repeatOnFailure = exports.sanitizeForBashVariable = exports.allowFailureInScripts = void 0;
45811
46273
  var allowFailureInScripts = function (script) {
45812
46274
  return __spreadArray(__spreadArray(["set +e"], __read(script), false), ["set -e" // reenable
45813
46275
  ], false);
@@ -45821,6 +46283,12 @@ var repeatOnFailure = function (command, options) {
45821
46283
  return "\n until ".concat(command, "\n do\n echo \"Trying again.\"\n sleep ").concat(options.pauseInSeconds, "\n done\n ");
45822
46284
  };
45823
46285
  exports.repeatOnFailure = repeatOnFailure;
46286
+ var collapseableSection = function (name, header) {
46287
+ return function (commands) {
46288
+ return __spreadArray(__spreadArray(["echo -e \"\\e[0Ksection_start:$(date +%s):".concat(name, "[collapsed=true]\\r\\e[0K").concat(header, "\"")], __read(commands), false), ["echo -e \"\\e[0Ksection_end:$(date +%s):".concat(name, "\\r\\e[0K\"")], false);
46289
+ };
46290
+ };
46291
+ exports.collapseableSection = collapseableSection;
45824
46292
 
45825
46293
  /***/ }),
45826
46294