@catladder/pipeline 1.162.0 → 1.163.1

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 (80) hide show
  1. package/README.md +15 -1
  2. package/dist/build/types.d.ts +6 -0
  3. package/dist/bundles/catladder-gitlab/index.js +2 -2
  4. package/dist/constants.js +1 -1
  5. package/dist/pipeline/generatePipelineFiles.d.ts +38 -0
  6. package/dist/pipeline/generatePipelineFiles.js +44 -23
  7. package/dist/tsconfig.tsbuildinfo +1 -1
  8. package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +1341 -0
  9. package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +1325 -0
  10. package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +1341 -0
  11. package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +1393 -0
  12. package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +1341 -0
  13. package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +1352 -0
  14. package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +1341 -0
  15. package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +1341 -0
  16. package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +1385 -0
  17. package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +1233 -4
  18. package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +1349 -4
  19. package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +2825 -0
  20. package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +2572 -0
  21. package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +1349 -0
  22. package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +1196 -0
  23. package/examples/__snapshots__/custom-build-job.test.ts.snap +1085 -0
  24. package/examples/__snapshots__/custom-deploy.test.ts.snap +1103 -0
  25. package/examples/__snapshots__/custom-envs.test.ts.snap +709 -0
  26. package/examples/__snapshots__/custom-sbom-java.test.ts.snap +1093 -0
  27. package/examples/__snapshots__/git-submodule.test.ts.snap +1342 -0
  28. package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +1778 -0
  29. package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.test.ts.snap +1790 -0
  30. package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +1798 -0
  31. package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +3352 -0
  32. package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +1902 -0
  33. package/examples/__snapshots__/local-dot-env.test.ts.snap +1341 -0
  34. package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +1839 -0
  35. package/examples/__snapshots__/multiline-var.test.ts.snap +3376 -0
  36. package/examples/__snapshots__/native-app.test.ts.snap +2149 -0
  37. package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +1341 -0
  38. package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +1349 -0
  39. package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +1470 -0
  40. package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +1275 -0
  41. package/examples/__utils__/helpers.ts +14 -1
  42. package/examples/cloud-run-memory-limit.test.ts +9 -1
  43. package/examples/cloud-run-meteor-with-worker.test.ts +9 -1
  44. package/examples/cloud-run-no-cpu-throttling.test.ts +9 -1
  45. package/examples/cloud-run-no-service.test.ts +9 -1
  46. package/examples/cloud-run-non-public.test.ts +9 -1
  47. package/examples/cloud-run-post-stop-job.test.ts +9 -1
  48. package/examples/cloud-run-service-gen2.test.ts +9 -1
  49. package/examples/cloud-run-service-increase-timout.test.ts +9 -1
  50. package/examples/cloud-run-service-with-volumes.test.ts +9 -1
  51. package/examples/cloud-run-storybook.test.ts +9 -1
  52. package/examples/cloud-run-storybook.ts +9 -1
  53. package/examples/cloud-run-with-ngnix.test.ts +9 -1
  54. package/examples/cloud-run-with-ngnix.ts +5 -1
  55. package/examples/cloud-run-with-sql-reuse-db.test.ts +9 -1
  56. package/examples/cloud-run-with-sql.test.ts +9 -1
  57. package/examples/cloud-run-with-worker.test.ts +9 -1
  58. package/examples/custom-build-job-with-tests.test.ts +9 -1
  59. package/examples/custom-build-job.test.ts +9 -1
  60. package/examples/custom-deploy.test.ts +9 -1
  61. package/examples/custom-envs.test.ts +9 -1
  62. package/examples/custom-sbom-java.test.ts +9 -1
  63. package/examples/git-submodule.test.ts +9 -1
  64. package/examples/kubernetes-application-customization.test.ts +9 -1
  65. package/examples/kubernetes-with-cloud-sql-legacy.test.ts +9 -1
  66. package/examples/kubernetes-with-cloud-sql.test.ts +9 -1
  67. package/examples/kubernetes-with-jobs.test.ts +9 -1
  68. package/examples/kubernetes-with-mongodb.test.ts +9 -1
  69. package/examples/local-dot-env.test.ts +9 -1
  70. package/examples/meteor-kubernetes.test.ts +9 -1
  71. package/examples/multiline-var.test.ts +9 -1
  72. package/examples/native-app.test.ts +9 -1
  73. package/examples/node-build-with-custom-image.test.ts +9 -1
  74. package/examples/node-build-with-docker-additions.test.ts +9 -1
  75. package/examples/rails-k8s-with-worker.test.ts +9 -1
  76. package/examples/wait-for-other-deploy.test.ts +9 -1
  77. package/package.json +4 -3
  78. package/scripts/generate-examples-test.ts +7 -5
  79. package/src/build/types.ts +6 -0
  80. 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-162-0-bf5373f5" || "latest";
7
+ exports.PIPELINE_IMAGE_TAG = "v1-163-1-125bb5fd" || "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;