@catladder/pipeline 1.163.0 → 1.163.2

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 (78) hide show
  1. package/README.md +15 -1
  2. package/dist/bundles/catladder-gitlab/index.js +2 -2
  3. package/dist/constants.js +1 -1
  4. package/dist/pipeline/generatePipelineFiles.d.ts +38 -0
  5. package/dist/pipeline/generatePipelineFiles.js +44 -23
  6. package/dist/tsconfig.tsbuildinfo +1 -1
  7. package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +1335 -1952
  8. package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +1319 -1928
  9. package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +1335 -1952
  10. package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +1387 -2004
  11. package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +1335 -1952
  12. package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +1346 -1963
  13. package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +1335 -1952
  14. package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +1335 -1952
  15. package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +1379 -1996
  16. package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +1219 -1668
  17. package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +1335 -1952
  18. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +2815 -3924
  19. package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +2562 -3447
  20. package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +1343 -1960
  21. package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +1190 -1780
  22. package/examples/__snapshots__/custom-build-job.test.ts.snap +1079 -1480
  23. package/examples/__snapshots__/custom-deploy.test.ts.snap +1101 -1718
  24. package/examples/__snapshots__/custom-envs.test.ts.snap +707 -1172
  25. package/examples/__snapshots__/custom-sbom-java.test.ts.snap +1087 -1488
  26. package/examples/__snapshots__/git-submodule.test.ts.snap +1336 -1955
  27. package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +1772 -2443
  28. package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.test.ts.snap +1784 -2455
  29. package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +1792 -2463
  30. package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +3342 -4547
  31. package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +1896 -2567
  32. package/examples/__snapshots__/local-dot-env.test.ts.snap +1335 -1952
  33. package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +1833 -2496
  34. package/examples/__snapshots__/multiline-var.test.ts.snap +3295 -4406
  35. package/examples/__snapshots__/native-app.test.ts.snap +2143 -3160
  36. package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +1335 -1952
  37. package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +1343 -1960
  38. package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +1479 -2003
  39. package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +1464 -1988
  40. package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +1273 -2102
  41. package/examples/__utils__/helpers.ts +14 -1
  42. package/examples/cloud-run-memory-limit.test.ts +4 -3
  43. package/examples/cloud-run-meteor-with-worker.test.ts +4 -3
  44. package/examples/cloud-run-no-cpu-throttling.test.ts +4 -3
  45. package/examples/cloud-run-no-service.test.ts +4 -3
  46. package/examples/cloud-run-non-public.test.ts +4 -3
  47. package/examples/cloud-run-post-stop-job.test.ts +4 -3
  48. package/examples/cloud-run-service-gen2.test.ts +4 -3
  49. package/examples/cloud-run-service-increase-timout.test.ts +4 -3
  50. package/examples/cloud-run-service-with-volumes.test.ts +4 -3
  51. package/examples/cloud-run-storybook.test.ts +4 -3
  52. package/examples/cloud-run-with-ngnix.test.ts +4 -3
  53. package/examples/cloud-run-with-sql-reuse-db.test.ts +4 -3
  54. package/examples/cloud-run-with-sql.test.ts +4 -3
  55. package/examples/cloud-run-with-worker.test.ts +4 -3
  56. package/examples/custom-build-job-with-tests.test.ts +4 -3
  57. package/examples/custom-build-job.test.ts +4 -3
  58. package/examples/custom-deploy.test.ts +4 -3
  59. package/examples/custom-envs.test.ts +4 -3
  60. package/examples/custom-sbom-java.test.ts +4 -3
  61. package/examples/git-submodule.test.ts +4 -3
  62. package/examples/kubernetes-application-customization.test.ts +4 -3
  63. package/examples/kubernetes-with-cloud-sql-legacy.test.ts +4 -3
  64. package/examples/kubernetes-with-cloud-sql.test.ts +4 -3
  65. package/examples/kubernetes-with-jobs.test.ts +4 -3
  66. package/examples/kubernetes-with-mongodb.test.ts +4 -3
  67. package/examples/local-dot-env.test.ts +4 -3
  68. package/examples/meteor-kubernetes.test.ts +4 -3
  69. package/examples/multiline-var.test.ts +4 -3
  70. package/examples/native-app.test.ts +4 -3
  71. package/examples/node-build-with-custom-image.test.ts +4 -3
  72. package/examples/node-build-with-docker-additions.test.ts +4 -3
  73. package/examples/rails-k8s-with-worker-dockerfile.test.ts +2 -2
  74. package/examples/rails-k8s-with-worker.test.ts +4 -3
  75. package/examples/wait-for-other-deploy.test.ts +4 -3
  76. package/package.json +4 -3
  77. package/scripts/generate-examples-test.ts +7 -7
  78. package/src/pipeline/generatePipelineFiles.ts +61 -36
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 = "v1-163-0-b6a34df9" || "latest";
7
+ exports.PIPELINE_IMAGE_TAG = "v1-163-2-91030383" || "latest";
8
8
  exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "git.panter.ch:5001/catladder/catladder";
@@ -1,2 +1,40 @@
1
1
  import type { Config, PipelineMode, PipelineType } from "../types";
2
+ export declare function generateChildPipelineContent<T extends PipelineType>(config: Config, pipelineType: T): Promise<{
3
+ image: string;
4
+ stages: string[];
5
+ variables: import("../types/gitlab-ci-yml").JobVariables1 | undefined;
6
+ workflow: {
7
+ rules: {
8
+ if?: string | undefined;
9
+ changes?: import("../types/gitlab-ci-yml").Changes | undefined;
10
+ exists?: import("../types/gitlab-ci-yml").Exists | undefined;
11
+ variables?: import("../types/gitlab-ci-yml").RulesVariables | undefined;
12
+ when?: import("../types/gitlab-ci-yml").When | undefined;
13
+ start_in?: string | undefined;
14
+ allow_failure?: import("../types/gitlab-ci-yml").AllowFailure | undefined;
15
+ needs?: import("../types/gitlab-ci-yml").RulesNeeds | undefined;
16
+ }[];
17
+ } | undefined;
18
+ } & Omit<import("../types").Pipeline<T>, "image" | "jobs" | "variables" | "workflow" | "stages"> & {
19
+ [k: string]: import("../types").GitlabJobDef;
20
+ }>;
21
+ export declare function generateLocalPipelineContent<T extends PipelineType>(config: Config, pipelineType: T): Promise<{
22
+ image: string;
23
+ stages: string[];
24
+ variables: import("../types/gitlab-ci-yml").JobVariables1 | undefined;
25
+ workflow: {
26
+ rules: {
27
+ if?: string | undefined;
28
+ changes?: import("../types/gitlab-ci-yml").Changes | undefined;
29
+ exists?: import("../types/gitlab-ci-yml").Exists | undefined;
30
+ variables?: import("../types/gitlab-ci-yml").RulesVariables | undefined;
31
+ when?: import("../types/gitlab-ci-yml").When | undefined;
32
+ start_in?: string | undefined;
33
+ allow_failure?: import("../types/gitlab-ci-yml").AllowFailure | undefined;
34
+ needs?: import("../types/gitlab-ci-yml").RulesNeeds | undefined;
35
+ }[];
36
+ } | undefined;
37
+ } & Omit<import("../types").Pipeline<T>, "image" | "jobs" | "variables" | "workflow" | "stages"> & {
38
+ [k: string]: import("../types").GitlabJobDef;
39
+ }>;
2
40
  export declare function generatePipelineFiles<T extends PipelineType>(config: Config, pipelineType: T, mode: PipelineMode<T>): Promise<void>;
@@ -158,62 +158,83 @@ var __read = this && this.__read || function (o, n) {
158
158
  Object.defineProperty(exports, "__esModule", {
159
159
  value: true
160
160
  });
161
- exports.generatePipelineFiles = void 0;
161
+ exports.generatePipelineFiles = exports.generateLocalPipelineContent = exports.generateChildPipelineContent = void 0;
162
162
  var writeFiles_1 = require("../utils/writeFiles");
163
163
  var createChildPipeline_1 = require("./createChildPipeline");
164
164
  var createMainPipeline_1 = require("./createMainPipeline");
165
165
  var getPipelineTriggerForGitlabChildPipeline_1 = require("./gitlab/getPipelineTriggerForGitlabChildPipeline");
166
166
  var sortGitLabJobDefProps_1 = require("./gitlab/sortGitLabJobDefProps");
167
- function generatePipelineFiles(config, pipelineType, mode) {
167
+ function generateChildPipelineContent(config, pipelineType) {
168
168
  return __awaiter(this, void 0, void 0, function () {
169
- var trigger, _a, jobs, image, stages, variables, workflow, pipelineRest, jobsWithSortedProps, _b, jobs, image, stages, variables, workflow, pipelineRest, jobsWithSortedProps;
170
- return __generator(this, function (_c) {
171
- switch (_c.label) {
169
+ var trigger, _a, jobs, image, stages, variables, workflow, pipelineRest, jobsWithSortedProps;
170
+ return __generator(this, function (_b) {
171
+ switch (_b.label) {
172
172
  case 0:
173
- if (!(mode === "childpipeline")) return [3 /*break*/, 3];
174
173
  trigger = (0, getPipelineTriggerForGitlabChildPipeline_1.getPipelineTriggerForGitlabChildPipeline)();
175
174
  return [4 /*yield*/, (0, createChildPipeline_1.createChildPipeline)(pipelineType, trigger, config)];
176
175
  case 1:
177
- _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"]);
176
+ _a = _b.sent(), jobs = _a.jobs, image = _a.image, stages = _a.stages, variables = _a.variables, workflow = _a.workflow, pipelineRest = __rest(_a, ["jobs", "image", "stages", "variables", "workflow"]);
178
177
  jobsWithSortedProps = Object.fromEntries(Object.entries(jobs).map(function (_a) {
179
178
  var _b = __read(_a, 2),
180
179
  jobName = _b[0],
181
180
  job = _b[1];
182
181
  return [jobName, (0, sortGitLabJobDefProps_1.sortGitLabJobDefProps)(job)];
183
182
  }));
184
- return [4 /*yield*/, (0, writeFiles_1.writeYamlfile)("__pipeline.yml", __assign(__assign({
183
+ return [2 /*return*/, __assign(__assign({
185
184
  image: image,
186
185
  stages: stages,
187
186
  variables: variables,
188
187
  workflow: workflow
189
- }, pipelineRest), jobsWithSortedProps))];
190
- case 2:
191
- _c.sent();
192
- return [3 /*break*/, 6];
193
- case 3:
188
+ }, pipelineRest), jobsWithSortedProps)];
189
+ }
190
+ });
191
+ });
192
+ }
193
+ exports.generateChildPipelineContent = generateChildPipelineContent;
194
+ function generateLocalPipelineContent(config, pipelineType) {
195
+ return __awaiter(this, void 0, void 0, function () {
196
+ var _a, jobs, image, stages, variables, workflow, pipelineRest, jobsWithSortedProps;
197
+ return __generator(this, function (_b) {
198
+ switch (_b.label) {
199
+ case 0:
194
200
  return [4 /*yield*/, (0, createMainPipeline_1.createMainPipeline)(pipelineType, config)];
195
- case 4:
196
- _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"]);
201
+ case 1:
202
+ _a = _b.sent(), jobs = _a.jobs, image = _a.image, stages = _a.stages, variables = _a.variables, workflow = _a.workflow, pipelineRest = __rest(_a, ["jobs", "image", "stages", "variables", "workflow"]);
197
203
  jobsWithSortedProps = Object.fromEntries(Object.entries(jobs).map(function (_a) {
198
204
  var _b = __read(_a, 2),
199
205
  jobName = _b[0],
200
206
  job = _b[1];
201
207
  return [jobName, (0, sortGitLabJobDefProps_1.sortGitLabJobDefProps)(job)];
202
208
  }));
203
- return [4 /*yield*/, (0, writeFiles_1.writeYamlfile)(".gitlab-ci.yml", __assign(__assign({
209
+ return [2 /*return*/, __assign(__assign({
204
210
  image: image,
205
211
  stages: stages,
206
212
  variables: variables,
207
213
  workflow: workflow
208
- }, pipelineRest), jobsWithSortedProps))];
209
- case 5:
210
- _c.sent();
211
- _c.label = 6;
212
- case 6:
213
- return [2 /*return*/];
214
+ }, pipelineRest), jobsWithSortedProps)];
215
+ }
216
+ });
217
+ });
218
+ }
219
+ exports.generateLocalPipelineContent = generateLocalPipelineContent;
220
+ function generatePipelineFiles(config, pipelineType, mode) {
221
+ return __awaiter(this, void 0, void 0, function () {
222
+ var pipelineContent_1, pipelineContent;
223
+ return __generator(this, function (_a) {
224
+ switch (_a.label) {
225
+ case 0:
226
+ if (!(mode === "childpipeline")) return [3 /*break*/, 2];
227
+ return [4 /*yield*/, generateChildPipelineContent(config, pipelineType)];
228
+ case 1:
229
+ pipelineContent_1 = _a.sent();
230
+ return [2 /*return*/, (0, writeFiles_1.writeYamlfile)("__pipeline.yml", pipelineContent_1)];
231
+ case 2:
232
+ return [4 /*yield*/, generateLocalPipelineContent(config, pipelineType)];
233
+ case 3:
234
+ pipelineContent = _a.sent();
235
+ return [2 /*return*/, (0, writeFiles_1.writeYamlfile)(".gitlab-ci.yml", pipelineContent)];
214
236
  }
215
237
  });
216
238
  });
217
239
  }
218
-
219
240
  exports.generatePipelineFiles = generatePipelineFiles;