@catladder/pipeline 0.0.0-next-52feb889 → 0.0.0-next-c177efda

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/dist/backends/github/GithubBackend.js +3 -2
  2. package/dist/backends/gitlab/GitlabBackend.js +5 -3
  3. package/dist/backends/gitlab/gitlabReleaseJobs.d.ts +2 -1
  4. package/dist/backends/gitlab/gitlabReleaseJobs.js +11 -4
  5. package/dist/bash/bashEscape.js +5 -1
  6. package/dist/catci/shippedCatci.d.ts +8 -0
  7. package/dist/catci/shippedCatci.js +43 -0
  8. package/dist/constants.js +1 -1
  9. package/dist/customImages/shippedImages.d.ts +5 -3
  10. package/dist/customImages/shippedImages.js +6 -4
  11. package/dist/pipeline/generatePipelineFiles.js +23 -14
  12. package/dist/runner-images/semantic-release/Dockerfile +2 -7
  13. package/dist/runner-images/semantic-release/scripts/semanticRelease +18 -1
  14. package/dist/runner-images/semantic-release-central.Dockerfile +34 -0
  15. package/dist/tsconfig.tsbuildinfo +1 -1
  16. package/examples/__snapshots__/automatic-releases.test.ts.snap +261 -2
  17. package/examples/__snapshots__/cloud-run-execute-script-on-deploy.test.ts.snap +256 -1
  18. package/examples/__snapshots__/cloud-run-existing-image.test.ts.snap +256 -1
  19. package/examples/__snapshots__/cloud-run-health-check-defaults.test.ts.snap +256 -1
  20. package/examples/__snapshots__/cloud-run-health-check-only-startup.test.ts.snap +256 -1
  21. package/examples/__snapshots__/cloud-run-health-check.test.ts.snap +256 -1
  22. package/examples/__snapshots__/cloud-run-http2.test.ts.snap +256 -1
  23. package/examples/__snapshots__/cloud-run-llama.test.ts.snap +256 -1
  24. package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +256 -1
  25. package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +256 -1
  26. package/examples/__snapshots__/cloud-run-n8n.test.ts.snap +256 -1
  27. package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +256 -1
  28. package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +256 -1
  29. package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +256 -1
  30. package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +256 -1
  31. package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +256 -1
  32. package/examples/__snapshots__/cloud-run-service-custom-vpc-connector.test.ts.snap +256 -1
  33. package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +256 -1
  34. package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +256 -1
  35. package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +256 -1
  36. package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +256 -1
  37. package/examples/__snapshots__/cloud-run-session-affinity.test.ts.snap +256 -1
  38. package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +256 -1
  39. package/examples/__snapshots__/cloud-run-with-agents.test.ts.snap +256 -1
  40. package/examples/__snapshots__/cloud-run-with-gpu.test.ts.snap +256 -1
  41. package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +256 -1
  42. package/examples/__snapshots__/cloud-run-with-sql-legacy-jobs.test.ts.snap +256 -1
  43. package/examples/__snapshots__/cloud-run-with-sql-multiple-dbs.test.ts.snap +256 -1
  44. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +256 -1
  45. package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +256 -1
  46. package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +256 -1
  47. package/examples/__snapshots__/cloud-run-worker-pool.test.ts.snap +256 -1
  48. package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +256 -1
  49. package/examples/__snapshots__/custom-build-job.test.ts.snap +256 -1
  50. package/examples/__snapshots__/custom-deploy.test.ts.snap +256 -1
  51. package/examples/__snapshots__/custom-docker-file.test.ts.snap +256 -1
  52. package/examples/__snapshots__/custom-envs.test.ts.snap +206 -1
  53. package/examples/__snapshots__/custom-verify-job.test.ts.snap +256 -1
  54. package/examples/__snapshots__/git-submodule.test.ts.snap +256 -1
  55. package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +256 -1
  56. package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +256 -1
  57. package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +256 -1
  58. package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +256 -1
  59. package/examples/__snapshots__/local-dot-env.test.ts.snap +256 -1
  60. package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +256 -1
  61. package/examples/__snapshots__/modify-generated-files.test.ts.snap +206 -1
  62. package/examples/__snapshots__/modify-generated-yaml.test.ts.snap +206 -1
  63. package/examples/__snapshots__/multiline-var.test.ts.snap +280 -25
  64. package/examples/__snapshots__/native-app.test.ts.snap +256 -1
  65. package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +256 -1
  66. package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +256 -1
  67. package/examples/__snapshots__/override-secrets.test.ts.snap +256 -1
  68. package/examples/__snapshots__/pipelines-config.test.ts.snap +256 -1
  69. package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +256 -1
  70. package/examples/__snapshots__/referencing-other-vars.test.ts.snap +270 -15
  71. package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +206 -1
  72. package/examples/__snapshots__/workspace-api-www-turbo-cache.test.ts.snap +256 -1
  73. package/examples/__snapshots__/workspace-api-www.test.ts.snap +256 -1
  74. package/package.json +1 -1
  75. package/src/backends/github/GithubBackend.ts +3 -0
  76. package/src/backends/gitlab/GitlabBackend.ts +15 -9
  77. package/src/backends/gitlab/gitlabReleaseJobs.ts +12 -4
  78. package/src/bash/__tests__/escapeForDotEnv.test.ts +49 -0
  79. package/src/bash/bashEscape.ts +5 -1
  80. package/src/catci/shippedCatci.ts +53 -0
  81. package/src/customImages/shippedImages.ts +6 -6
  82. package/src/pipeline/generatePipelineFiles.ts +3 -0
@@ -184,6 +184,7 @@ var ciVariables_1 = require("./ciVariables");
184
184
  var createGithubJobs_1 = require("./createGithubJobs");
185
185
  var jobImagesPlan_1 = require("../../customImages/jobImagesPlan");
186
186
  var scriptFunctions_1 = require("./scriptFunctions");
187
+ var shippedCatci_1 = require("../../catci/shippedCatci");
187
188
  var utils_1 = require("../../utils");
188
189
  var githubReleaseJobs_1 = require("./githubReleaseJobs");
189
190
  var scriptFiles_1 = require("./scriptFiles");
@@ -268,7 +269,7 @@ var GithubBackend = /** @class */function () {
268
269
  return [4 /*yield*/, this.createWorkflows(config, images, scripts)];
269
270
  case 1:
270
271
  workflows = _a.sent();
271
- return [2 /*return*/, __spreadArray(__spreadArray(__spreadArray([], __read(Object.entries(workflows).map(function (_a) {
272
+ return [2 /*return*/, __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(Object.entries(workflows).map(function (_a) {
272
273
  var _b = __read(_a, 2),
273
274
  fileName = _b[0],
274
275
  workflow = _b[1];
@@ -276,7 +277,7 @@ var GithubBackend = /** @class */function () {
276
277
  path: (0, path_1.join)(WORKFLOWS_FOLDER, fileName),
277
278
  content: workflow
278
279
  };
279
- })), false), __read(scripts.getGeneratedFiles()), false), __read(images.getGeneratedFiles()), false)];
280
+ })), false), __read(scripts.getGeneratedFiles()), false), __read(images.getGeneratedFiles()), false), __read((0, shippedCatci_1.getCatciGeneratedFiles)()), false)];
280
281
  }
281
282
  });
282
283
  });
@@ -173,6 +173,7 @@ var rules_1 = require("../../rules");
173
173
  var config_1 = require("../../types/config");
174
174
  var createAllJobs_1 = require("../../pipeline/createAllJobs");
175
175
  var jobImagesPlan_1 = require("../../customImages/jobImagesPlan");
176
+ var shippedCatci_1 = require("../../catci/shippedCatci");
176
177
  var createGitlabJobs_1 = require("./createGitlabJobs");
177
178
  var createGitlabPipeline_1 = require("./createGitlabPipeline");
178
179
  var gitlabReleaseJobs_1 = require("./gitlabReleaseJobs");
@@ -219,7 +220,7 @@ var GitlabBackend = /** @class */function () {
219
220
  })
220
221
  }
221
222
  };
222
- return [2 /*return*/, __spreadArray(__spreadArray([mainFile], __read(includes), false), __read(images.getGeneratedFiles()), false)];
223
+ return [2 /*return*/, __spreadArray(__spreadArray(__spreadArray([mainFile], __read(includes), false), __read(images.getGeneratedFiles()), false), __read((0, shippedCatci_1.getCatciGeneratedFiles)()), false)];
223
224
  }
224
225
  });
225
226
  });
@@ -295,12 +296,13 @@ var GitlabBackend = /** @class */function () {
295
296
  };
296
297
  GitlabBackend.prototype.createPipeline = function (config, images) {
297
298
  return __awaiter(this, void 0, void 0, function () {
298
- var stages, allJobsPerTrigger, allWorkspaceJobs, allComponentJobs, allGlobalJobs, allContextlessJobs, allJobs;
299
+ var stages, releaseJobs, allJobsPerTrigger, allWorkspaceJobs, allComponentJobs, allGlobalJobs, allContextlessJobs, allJobs;
299
300
  var _this = this;
300
301
  return __generator(this, function (_a) {
301
302
  switch (_a.label) {
302
303
  case 0:
303
304
  stages = (0, getPipelineStages_1.getPipelineStages)(config);
305
+ releaseJobs = (0, gitlabReleaseJobs_1.getGitlabReleaseJobs)(config, images);
304
306
  return [4 /*yield*/, Promise.all(config_1.ALL_PIPELINE_TRIGGERS.map(function (trigger) {
305
307
  return __awaiter(_this, void 0, void 0, function () {
306
308
  var _a;
@@ -384,7 +386,7 @@ var GitlabBackend = /** @class */function () {
384
386
  }, {});
385
387
  return [2 /*return*/, (0, createGitlabPipeline_1.createGitlabPipelineWithDefaults)({
386
388
  stages: __spreadArray(__spreadArray([], __read(stages), false), ["release"], false),
387
- jobs: __assign(__assign({}, allJobs), Object.fromEntries(Object.entries((0, gitlabReleaseJobs_1.getGitlabReleaseJobs)(config)).map(function (_a) {
389
+ jobs: __assign(__assign({}, allJobs), Object.fromEntries(Object.entries(releaseJobs).map(function (_a) {
388
390
  var _b = __read(_a, 2),
389
391
  name = _b[0],
390
392
  gitlabJob = _b[1];
@@ -1,5 +1,6 @@
1
+ import type { JobImagesPlan } from "../../customImages/jobImagesPlan";
1
2
  import type { Config } from "../../types/config";
2
- export declare const getGitlabReleaseJobs: (config: Config) => {
3
+ export declare const getGitlabReleaseJobs: (config: Config, images: JobImagesPlan) => {
3
4
  "create release": {
4
5
  stage: string;
5
6
  image: string;
@@ -36,15 +36,22 @@ Object.defineProperty(exports, "__esModule", {
36
36
  });
37
37
  exports.getGitlabReleaseJobs = void 0;
38
38
  var rules_1 = require("../../rules");
39
- var runner_1 = require("../../runner");
40
39
  var EXPIRED_TOKEN_HELP = "echo '👉 If this job failed with access denied, the project access token might be invald - run `project-renew-token` in catladder CLI to fix.'";
41
40
  var baseReleaseRules = [rules_1.RULE_NEVER_ON_RELEASE_COMMIT, rules_1.RULE_NEVER_ON_AGENT_TRIGGER, rules_1.RULE_NEVER_ON_SCHEDULE];
42
- var getGitlabReleaseJobs = function (config) {
41
+ var getGitlabReleaseJobs = function (config, images) {
43
42
  var _a;
44
43
  var _b;
44
+ // NOTE: only the resolved image url is used, not the `need`: release
45
+ // jobs have no `needs` on purpose — their stage ordering already
46
+ // guarantees the image build job (setup stage) ran, and adding a
47
+ // `needs` would switch gitlab to DAG mode, so the release job would no
48
+ // longer wait for the build/deploy stages.
49
+ var releaseImage = images.resolveRef({
50
+ catladderImage: "semantic-release"
51
+ }).image;
45
52
  return _a = {}, _a["create release"] = {
46
53
  stage: "release",
47
- image: (0, runner_1.getCentralRunnerImageUrl)("semantic-release"),
54
+ image: releaseImage,
48
55
  script: ["semanticRelease"],
49
56
  after_script: [EXPIRED_TOKEN_HELP],
50
57
  rules: __spreadArray(__spreadArray([], __read(baseReleaseRules), false), [{
@@ -56,7 +63,7 @@ var getGitlabReleaseJobs = function (config) {
56
63
  }], false)
57
64
  }, _a["⚠️ force create release"] = {
58
65
  stage: "release",
59
- image: (0, runner_1.getCentralRunnerImageUrl)("semantic-release"),
66
+ image: releaseImage,
60
67
  script: ["semanticRelease"],
61
68
  after_script: [EXPIRED_TOKEN_HELP],
62
69
  needs: [],
@@ -105,8 +105,12 @@ var escapeForDotEnv = function (value, options) {
105
105
  return part instanceof BashExpression_1.BashExpression;
106
106
  });
107
107
  if (!containsAnyBashExpression) {
108
+ // all parts are literal: the value never passes through bash, so it
109
+ // must NOT be bash-escaped — `quotes: "double"` would bake literal
110
+ // \" into the env value (e.g. JSON values, since the deterministic
111
+ // cloud run urls made such values fully literal)
108
112
  return (0, exports.escapeForDotEnv)(value.toString({
109
- quotes: "double"
113
+ quotes: false
110
114
  }));
111
115
  } else {
112
116
  var result = escapeBashExpressionForDotEnv(new BashExpression_1.BashExpression(value.toString({
@@ -0,0 +1,8 @@
1
+ export declare const GENERATED_CATCI_FOLDER = ".catladder-generated/catci";
2
+ /**
3
+ * the catci files to materialize into the generated folder
4
+ */
5
+ export declare const getCatciGeneratedFiles: () => Array<{
6
+ path: string;
7
+ content: string;
8
+ }>;
@@ -0,0 +1,43 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getCatciGeneratedFiles = exports.GENERATED_CATCI_FOLDER = void 0;
7
+ var fs_1 = require("fs");
8
+ var path_1 = require("path");
9
+ exports.GENERATED_CATCI_FOLDER = ".catladder-generated/catci";
10
+ /**
11
+ * the ncc-bundled catci (catladder's CI companion), shipped with the
12
+ * package. Built by the cli workspace (`scripts/bundle`); pipeline
13
+ * generation materializes it into `.catladder-generated/catci/` so CI
14
+ * jobs (e.g. the release job's security audit) can run it with plain
15
+ * `node` — no install step, no catladder baked into job images, and
16
+ * always the exact version that generated the pipeline.
17
+ */
18
+ var getShippedCatciBundle = function () {
19
+ var candidates = [
20
+ // ncc bundle (what consumers run): dist/bundles/<entry> -> dist/bundles/catci
21
+ (0, path_1.join)(__dirname, "..", "catci", "index.js"),
22
+ // cli tsc dist (catenv-dev): dist/pipeline/src/catci -> dist/bundles/catci
23
+ (0, path_1.join)(__dirname, "..", "..", "..", "bundles", "catci", "index.js"),
24
+ // repository (pipeline/src/catci): <root>/cli/dist/bundles/catci
25
+ (0, path_1.join)(__dirname, "..", "..", "..", "cli", "dist", "bundles", "catci", "index.js")];
26
+ var found = candidates.find(function (candidate) {
27
+ return (0, fs_1.existsSync)(candidate);
28
+ });
29
+ if (!found) {
30
+ throw new Error("shipped catci bundle not found — run a full catladder build (`yarn build`) first");
31
+ }
32
+ return found;
33
+ };
34
+ /**
35
+ * the catci files to materialize into the generated folder
36
+ */
37
+ var getCatciGeneratedFiles = function () {
38
+ return [{
39
+ path: (0, path_1.join)(exports.GENERATED_CATCI_FOLDER, "index.js"),
40
+ content: (0, fs_1.readFileSync)(getShippedCatciBundle(), "utf-8")
41
+ }];
42
+ };
43
+ exports.getCatciGeneratedFiles = getCatciGeneratedFiles;
package/dist/constants.js CHANGED
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
7
- exports.PIPELINE_IMAGE_TAG = "next-52feb889" || "latest";
7
+ exports.PIPELINE_IMAGE_TAG = "next-c177efda" || "latest";
8
8
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
@@ -13,9 +13,11 @@ export declare const RUNNER_IMAGE_DEPENDENCIES: Partial<Record<RunnerImageName,
13
13
  */
14
14
  /**
15
15
  * images that cannot be built from the shipped definitions and always
16
- * come from the central registry: semantic-release bakes catladder's
17
- * own cli sources into the image (repo-root build context).
18
- * TODO: make the semantic-release image self-contained.
16
+ * come from the central registry. Empty since the semantic-release
17
+ * image became self-contained (the security audit runs the
18
+ * materialized catci bundle instead of a baked-in catladder cli) —
19
+ * kept as the escape hatch should an image ever need central-only
20
+ * treatment again.
19
21
  */
20
22
  export declare const CENTRAL_ONLY_IMAGES: ReadonlySet<RunnerImageName>;
21
23
  export declare const RUNNER_IMAGE_BUILD_CONTEXT: Record<RunnerImageName, "root" | "self">;
@@ -23,11 +23,13 @@ exports.RUNNER_IMAGE_DEPENDENCIES = {
23
23
  */
24
24
  /**
25
25
  * images that cannot be built from the shipped definitions and always
26
- * come from the central registry: semantic-release bakes catladder's
27
- * own cli sources into the image (repo-root build context).
28
- * TODO: make the semantic-release image self-contained.
26
+ * come from the central registry. Empty since the semantic-release
27
+ * image became self-contained (the security audit runs the
28
+ * materialized catci bundle instead of a baked-in catladder cli) —
29
+ * kept as the escape hatch should an image ever need central-only
30
+ * treatment again.
29
31
  */
30
- exports.CENTRAL_ONLY_IMAGES = new Set(["semantic-release"]);
32
+ exports.CENTRAL_ONLY_IMAGES = new Set();
31
33
  exports.RUNNER_IMAGE_BUILD_CONTEXT = {
32
34
  "jobs-default": "root",
33
35
  "jobs-meteor": "root",
@@ -140,6 +140,7 @@ var path_1 = require("path");
140
140
  var backends_1 = require("../backends");
141
141
  var gitlab_1 = require("../backends/gitlab");
142
142
  var jobImagesPlan_1 = require("../customImages/jobImagesPlan");
143
+ var shippedCatci_1 = require("../catci/shippedCatci");
143
144
  /**
144
145
  * generates the pipeline files of all pipeline types enabled in the
145
146
  * config (see `pipelines`). Pass an explicit `pipelineType` to generate
@@ -153,7 +154,7 @@ function generatePipelineFiles(context, pipelineType) {
153
154
  switch (_b.label) {
154
155
  case 0:
155
156
  pipelineTypes = pipelineType ? [pipelineType] : (0, backends_1.getEnabledPipelineTypes)(context.config);
156
- if (!!pipelineType) return [3 /*break*/, 2];
157
+ if (!!pipelineType) return [3 /*break*/, 3];
157
158
  // the materialized image definitions are a union across all enabled
158
159
  // backends and no single backend may wipe them — cleaned once per
159
160
  // full generation, so images that fell out of use don't linger (and
@@ -168,37 +169,45 @@ function generatePipelineFiles(context, pipelineType) {
168
169
  // full generation, so images that fell out of use don't linger (and
169
170
  // keep triggering gitlab's rules:changes)
170
171
  _b.sent();
171
- _b.label = 2;
172
+ // same for the materialized catci bundle (union across backends)
173
+ return [4 /*yield*/, (0, promises_1.rm)(shippedCatci_1.GENERATED_CATCI_FOLDER, {
174
+ recursive: true,
175
+ force: true
176
+ })];
172
177
  case 2:
173
- _b.trys.push([2, 7, 8, 9]);
174
- pipelineTypes_1 = __values(pipelineTypes), pipelineTypes_1_1 = pipelineTypes_1.next();
178
+ // same for the materialized catci bundle (union across backends)
179
+ _b.sent();
175
180
  _b.label = 3;
176
181
  case 3:
177
- if (!!pipelineTypes_1_1.done) return [3 /*break*/, 6];
182
+ _b.trys.push([3, 8, 9, 10]);
183
+ pipelineTypes_1 = __values(pipelineTypes), pipelineTypes_1_1 = pipelineTypes_1.next();
184
+ _b.label = 4;
185
+ case 4:
186
+ if (!!pipelineTypes_1_1.done) return [3 /*break*/, 7];
178
187
  type = pipelineTypes_1_1.value;
179
188
  return [4 /*yield*/, generatePipelineFilesForBackend(context, (0, backends_1.getPipelineBackend)(type))];
180
- case 4:
181
- _b.sent();
182
- _b.label = 5;
183
189
  case 5:
184
- pipelineTypes_1_1 = pipelineTypes_1.next();
185
- return [3 /*break*/, 3];
190
+ _b.sent();
191
+ _b.label = 6;
186
192
  case 6:
187
- return [3 /*break*/, 9];
193
+ pipelineTypes_1_1 = pipelineTypes_1.next();
194
+ return [3 /*break*/, 4];
188
195
  case 7:
196
+ return [3 /*break*/, 10];
197
+ case 8:
189
198
  e_1_1 = _b.sent();
190
199
  e_1 = {
191
200
  error: e_1_1
192
201
  };
193
- return [3 /*break*/, 9];
194
- case 8:
202
+ return [3 /*break*/, 10];
203
+ case 9:
195
204
  try {
196
205
  if (pipelineTypes_1_1 && !pipelineTypes_1_1.done && (_a = pipelineTypes_1.return)) _a.call(pipelineTypes_1);
197
206
  } finally {
198
207
  if (e_1) throw e_1.error;
199
208
  }
200
209
  return [7 /*endfinally*/];
201
- case 9:
210
+ case 10:
202
211
  return [2 /*return*/];
203
212
  }
204
213
  });
@@ -1,11 +1,7 @@
1
- # build context is the root directory
2
1
  FROM node:lts-alpine
3
2
 
4
3
  RUN apk add --no-cache bash git git-lfs
5
4
 
6
- RUN mkdir /packages
7
- COPY ./cli /packages/cli
8
-
9
5
  # add semantic release
10
6
  RUN yarn global add \
11
7
  semantic-release@^19 \
@@ -14,11 +10,10 @@ RUN yarn global add \
14
10
  https://github.com/panter/git.git#b4037626cc583d3e9f7995ea0604b23730d0a22e \
15
11
  @semantic-release/changelog \
16
12
  @semantic-release/gitlab@9 \
17
- @semantic-release/exec@6 \
18
- /packages/cli
13
+ @semantic-release/exec@6
19
14
 
20
15
  RUN mkdir -p /scripts
21
- COPY ./runner-images/semantic-release/scripts/* /scripts/
16
+ COPY ./scripts/* /scripts/
22
17
  RUN chmod +x /scripts/*
23
18
 
24
19
  ENV PATH="/scripts:${PATH}"
@@ -9,7 +9,24 @@ set -e
9
9
  # better branches settings: https://github.com/semantic-release/semantic-release/issues/1581
10
10
 
11
11
  echo "doing security audit check"
12
- catladder security audit ci-job ./ "$GL_TOKEN" "$CI_DEFAULT_BRANCH" "$CI_PROJECT_ID" "$GITLAB_USER_ID"
12
+ CATCI=".catladder-generated/catci/index.js"
13
+ if [ -f "$CATCI" ]; then
14
+ # catci is materialized by pipeline generation — always the exact
15
+ # catladder version that generated this pipeline
16
+ if [ "$GITHUB_ACTIONS" = "true" ]; then
17
+ # github: gate only — the MR remediation is gitlab-specific
18
+ node "$CATCI" security-audit check ./
19
+ else
20
+ node "$CATCI" security-audit ci-job ./ "$GL_TOKEN" "$CI_DEFAULT_BRANCH" "$CI_PROJECT_ID" "$GITLAB_USER_ID"
21
+ fi
22
+ elif command -v catladder > /dev/null 2>&1; then
23
+ # repos generated by old catladder versions (no materialized catci):
24
+ # the central image still bakes the cli in
25
+ catladder security audit ci-job ./ "$GL_TOKEN" "$CI_DEFAULT_BRANCH" "$CI_PROJECT_ID" "$GITLAB_USER_ID"
26
+ else
27
+ echo "neither $CATCI nor the catladder cli found — regenerate the pipeline with a current catladder version (catenv)"
28
+ exit 1
29
+ fi
13
30
 
14
31
  echo "doing semantic release"
15
32
 
@@ -0,0 +1,34 @@
1
+ # LEGACY-COMPAT build of the semantic-release image for the CENTRAL
2
+ # registry only (build context: repo root, see .gitlab-ci-yaml-custom.yaml).
3
+ #
4
+ # The shipped definition (semantic-release/Dockerfile) is self-contained:
5
+ # repos generated by current catladder run the security audit via the
6
+ # materialized `.catladder-generated/catci/` bundle. But the central
7
+ # `:latest` tag is shared with repos on OLD catladder versions whose
8
+ # generated pipelines expect `catladder` on the PATH — so the central
9
+ # build additionally bakes the cli in, exactly as before.
10
+ #
11
+ # Delete together with the central registry / central mode.
12
+ FROM node:lts-alpine
13
+
14
+ RUN apk add --no-cache bash git git-lfs
15
+
16
+ RUN mkdir /packages
17
+ COPY ./cli /packages/cli
18
+
19
+ # add semantic release
20
+ RUN yarn global add \
21
+ semantic-release@^19 \
22
+ @semantic-release/commit-analyzer \
23
+ @semantic-release/release-notes-generator \
24
+ https://github.com/panter/git.git#b4037626cc583d3e9f7995ea0604b23730d0a22e \
25
+ @semantic-release/changelog \
26
+ @semantic-release/gitlab@9 \
27
+ @semantic-release/exec@6 \
28
+ /packages/cli
29
+
30
+ RUN mkdir -p /scripts
31
+ COPY ./runner-images/semantic-release/scripts/* /scripts/
32
+ RUN chmod +x /scripts/*
33
+
34
+ ENV PATH="/scripts:${PATH}"