@catladder/cli 0.0.0-main-46c5c159 → 0.0.0-main-5c481bfe

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.
@@ -2530,7 +2530,7 @@ var RUNNER_BUILD_VARIABLES = {
2530
2530
  KUBERNETES_MEMORY_LIMIT: "4Gi",
2531
2531
  };
2532
2532
  var createCustomBuildJobs = function (context) {
2533
- var _a, _b, _c, _d;
2533
+ var _a, _b, _c;
2534
2534
  var buildConfig = context.build.config;
2535
2535
  if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
2536
2536
  throw new Error("deploy config is not custom");
@@ -2555,7 +2555,7 @@ var createCustomBuildJobs = function (context) {
2555
2555
  }
2556
2556
  : undefined,
2557
2557
  dockerBuild: {
2558
- script: (0, docker_1.getDockerBuildDefaultScript)(context, ((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
2558
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context),
2559
2559
  variables: {},
2560
2560
  },
2561
2561
  });
@@ -2747,15 +2747,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
2747
2747
  return (mod && mod.__esModule) ? mod : { "default": mod };
2748
2748
  };
2749
2749
  Object.defineProperty(exports, "__esModule", ({ value: true }));
2750
- exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
2751
- var lodash_1 = __nccwpck_require__(3255);
2752
- var deploy_1 = __nccwpck_require__(8483);
2753
- var runner_1 = __nccwpck_require__(4058);
2750
+ exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.getDockerBuildScriptWithBuiltInDockerFile = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
2754
2751
  var fs_1 = __nccwpck_require__(7147);
2752
+ var lodash_1 = __nccwpck_require__(3255);
2755
2753
  var path_1 = __importDefault(__nccwpck_require__(1017));
2756
- var gitlab_1 = __nccwpck_require__(8490);
2754
+ var deploy_1 = __nccwpck_require__(8483);
2757
2755
  var artifactsRegistry_1 = __nccwpck_require__(4963);
2758
2756
  var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(6320);
2757
+ var runner_1 = __nccwpck_require__(4058);
2758
+ var gitlab_1 = __nccwpck_require__(8490);
2759
2759
  var DOCKER_BUILD_RUNNER_REQUESTS = {
2760
2760
  KUBERNETES_CPU_REQUEST: "0.5",
2761
2761
  KUBERNETES_MEMORY_REQUEST: "1Gi",
@@ -2797,9 +2797,23 @@ var getDockerBuildRunnerVariables = function () { return ({
2797
2797
  DOCKER_DRIVER: "overlay2",
2798
2798
  DOCKER_BUILDKIT: "1", // see https://docs.docker.com/develop/develop-images/build_enhancements/
2799
2799
  }); };
2800
+ var getDockerAdditions = function (build) {
2801
+ var _a, _b;
2802
+ if (!("docker" in build))
2803
+ return {};
2804
+ if (!build.docker)
2805
+ return {};
2806
+ return {
2807
+ DOCKERFILE_ADDITIONS: "additionsBegin" in build.docker
2808
+ ? (_a = build.docker.additionsBegin) === null || _a === void 0 ? void 0 : _a.join("\n")
2809
+ : undefined,
2810
+ DOCKERFILE_ADDITIONS_END: "additionsEnd" in build.docker
2811
+ ? (_b = build.docker.additionsEnd) === null || _b === void 0 ? void 0 : _b.join("\n")
2812
+ : undefined,
2813
+ };
2814
+ };
2800
2815
  var getDockerBuildVariables = function (context) {
2801
- var _a, _b, _c, _d;
2802
- return __assign({ DOCKERFILE_ADDITIONS: (_b = (_a = context.build.config.docker) === null || _a === void 0 ? void 0 : _a.additionsBegin) === null || _b === void 0 ? void 0 : _b.join("\n"), DOCKERFILE_ADDITIONS_END: (_d = (_c = context.build.config.docker) === null || _c === void 0 ? void 0 : _c.additionsEnd) === null || _d === void 0 ? void 0 : _d.join("\n"), APP_DIR: context.build.dir, DOCKER_DIR: "." }, (0, exports.getDockerImageVariables)(context));
2816
+ return __assign(__assign(__assign({}, getDockerAdditions(context.build.config)), { APP_DIR: context.build.dir, DOCKER_DIR: "." }), (0, exports.getDockerImageVariables)(context));
2803
2817
  };
2804
2818
  exports.getDockerBuildVariables = getDockerBuildVariables;
2805
2819
  exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
@@ -2834,9 +2848,25 @@ var gitlabDockerLogin = function (context) {
2834
2848
  ];
2835
2849
  };
2836
2850
  exports.gitlabDockerLogin = gitlabDockerLogin;
2851
+ var BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS = {
2852
+ meteor: "ensureMeteorDockerfile",
2853
+ node: "ensureNodeDockerfile",
2854
+ nginx: "ensureNginxDockerfile",
2855
+ custom: null,
2856
+ };
2857
+ var getDockerBuildScriptWithBuiltInDockerFile = function (context, defaultType) {
2858
+ var _a;
2859
+ var type = "docker" in context.componentConfig.build &&
2860
+ context.componentConfig.build.docker &&
2861
+ "type" in context.componentConfig.build.docker
2862
+ ? (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.type
2863
+ : defaultType;
2864
+ return (0, exports.getDockerBuildDefaultScript)(context, type ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[type] : null);
2865
+ };
2866
+ exports.getDockerBuildScriptWithBuiltInDockerFile = getDockerBuildScriptWithBuiltInDockerFile;
2837
2867
  var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
2838
2868
  return __spreadArray(__spreadArray(__spreadArray([
2839
- ensureDockerFileScript
2869
+ ensureDockerFileScript !== null && ensureDockerFileScript !== void 0 ? ensureDockerFileScript : undefined
2840
2870
  ], __read((0, gitlab_1.collapseableSection)("docker-login", "Docker Login")((0, exports.gitlabDockerLogin)(context))), false), __read((0, gitlab_1.collapseableSection)("docker-build", "Docker build")([
2841
2871
  "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/
2842
2872
  ])), false), __read((0, gitlab_1.collapseableSection)("docker-push", "Docker push and tag")([
@@ -3001,9 +3031,9 @@ var createNodeBuildJobs = function (context) {
3001
3031
  }
3002
3032
  : undefined,
3003
3033
  dockerBuild: {
3004
- script: (0, docker_1.getDockerBuildDefaultScript)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
3005
- ? "ensureNginxDockerfile"
3006
- : "ensureNodeDockerfile"),
3034
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
3035
+ ? "nginx"
3036
+ : "node"),
3007
3037
  cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.build, "pull")), false),
3008
3038
  variables: {
3009
3039
  // only required for non static
@@ -3264,7 +3294,7 @@ var createMeteorBuildJobs = function (context) {
3264
3294
  }
3265
3295
  : undefined,
3266
3296
  dockerBuild: {
3267
- script: (0, docker_1.getDockerBuildDefaultScript)(context, "ensureMeteorDockerfile"),
3297
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, "meteor"),
3268
3298
  variables: {
3269
3299
  METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? "true" : "",
3270
3300
  },
@@ -7892,15 +7922,32 @@ var __rest = (this && this.__rest) || function (s, e) {
7892
7922
  }
7893
7923
  return t;
7894
7924
  };
7925
+ var __read = (this && this.__read) || function (o, n) {
7926
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
7927
+ if (!m) return o;
7928
+ var i = m.call(o), r, ar = [], e;
7929
+ try {
7930
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
7931
+ }
7932
+ catch (error) { e = { error: error }; }
7933
+ finally {
7934
+ try {
7935
+ if (r && !r.done && (m = i["return"])) m.call(i);
7936
+ }
7937
+ finally { if (e) throw e.error; }
7938
+ }
7939
+ return ar;
7940
+ };
7895
7941
  Object.defineProperty(exports, "__esModule", ({ value: true }));
7896
7942
  exports.generatePipelineFiles = void 0;
7897
7943
  var writeFiles_1 = __nccwpck_require__(2228);
7898
7944
  var createChildPipeline_1 = __nccwpck_require__(5139);
7899
7945
  var createMainPipeline_1 = __nccwpck_require__(9192);
7900
7946
  var getPipelineTriggerForGitlabChildPipeline_1 = __nccwpck_require__(7426);
7947
+ var sortGitLabJobDefProps_1 = __nccwpck_require__(2361);
7901
7948
  function generatePipelineFiles(config, pipelineType, mode) {
7902
7949
  return __awaiter(this, void 0, void 0, function () {
7903
- var trigger, _a, jobs, image, stages, variables, workflow, mainPipeline, _b, jobs, image, stages, variables, workflow, mainPipeline;
7950
+ var trigger, _a, jobs, image, stages, variables, workflow, pipelineRest, jobsWithSortedProps, _b, jobs, image, stages, variables, workflow, pipelineRest, jobsWithSortedProps;
7904
7951
  return __generator(this, function (_c) {
7905
7952
  switch (_c.label) {
7906
7953
  case 0:
@@ -7908,20 +7955,30 @@ function generatePipelineFiles(config, pipelineType, mode) {
7908
7955
  trigger = (0, getPipelineTriggerForGitlabChildPipeline_1.getPipelineTriggerForGitlabChildPipeline)();
7909
7956
  return [4 /*yield*/, (0, createChildPipeline_1.createChildPipeline)(pipelineType, trigger, config)];
7910
7957
  case 1:
7911
- _a = _c.sent(), jobs = _a.jobs, image = _a.image, stages = _a.stages, variables = _a.variables, workflow = _a.workflow, mainPipeline = __rest(_a, ["jobs", "image", "stages", "variables", "workflow"]);
7912
- // need to spread out the jobs, forgot why
7913
- return [4 /*yield*/, (0, writeFiles_1.writeYamlfile)("__pipeline.yml", __assign(__assign({ image: image, stages: stages, variables: variables, workflow: workflow }, mainPipeline), jobs))];
7958
+ _a = _c.sent(), jobs = _a.jobs, image = _a.image, stages = _a.stages, variables = _a.variables, workflow = _a.workflow, pipelineRest = __rest(_a, ["jobs", "image", "stages", "variables", "workflow"]);
7959
+ jobsWithSortedProps = Object.fromEntries(Object.entries(jobs).map(function (_a) {
7960
+ var _b = __read(_a, 2), jobName = _b[0], job = _b[1];
7961
+ return [
7962
+ jobName,
7963
+ (0, sortGitLabJobDefProps_1.sortGitLabJobDefProps)(job),
7964
+ ];
7965
+ }));
7966
+ return [4 /*yield*/, (0, writeFiles_1.writeYamlfile)("__pipeline.yml", __assign(__assign({ image: image, stages: stages, variables: variables, workflow: workflow }, pipelineRest), jobsWithSortedProps))];
7914
7967
  case 2:
7915
- // need to spread out the jobs, forgot why
7916
7968
  _c.sent();
7917
7969
  return [3 /*break*/, 6];
7918
7970
  case 3: return [4 /*yield*/, (0, createMainPipeline_1.createMainPipeline)(pipelineType, config)];
7919
7971
  case 4:
7920
- _b = _c.sent(), jobs = _b.jobs, image = _b.image, stages = _b.stages, variables = _b.variables, workflow = _b.workflow, mainPipeline = __rest(_b, ["jobs", "image", "stages", "variables", "workflow"]);
7921
- // need to spread out the jobs, forgot why
7922
- return [4 /*yield*/, (0, writeFiles_1.writeYamlfile)(".gitlab-ci.yml", __assign(__assign({ image: image, stages: stages, variables: variables, workflow: workflow }, mainPipeline), jobs))];
7972
+ _b = _c.sent(), jobs = _b.jobs, image = _b.image, stages = _b.stages, variables = _b.variables, workflow = _b.workflow, pipelineRest = __rest(_b, ["jobs", "image", "stages", "variables", "workflow"]);
7973
+ jobsWithSortedProps = Object.fromEntries(Object.entries(jobs).map(function (_a) {
7974
+ var _b = __read(_a, 2), jobName = _b[0], job = _b[1];
7975
+ return [
7976
+ jobName,
7977
+ (0, sortGitLabJobDefProps_1.sortGitLabJobDefProps)(job),
7978
+ ];
7979
+ }));
7980
+ return [4 /*yield*/, (0, writeFiles_1.writeYamlfile)(".gitlab-ci.yml", __assign(__assign({ image: image, stages: stages, variables: variables, workflow: workflow }, pipelineRest), jobsWithSortedProps))];
7923
7981
  case 5:
7924
- // need to spread out the jobs, forgot why
7925
7982
  _c.sent();
7926
7983
  _c.label = 6;
7927
7984
  case 6: return [2 /*return*/];
@@ -8081,13 +8138,8 @@ var getInjectVarsScript_1 = __nccwpck_require__(8133);
8081
8138
  var defaults_1 = __nccwpck_require__(6484);
8082
8139
  var utils_1 = __nccwpck_require__(2497);
8083
8140
  var gitlab_1 = __nccwpck_require__(8490);
8141
+ var removeUndefined_1 = __nccwpck_require__(1073);
8084
8142
  exports.GITLAB_ENVIRONMENT_URL_VARIABLE = "CL_GITLAB_ENVIRONMENT_URL";
8085
- var removeUndefined = function (obj) {
8086
- return Object.fromEntries(Object.entries(obj).filter(function (_a) {
8087
- var _b = __read(_a, 2), value = _b[1];
8088
- return value !== undefined;
8089
- }));
8090
- };
8091
8143
  var getFullJobName = function (name, componentName, env) {
8092
8144
  if (env) {
8093
8145
  return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
@@ -8165,8 +8217,7 @@ var makeGitlabJob = function (componentName, env, _a, allJobs, baseRules) {
8165
8217
  var modified = addGitlabEnvironment(context, environment, __assign(__assign({}, job), { rules: rules.length > 0 ? rules : undefined, variables: __assign(__assign({}, legacyRunnerVariables), runnerVariables), script: __spreadArray(__spreadArray([], __read(varsInjectScripts), false), __read(((_c = script === null || script === void 0 ? void 0 : script.filter(utils_1.notNil)) !== null && _c !== void 0 ? _c : [])), false), tags: jobTags, stage: stage,
8166
8218
  // sort in a predictable manner for snapshot tests
8167
8219
  needs: deduplicatedGitlabNeeds, retry: defaults_1.BASE_RETRY, interruptible: true }), componentName, env, allJobs);
8168
- var gitlabJob = removeUndefined(modified);
8169
- return [fullJobName, gitlabJob];
8220
+ return [fullJobName, (0, removeUndefined_1.removeUndefined)(modified)];
8170
8221
  };
8171
8222
  exports.makeGitlabJob = makeGitlabJob;
8172
8223
  var addGitlabEnvironment = function (context, environment, job, componentName, env, // TODO: we could actually pull this from contxt
@@ -8330,6 +8381,72 @@ exports.getGitlabReleaseJobs = getGitlabReleaseJobs;
8330
8381
 
8331
8382
  /***/ }),
8332
8383
 
8384
+ /***/ 2361:
8385
+ /***/ ((__unused_webpack_module, exports) => {
8386
+
8387
+ "use strict";
8388
+
8389
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
8390
+ exports.sortGitLabJobDefProps = void 0;
8391
+ /**
8392
+ * The desired order of GitLab job definition keys.
8393
+ */
8394
+ var jobDefOrder = [
8395
+ "stage",
8396
+ "tags",
8397
+ "image",
8398
+ "services",
8399
+ "variables",
8400
+ "before_script",
8401
+ "script",
8402
+ "after_script",
8403
+ "cache",
8404
+ "coverage",
8405
+ "environment",
8406
+ "release",
8407
+ "artifacts",
8408
+ "rules",
8409
+ "only",
8410
+ "except",
8411
+ "needs",
8412
+ "dependencies",
8413
+ "trigger",
8414
+ "retry",
8415
+ "interruptible",
8416
+ "allow_failure",
8417
+ "parallel",
8418
+ "hooks",
8419
+ "resource_group",
8420
+ ];
8421
+ var sortGitLabJobDefKeys = function (jobDef) {
8422
+ return Object.keys(jobDef).sort(function (a, b) {
8423
+ return jobDefOrder.indexOf(a) === -1 && jobDefOrder.indexOf(b) === -1
8424
+ ? 0
8425
+ : jobDefOrder.indexOf(a) === -1
8426
+ ? 1
8427
+ : jobDefOrder.indexOf(b) === -1
8428
+ ? -1
8429
+ : jobDefOrder.indexOf(a) - jobDefOrder.indexOf(b);
8430
+ });
8431
+ };
8432
+ /**
8433
+ * Sorts the properties of a GitLab job definition based on the desired order.
8434
+ *
8435
+ * This is only useful when generating a GitLab pipeline YAML file.
8436
+ */
8437
+ var sortGitLabJobDefProps = function (jobDef) {
8438
+ return sortGitLabJobDefKeys(jobDef).reduce(function (acc, key) {
8439
+ var _a;
8440
+ return jobDef[key] !== undefined
8441
+ ? Object.assign(acc, (_a = {}, _a[key] = jobDef[key], _a))
8442
+ : acc;
8443
+ }, {});
8444
+ };
8445
+ exports.sortGitLabJobDefProps = sortGitLabJobDefProps;
8446
+ //# sourceMappingURL=sortGitLabJobDefProps.js.map
8447
+
8448
+ /***/ }),
8449
+
8333
8450
  /***/ 7752:
8334
8451
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
8335
8452
 
@@ -8984,6 +9101,40 @@ exports.mergeWithMergingArrays = mergeWithMergingArrays;
8984
9101
 
8985
9102
  /***/ }),
8986
9103
 
9104
+ /***/ 1073:
9105
+ /***/ (function(__unused_webpack_module, exports) {
9106
+
9107
+ "use strict";
9108
+
9109
+ var __read = (this && this.__read) || function (o, n) {
9110
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
9111
+ if (!m) return o;
9112
+ var i = m.call(o), r, ar = [], e;
9113
+ try {
9114
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
9115
+ }
9116
+ catch (error) { e = { error: error }; }
9117
+ finally {
9118
+ try {
9119
+ if (r && !r.done && (m = i["return"])) m.call(i);
9120
+ }
9121
+ finally { if (e) throw e.error; }
9122
+ }
9123
+ return ar;
9124
+ };
9125
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
9126
+ exports.removeUndefined = void 0;
9127
+ var removeUndefined = function (obj) {
9128
+ return Object.fromEntries(Object.entries(obj).filter(function (_a) {
9129
+ var _b = __read(_a, 2), value = _b[1];
9130
+ return value !== undefined;
9131
+ }));
9132
+ };
9133
+ exports.removeUndefined = removeUndefined;
9134
+ //# sourceMappingURL=removeUndefined.js.map
9135
+
9136
+ /***/ }),
9137
+
8987
9138
  /***/ 2228:
8988
9139
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
8989
9140
 
@@ -9967,7 +9967,7 @@ var RUNNER_BUILD_VARIABLES = {
9967
9967
  KUBERNETES_MEMORY_LIMIT: "4Gi",
9968
9968
  };
9969
9969
  var createCustomBuildJobs = function (context) {
9970
- var _a, _b, _c, _d;
9970
+ var _a, _b, _c;
9971
9971
  var buildConfig = context.build.config;
9972
9972
  if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
9973
9973
  throw new Error("deploy config is not custom");
@@ -9992,7 +9992,7 @@ var createCustomBuildJobs = function (context) {
9992
9992
  }
9993
9993
  : undefined,
9994
9994
  dockerBuild: {
9995
- script: (0, docker_1.getDockerBuildDefaultScript)(context, ((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
9995
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context),
9996
9996
  variables: {},
9997
9997
  },
9998
9998
  });
@@ -10184,15 +10184,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
10184
10184
  return (mod && mod.__esModule) ? mod : { "default": mod };
10185
10185
  };
10186
10186
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10187
- exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
10188
- var lodash_1 = __nccwpck_require__(23255);
10189
- var deploy_1 = __nccwpck_require__(68483);
10190
- var runner_1 = __nccwpck_require__(4058);
10187
+ exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.getDockerBuildScriptWithBuiltInDockerFile = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
10191
10188
  var fs_1 = __nccwpck_require__(57147);
10189
+ var lodash_1 = __nccwpck_require__(23255);
10192
10190
  var path_1 = __importDefault(__nccwpck_require__(71017));
10193
- var gitlab_1 = __nccwpck_require__(38490);
10191
+ var deploy_1 = __nccwpck_require__(68483);
10194
10192
  var artifactsRegistry_1 = __nccwpck_require__(44963);
10195
10193
  var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(46320);
10194
+ var runner_1 = __nccwpck_require__(4058);
10195
+ var gitlab_1 = __nccwpck_require__(38490);
10196
10196
  var DOCKER_BUILD_RUNNER_REQUESTS = {
10197
10197
  KUBERNETES_CPU_REQUEST: "0.5",
10198
10198
  KUBERNETES_MEMORY_REQUEST: "1Gi",
@@ -10234,9 +10234,23 @@ var getDockerBuildRunnerVariables = function () { return ({
10234
10234
  DOCKER_DRIVER: "overlay2",
10235
10235
  DOCKER_BUILDKIT: "1", // see https://docs.docker.com/develop/develop-images/build_enhancements/
10236
10236
  }); };
10237
+ var getDockerAdditions = function (build) {
10238
+ var _a, _b;
10239
+ if (!("docker" in build))
10240
+ return {};
10241
+ if (!build.docker)
10242
+ return {};
10243
+ return {
10244
+ DOCKERFILE_ADDITIONS: "additionsBegin" in build.docker
10245
+ ? (_a = build.docker.additionsBegin) === null || _a === void 0 ? void 0 : _a.join("\n")
10246
+ : undefined,
10247
+ DOCKERFILE_ADDITIONS_END: "additionsEnd" in build.docker
10248
+ ? (_b = build.docker.additionsEnd) === null || _b === void 0 ? void 0 : _b.join("\n")
10249
+ : undefined,
10250
+ };
10251
+ };
10237
10252
  var getDockerBuildVariables = function (context) {
10238
- var _a, _b, _c, _d;
10239
- return __assign({ DOCKERFILE_ADDITIONS: (_b = (_a = context.build.config.docker) === null || _a === void 0 ? void 0 : _a.additionsBegin) === null || _b === void 0 ? void 0 : _b.join("\n"), DOCKERFILE_ADDITIONS_END: (_d = (_c = context.build.config.docker) === null || _c === void 0 ? void 0 : _c.additionsEnd) === null || _d === void 0 ? void 0 : _d.join("\n"), APP_DIR: context.build.dir, DOCKER_DIR: "." }, (0, exports.getDockerImageVariables)(context));
10253
+ return __assign(__assign(__assign({}, getDockerAdditions(context.build.config)), { APP_DIR: context.build.dir, DOCKER_DIR: "." }), (0, exports.getDockerImageVariables)(context));
10240
10254
  };
10241
10255
  exports.getDockerBuildVariables = getDockerBuildVariables;
10242
10256
  exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
@@ -10271,9 +10285,25 @@ var gitlabDockerLogin = function (context) {
10271
10285
  ];
10272
10286
  };
10273
10287
  exports.gitlabDockerLogin = gitlabDockerLogin;
10288
+ var BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS = {
10289
+ meteor: "ensureMeteorDockerfile",
10290
+ node: "ensureNodeDockerfile",
10291
+ nginx: "ensureNginxDockerfile",
10292
+ custom: null,
10293
+ };
10294
+ var getDockerBuildScriptWithBuiltInDockerFile = function (context, defaultType) {
10295
+ var _a;
10296
+ var type = "docker" in context.componentConfig.build &&
10297
+ context.componentConfig.build.docker &&
10298
+ "type" in context.componentConfig.build.docker
10299
+ ? (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.type
10300
+ : defaultType;
10301
+ return (0, exports.getDockerBuildDefaultScript)(context, type ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[type] : null);
10302
+ };
10303
+ exports.getDockerBuildScriptWithBuiltInDockerFile = getDockerBuildScriptWithBuiltInDockerFile;
10274
10304
  var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
10275
10305
  return __spreadArray(__spreadArray(__spreadArray([
10276
- ensureDockerFileScript
10306
+ ensureDockerFileScript !== null && ensureDockerFileScript !== void 0 ? ensureDockerFileScript : undefined
10277
10307
  ], __read((0, gitlab_1.collapseableSection)("docker-login", "Docker Login")((0, exports.gitlabDockerLogin)(context))), false), __read((0, gitlab_1.collapseableSection)("docker-build", "Docker build")([
10278
10308
  "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/
10279
10309
  ])), false), __read((0, gitlab_1.collapseableSection)("docker-push", "Docker push and tag")([
@@ -10438,9 +10468,9 @@ var createNodeBuildJobs = function (context) {
10438
10468
  }
10439
10469
  : undefined,
10440
10470
  dockerBuild: {
10441
- script: (0, docker_1.getDockerBuildDefaultScript)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
10442
- ? "ensureNginxDockerfile"
10443
- : "ensureNodeDockerfile"),
10471
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook"
10472
+ ? "nginx"
10473
+ : "node"),
10444
10474
  cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.build, "pull")), false),
10445
10475
  variables: {
10446
10476
  // only required for non static
@@ -10701,7 +10731,7 @@ var createMeteorBuildJobs = function (context) {
10701
10731
  }
10702
10732
  : undefined,
10703
10733
  dockerBuild: {
10704
- script: (0, docker_1.getDockerBuildDefaultScript)(context, "ensureMeteorDockerfile"),
10734
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, "meteor"),
10705
10735
  variables: {
10706
10736
  METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? "true" : "",
10707
10737
  },
@@ -15329,15 +15359,32 @@ var __rest = (this && this.__rest) || function (s, e) {
15329
15359
  }
15330
15360
  return t;
15331
15361
  };
15362
+ var __read = (this && this.__read) || function (o, n) {
15363
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
15364
+ if (!m) return o;
15365
+ var i = m.call(o), r, ar = [], e;
15366
+ try {
15367
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
15368
+ }
15369
+ catch (error) { e = { error: error }; }
15370
+ finally {
15371
+ try {
15372
+ if (r && !r.done && (m = i["return"])) m.call(i);
15373
+ }
15374
+ finally { if (e) throw e.error; }
15375
+ }
15376
+ return ar;
15377
+ };
15332
15378
  Object.defineProperty(exports, "__esModule", ({ value: true }));
15333
15379
  exports.generatePipelineFiles = void 0;
15334
15380
  var writeFiles_1 = __nccwpck_require__(92228);
15335
15381
  var createChildPipeline_1 = __nccwpck_require__(55139);
15336
15382
  var createMainPipeline_1 = __nccwpck_require__(39192);
15337
15383
  var getPipelineTriggerForGitlabChildPipeline_1 = __nccwpck_require__(7426);
15384
+ var sortGitLabJobDefProps_1 = __nccwpck_require__(72361);
15338
15385
  function generatePipelineFiles(config, pipelineType, mode) {
15339
15386
  return __awaiter(this, void 0, void 0, function () {
15340
- var trigger, _a, jobs, image, stages, variables, workflow, mainPipeline, _b, jobs, image, stages, variables, workflow, mainPipeline;
15387
+ var trigger, _a, jobs, image, stages, variables, workflow, pipelineRest, jobsWithSortedProps, _b, jobs, image, stages, variables, workflow, pipelineRest, jobsWithSortedProps;
15341
15388
  return __generator(this, function (_c) {
15342
15389
  switch (_c.label) {
15343
15390
  case 0:
@@ -15345,20 +15392,30 @@ function generatePipelineFiles(config, pipelineType, mode) {
15345
15392
  trigger = (0, getPipelineTriggerForGitlabChildPipeline_1.getPipelineTriggerForGitlabChildPipeline)();
15346
15393
  return [4 /*yield*/, (0, createChildPipeline_1.createChildPipeline)(pipelineType, trigger, config)];
15347
15394
  case 1:
15348
- _a = _c.sent(), jobs = _a.jobs, image = _a.image, stages = _a.stages, variables = _a.variables, workflow = _a.workflow, mainPipeline = __rest(_a, ["jobs", "image", "stages", "variables", "workflow"]);
15349
- // need to spread out the jobs, forgot why
15350
- return [4 /*yield*/, (0, writeFiles_1.writeYamlfile)("__pipeline.yml", __assign(__assign({ image: image, stages: stages, variables: variables, workflow: workflow }, mainPipeline), jobs))];
15395
+ _a = _c.sent(), jobs = _a.jobs, image = _a.image, stages = _a.stages, variables = _a.variables, workflow = _a.workflow, pipelineRest = __rest(_a, ["jobs", "image", "stages", "variables", "workflow"]);
15396
+ jobsWithSortedProps = Object.fromEntries(Object.entries(jobs).map(function (_a) {
15397
+ var _b = __read(_a, 2), jobName = _b[0], job = _b[1];
15398
+ return [
15399
+ jobName,
15400
+ (0, sortGitLabJobDefProps_1.sortGitLabJobDefProps)(job),
15401
+ ];
15402
+ }));
15403
+ return [4 /*yield*/, (0, writeFiles_1.writeYamlfile)("__pipeline.yml", __assign(__assign({ image: image, stages: stages, variables: variables, workflow: workflow }, pipelineRest), jobsWithSortedProps))];
15351
15404
  case 2:
15352
- // need to spread out the jobs, forgot why
15353
15405
  _c.sent();
15354
15406
  return [3 /*break*/, 6];
15355
15407
  case 3: return [4 /*yield*/, (0, createMainPipeline_1.createMainPipeline)(pipelineType, config)];
15356
15408
  case 4:
15357
- _b = _c.sent(), jobs = _b.jobs, image = _b.image, stages = _b.stages, variables = _b.variables, workflow = _b.workflow, mainPipeline = __rest(_b, ["jobs", "image", "stages", "variables", "workflow"]);
15358
- // need to spread out the jobs, forgot why
15359
- return [4 /*yield*/, (0, writeFiles_1.writeYamlfile)(".gitlab-ci.yml", __assign(__assign({ image: image, stages: stages, variables: variables, workflow: workflow }, mainPipeline), jobs))];
15409
+ _b = _c.sent(), jobs = _b.jobs, image = _b.image, stages = _b.stages, variables = _b.variables, workflow = _b.workflow, pipelineRest = __rest(_b, ["jobs", "image", "stages", "variables", "workflow"]);
15410
+ jobsWithSortedProps = Object.fromEntries(Object.entries(jobs).map(function (_a) {
15411
+ var _b = __read(_a, 2), jobName = _b[0], job = _b[1];
15412
+ return [
15413
+ jobName,
15414
+ (0, sortGitLabJobDefProps_1.sortGitLabJobDefProps)(job),
15415
+ ];
15416
+ }));
15417
+ return [4 /*yield*/, (0, writeFiles_1.writeYamlfile)(".gitlab-ci.yml", __assign(__assign({ image: image, stages: stages, variables: variables, workflow: workflow }, pipelineRest), jobsWithSortedProps))];
15360
15418
  case 5:
15361
- // need to spread out the jobs, forgot why
15362
15419
  _c.sent();
15363
15420
  _c.label = 6;
15364
15421
  case 6: return [2 /*return*/];
@@ -15518,13 +15575,8 @@ var getInjectVarsScript_1 = __nccwpck_require__(8133);
15518
15575
  var defaults_1 = __nccwpck_require__(96484);
15519
15576
  var utils_1 = __nccwpck_require__(32497);
15520
15577
  var gitlab_1 = __nccwpck_require__(38490);
15578
+ var removeUndefined_1 = __nccwpck_require__(61073);
15521
15579
  exports.GITLAB_ENVIRONMENT_URL_VARIABLE = "CL_GITLAB_ENVIRONMENT_URL";
15522
- var removeUndefined = function (obj) {
15523
- return Object.fromEntries(Object.entries(obj).filter(function (_a) {
15524
- var _b = __read(_a, 2), value = _b[1];
15525
- return value !== undefined;
15526
- }));
15527
- };
15528
15580
  var getFullJobName = function (name, componentName, env) {
15529
15581
  if (env) {
15530
15582
  return "".concat(componentName, " ").concat(name, " | ").concat(env, " ");
@@ -15602,8 +15654,7 @@ var makeGitlabJob = function (componentName, env, _a, allJobs, baseRules) {
15602
15654
  var modified = addGitlabEnvironment(context, environment, __assign(__assign({}, job), { rules: rules.length > 0 ? rules : undefined, variables: __assign(__assign({}, legacyRunnerVariables), runnerVariables), script: __spreadArray(__spreadArray([], __read(varsInjectScripts), false), __read(((_c = script === null || script === void 0 ? void 0 : script.filter(utils_1.notNil)) !== null && _c !== void 0 ? _c : [])), false), tags: jobTags, stage: stage,
15603
15655
  // sort in a predictable manner for snapshot tests
15604
15656
  needs: deduplicatedGitlabNeeds, retry: defaults_1.BASE_RETRY, interruptible: true }), componentName, env, allJobs);
15605
- var gitlabJob = removeUndefined(modified);
15606
- return [fullJobName, gitlabJob];
15657
+ return [fullJobName, (0, removeUndefined_1.removeUndefined)(modified)];
15607
15658
  };
15608
15659
  exports.makeGitlabJob = makeGitlabJob;
15609
15660
  var addGitlabEnvironment = function (context, environment, job, componentName, env, // TODO: we could actually pull this from contxt
@@ -15767,6 +15818,72 @@ exports.getGitlabReleaseJobs = getGitlabReleaseJobs;
15767
15818
 
15768
15819
  /***/ }),
15769
15820
 
15821
+ /***/ 72361:
15822
+ /***/ ((__unused_webpack_module, exports) => {
15823
+
15824
+ "use strict";
15825
+
15826
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
15827
+ exports.sortGitLabJobDefProps = void 0;
15828
+ /**
15829
+ * The desired order of GitLab job definition keys.
15830
+ */
15831
+ var jobDefOrder = [
15832
+ "stage",
15833
+ "tags",
15834
+ "image",
15835
+ "services",
15836
+ "variables",
15837
+ "before_script",
15838
+ "script",
15839
+ "after_script",
15840
+ "cache",
15841
+ "coverage",
15842
+ "environment",
15843
+ "release",
15844
+ "artifacts",
15845
+ "rules",
15846
+ "only",
15847
+ "except",
15848
+ "needs",
15849
+ "dependencies",
15850
+ "trigger",
15851
+ "retry",
15852
+ "interruptible",
15853
+ "allow_failure",
15854
+ "parallel",
15855
+ "hooks",
15856
+ "resource_group",
15857
+ ];
15858
+ var sortGitLabJobDefKeys = function (jobDef) {
15859
+ return Object.keys(jobDef).sort(function (a, b) {
15860
+ return jobDefOrder.indexOf(a) === -1 && jobDefOrder.indexOf(b) === -1
15861
+ ? 0
15862
+ : jobDefOrder.indexOf(a) === -1
15863
+ ? 1
15864
+ : jobDefOrder.indexOf(b) === -1
15865
+ ? -1
15866
+ : jobDefOrder.indexOf(a) - jobDefOrder.indexOf(b);
15867
+ });
15868
+ };
15869
+ /**
15870
+ * Sorts the properties of a GitLab job definition based on the desired order.
15871
+ *
15872
+ * This is only useful when generating a GitLab pipeline YAML file.
15873
+ */
15874
+ var sortGitLabJobDefProps = function (jobDef) {
15875
+ return sortGitLabJobDefKeys(jobDef).reduce(function (acc, key) {
15876
+ var _a;
15877
+ return jobDef[key] !== undefined
15878
+ ? Object.assign(acc, (_a = {}, _a[key] = jobDef[key], _a))
15879
+ : acc;
15880
+ }, {});
15881
+ };
15882
+ exports.sortGitLabJobDefProps = sortGitLabJobDefProps;
15883
+ //# sourceMappingURL=sortGitLabJobDefProps.js.map
15884
+
15885
+ /***/ }),
15886
+
15770
15887
  /***/ 97752:
15771
15888
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
15772
15889
 
@@ -16421,6 +16538,40 @@ exports.mergeWithMergingArrays = mergeWithMergingArrays;
16421
16538
 
16422
16539
  /***/ }),
16423
16540
 
16541
+ /***/ 61073:
16542
+ /***/ (function(__unused_webpack_module, exports) {
16543
+
16544
+ "use strict";
16545
+
16546
+ var __read = (this && this.__read) || function (o, n) {
16547
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
16548
+ if (!m) return o;
16549
+ var i = m.call(o), r, ar = [], e;
16550
+ try {
16551
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
16552
+ }
16553
+ catch (error) { e = { error: error }; }
16554
+ finally {
16555
+ try {
16556
+ if (r && !r.done && (m = i["return"])) m.call(i);
16557
+ }
16558
+ finally { if (e) throw e.error; }
16559
+ }
16560
+ return ar;
16561
+ };
16562
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
16563
+ exports.removeUndefined = void 0;
16564
+ var removeUndefined = function (obj) {
16565
+ return Object.fromEntries(Object.entries(obj).filter(function (_a) {
16566
+ var _b = __read(_a, 2), value = _b[1];
16567
+ return value !== undefined;
16568
+ }));
16569
+ };
16570
+ exports.removeUndefined = removeUndefined;
16571
+ //# sourceMappingURL=removeUndefined.js.map
16572
+
16573
+ /***/ }),
16574
+
16424
16575
  /***/ 92228:
16425
16576
  /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
16426
16577
 
@@ -37,7 +37,7 @@ var RUNNER_BUILD_VARIABLES = {
37
37
  KUBERNETES_MEMORY_LIMIT: "4Gi",
38
38
  };
39
39
  var createCustomBuildJobs = function (context) {
40
- var _a, _b, _c, _d;
40
+ var _a, _b, _c;
41
41
  var buildConfig = context.build.config;
42
42
  if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
43
43
  throw new Error("deploy config is not custom");
@@ -62,7 +62,7 @@ var createCustomBuildJobs = function (context) {
62
62
  }
63
63
  : undefined,
64
64
  dockerBuild: {
65
- script: (0, docker_1.getDockerBuildDefaultScript)(context, ((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
65
+ script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context),
66
66
  variables: {},
67
67
  },
68
68
  });