@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.
- package/README.md +15 -1
- package/dist/bundles/catladder-gitlab/index.js +2 -2
- package/dist/constants.js +1 -1
- package/dist/pipeline/generatePipelineFiles.d.ts +38 -0
- package/dist/pipeline/generatePipelineFiles.js +44 -23
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +1335 -1952
- package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +1319 -1928
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +1335 -1952
- package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +1387 -2004
- package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +1335 -1952
- package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +1346 -1963
- package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +1335 -1952
- package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +1335 -1952
- package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +1379 -1996
- package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +1219 -1668
- package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +1335 -1952
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +2815 -3924
- package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +2562 -3447
- package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +1343 -1960
- package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +1190 -1780
- package/examples/__snapshots__/custom-build-job.test.ts.snap +1079 -1480
- package/examples/__snapshots__/custom-deploy.test.ts.snap +1101 -1718
- package/examples/__snapshots__/custom-envs.test.ts.snap +707 -1172
- package/examples/__snapshots__/custom-sbom-java.test.ts.snap +1087 -1488
- package/examples/__snapshots__/git-submodule.test.ts.snap +1336 -1955
- package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +1772 -2443
- package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.test.ts.snap +1784 -2455
- package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +1792 -2463
- package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +3342 -4547
- package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +1896 -2567
- package/examples/__snapshots__/local-dot-env.test.ts.snap +1335 -1952
- package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +1833 -2496
- package/examples/__snapshots__/multiline-var.test.ts.snap +3295 -4406
- package/examples/__snapshots__/native-app.test.ts.snap +2143 -3160
- package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +1335 -1952
- package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +1343 -1960
- package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +1479 -2003
- package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +1464 -1988
- package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +1273 -2102
- package/examples/__utils__/helpers.ts +14 -1
- package/examples/cloud-run-memory-limit.test.ts +4 -3
- package/examples/cloud-run-meteor-with-worker.test.ts +4 -3
- package/examples/cloud-run-no-cpu-throttling.test.ts +4 -3
- package/examples/cloud-run-no-service.test.ts +4 -3
- package/examples/cloud-run-non-public.test.ts +4 -3
- package/examples/cloud-run-post-stop-job.test.ts +4 -3
- package/examples/cloud-run-service-gen2.test.ts +4 -3
- package/examples/cloud-run-service-increase-timout.test.ts +4 -3
- package/examples/cloud-run-service-with-volumes.test.ts +4 -3
- package/examples/cloud-run-storybook.test.ts +4 -3
- package/examples/cloud-run-with-ngnix.test.ts +4 -3
- package/examples/cloud-run-with-sql-reuse-db.test.ts +4 -3
- package/examples/cloud-run-with-sql.test.ts +4 -3
- package/examples/cloud-run-with-worker.test.ts +4 -3
- package/examples/custom-build-job-with-tests.test.ts +4 -3
- package/examples/custom-build-job.test.ts +4 -3
- package/examples/custom-deploy.test.ts +4 -3
- package/examples/custom-envs.test.ts +4 -3
- package/examples/custom-sbom-java.test.ts +4 -3
- package/examples/git-submodule.test.ts +4 -3
- package/examples/kubernetes-application-customization.test.ts +4 -3
- package/examples/kubernetes-with-cloud-sql-legacy.test.ts +4 -3
- package/examples/kubernetes-with-cloud-sql.test.ts +4 -3
- package/examples/kubernetes-with-jobs.test.ts +4 -3
- package/examples/kubernetes-with-mongodb.test.ts +4 -3
- package/examples/local-dot-env.test.ts +4 -3
- package/examples/meteor-kubernetes.test.ts +4 -3
- package/examples/multiline-var.test.ts +4 -3
- package/examples/native-app.test.ts +4 -3
- package/examples/node-build-with-custom-image.test.ts +4 -3
- package/examples/node-build-with-docker-additions.test.ts +4 -3
- package/examples/rails-k8s-with-worker-dockerfile.test.ts +2 -2
- package/examples/rails-k8s-with-worker.test.ts +4 -3
- package/examples/wait-for-other-deploy.test.ts +4 -3
- package/package.json +4 -3
- package/scripts/generate-examples-test.ts +7 -7
- package/src/pipeline/generatePipelineFiles.ts +61 -36
|
@@ -4,48 +4,73 @@ import { createChildPipeline } from "./createChildPipeline";
|
|
|
4
4
|
import { createMainPipeline } from "./createMainPipeline";
|
|
5
5
|
import { getPipelineTriggerForGitlabChildPipeline } from "./gitlab/getPipelineTriggerForGitlabChildPipeline";
|
|
6
6
|
import { sortGitLabJobDefProps } from "./gitlab/sortGitLabJobDefProps";
|
|
7
|
+
|
|
8
|
+
export async function generateChildPipelineContent<T extends PipelineType>(
|
|
9
|
+
config: Config,
|
|
10
|
+
pipelineType: T,
|
|
11
|
+
) {
|
|
12
|
+
const trigger = getPipelineTriggerForGitlabChildPipeline();
|
|
13
|
+
const { jobs, image, stages, variables, workflow, ...pipelineRest } =
|
|
14
|
+
await createChildPipeline(pipelineType, trigger, config);
|
|
15
|
+
|
|
16
|
+
const jobsWithSortedProps = Object.fromEntries(
|
|
17
|
+
Object.entries(jobs).map(([jobName, job]) => [
|
|
18
|
+
jobName,
|
|
19
|
+
sortGitLabJobDefProps(job),
|
|
20
|
+
]),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
return {
|
|
24
|
+
image,
|
|
25
|
+
stages,
|
|
26
|
+
variables,
|
|
27
|
+
workflow,
|
|
28
|
+
...pipelineRest,
|
|
29
|
+
// jobs need to be spread into main YAML, because GitLab pipeline YAML has no jobs key - jobs are top level with their key as their name
|
|
30
|
+
...jobsWithSortedProps,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export async function generateLocalPipelineContent<T extends PipelineType>(
|
|
35
|
+
config: Config,
|
|
36
|
+
pipelineType: T,
|
|
37
|
+
) {
|
|
38
|
+
const { jobs, image, stages, variables, workflow, ...pipelineRest } =
|
|
39
|
+
await createMainPipeline(pipelineType, config);
|
|
40
|
+
|
|
41
|
+
const jobsWithSortedProps = Object.fromEntries(
|
|
42
|
+
Object.entries(jobs).map(([jobName, job]) => [
|
|
43
|
+
jobName,
|
|
44
|
+
sortGitLabJobDefProps(job),
|
|
45
|
+
]),
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
image,
|
|
50
|
+
stages,
|
|
51
|
+
variables,
|
|
52
|
+
workflow,
|
|
53
|
+
...pipelineRest,
|
|
54
|
+
// jobs need to be spread into main YAML, because GitLab pipeline YAML has no jobs key - jobs are top level with their key as their name
|
|
55
|
+
...jobsWithSortedProps,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
7
59
|
export async function generatePipelineFiles<T extends PipelineType>(
|
|
8
60
|
config: Config,
|
|
9
61
|
pipelineType: T,
|
|
10
62
|
mode: PipelineMode<T>,
|
|
11
63
|
) {
|
|
12
64
|
if (mode === "childpipeline") {
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
await createChildPipeline(pipelineType, trigger, config);
|
|
17
|
-
const jobsWithSortedProps = Object.fromEntries(
|
|
18
|
-
Object.entries(jobs).map(([jobName, job]) => [
|
|
19
|
-
jobName,
|
|
20
|
-
sortGitLabJobDefProps(job),
|
|
21
|
-
]),
|
|
22
|
-
);
|
|
23
|
-
await writeYamlfile(`__pipeline.yml`, {
|
|
24
|
-
image,
|
|
25
|
-
stages,
|
|
26
|
-
variables,
|
|
27
|
-
workflow,
|
|
28
|
-
...pipelineRest,
|
|
29
|
-
// jobs need to be spread into main YAML, because GitLab pipeline YAML has no jobs key - jobs are top level with their key as their name
|
|
30
|
-
...jobsWithSortedProps,
|
|
31
|
-
});
|
|
32
|
-
} else {
|
|
33
|
-
const { jobs, image, stages, variables, workflow, ...pipelineRest } =
|
|
34
|
-
await createMainPipeline(pipelineType, config);
|
|
35
|
-
const jobsWithSortedProps = Object.fromEntries(
|
|
36
|
-
Object.entries(jobs).map(([jobName, job]) => [
|
|
37
|
-
jobName,
|
|
38
|
-
sortGitLabJobDefProps(job),
|
|
39
|
-
]),
|
|
65
|
+
const pipelineContent = await generateChildPipelineContent(
|
|
66
|
+
config,
|
|
67
|
+
pipelineType,
|
|
40
68
|
);
|
|
41
|
-
|
|
42
|
-
image,
|
|
43
|
-
stages,
|
|
44
|
-
variables,
|
|
45
|
-
workflow,
|
|
46
|
-
...pipelineRest,
|
|
47
|
-
// jobs need to be spread into main YAML, because GitLab pipeline YAML has no jobs key - jobs are top level with their key as their name
|
|
48
|
-
...jobsWithSortedProps,
|
|
49
|
-
});
|
|
69
|
+
return writeYamlfile(`__pipeline.yml`, pipelineContent);
|
|
50
70
|
}
|
|
71
|
+
const pipelineContent = await generateLocalPipelineContent(
|
|
72
|
+
config,
|
|
73
|
+
pipelineType,
|
|
74
|
+
);
|
|
75
|
+
return writeYamlfile(`.gitlab-ci.yml`, pipelineContent);
|
|
51
76
|
}
|