@catladder/pipeline 1.111.4 → 1.112.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 (66) hide show
  1. package/dist/build/base/createAppBuildJob.d.ts +8 -0
  2. package/dist/build/base/{createBuildJob.js → createAppBuildJob.js} +3 -3
  3. package/dist/build/base/index.d.ts +8 -0
  4. package/dist/build/base/index.js +57 -0
  5. package/dist/build/custom/buildJob.js +19 -22
  6. package/dist/build/docker.d.ts +2 -4
  7. package/dist/build/docker.js +4 -39
  8. package/dist/build/node/buildJob.js +30 -32
  9. package/dist/build/node/meteor.js +19 -21
  10. package/dist/build/rails/build.js +12 -19
  11. package/dist/build/types.d.ts +4 -3
  12. package/dist/bundles/catladder-gitlab/index.js +1 -1
  13. package/dist/constants.js +1 -1
  14. package/dist/deploy/base/deploy.d.ts +3 -2
  15. package/dist/deploy/base/deploy.js +9 -4
  16. package/dist/deploy/base/index.d.ts +10 -3
  17. package/dist/deploy/base/index.js +37 -16
  18. package/dist/deploy/base/rollback.d.ts +3 -2
  19. package/dist/deploy/base/rollback.js +8 -6
  20. package/dist/deploy/base/stop.d.ts +3 -2
  21. package/dist/deploy/base/stop.js +8 -6
  22. package/dist/deploy/cloudRun/deployJob.js +28 -26
  23. package/dist/deploy/custom/deployJob.js +14 -11
  24. package/dist/deploy/dockerTag/deployJob.js +15 -5
  25. package/dist/deploy/kubernetes/deployJob.js +14 -26
  26. package/dist/deploy/kubernetes/mongodb.d.ts +1 -1
  27. package/dist/deploy/kubernetes/mongodb.js +8 -7
  28. package/dist/deploy/types/index.d.ts +1 -1
  29. package/dist/pipeline/gitlab/createGitlabJobs.d.ts +1 -0
  30. package/dist/pipeline/gitlab/createGitlabJobs.js +4 -1
  31. package/dist/tsconfig.tsbuildinfo +1 -1
  32. package/dist/types/gitlab-ci-yml.d.ts +769 -0
  33. package/dist/types/gitlab-ci-yml.js +9 -0
  34. package/dist/types/gitlab-types.d.ts +12 -85
  35. package/dist/types/jobs.d.ts +3 -3
  36. package/examples/__snapshots__/kubernetes-application-customization.ts.snap +0 -36
  37. package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +0 -36
  38. package/examples/__snapshots__/kubernetes-with-cloud-sql.ts.snap +0 -36
  39. package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +0 -72
  40. package/examples/__snapshots__/kubernetes-with-mongodb.ts.snap +0 -36
  41. package/examples/__snapshots__/meteor-kubernetes.ts.snap +0 -36
  42. package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +0 -36
  43. package/package.json +4 -2
  44. package/scripts/generate-gitlab-ci-types.ts +51 -0
  45. package/src/build/base/{createBuildJob.ts → createAppBuildJob.ts} +3 -2
  46. package/src/build/base/index.ts +35 -0
  47. package/src/build/custom/buildJob.ts +32 -45
  48. package/src/build/docker.ts +14 -17
  49. package/src/build/node/buildJob.ts +50 -61
  50. package/src/build/node/meteor.ts +31 -36
  51. package/src/build/rails/build.ts +8 -10
  52. package/src/build/types.ts +4 -8
  53. package/src/deploy/base/deploy.ts +16 -2
  54. package/src/deploy/base/index.ts +22 -3
  55. package/src/deploy/base/rollback.ts +13 -2
  56. package/src/deploy/base/stop.ts +13 -4
  57. package/src/deploy/cloudRun/deployJob.ts +13 -15
  58. package/src/deploy/custom/deployJob.ts +17 -20
  59. package/src/deploy/dockerTag/deployJob.ts +6 -7
  60. package/src/deploy/kubernetes/deployJob.ts +17 -34
  61. package/src/deploy/kubernetes/mongodb.ts +3 -2
  62. package/src/pipeline/gitlab/createGitlabJobs.ts +3 -0
  63. package/src/types/gitlab-ci-yml.ts +892 -0
  64. package/src/types/gitlab-types.ts +49 -86
  65. package/src/types/jobs.ts +3 -4
  66. package/dist/build/base/createBuildJob.d.ts +0 -7
@@ -1,105 +1,68 @@
1
- export type Artifacts = {
2
- paths: string[];
3
- expire_in?: string;
4
- when?: "always" | "on_success" | "on_failure";
5
- // Reports won't show up on MRs until https://gitlab.com/groups/gitlab-org/-/epics/8205
6
- reports?: {
7
- accessibility?: string | string[];
8
- coverage_report?: { coverage_format: string; path: string };
9
- codequality?: string | string[];
10
- cyclonedx?: string | string[];
11
- dotenv?: string | string[];
12
- junit?: string | string[];
13
- sast?: string;
14
- secret_detection?: string;
15
- terraform?: string;
16
- };
17
- };
18
- export type GitlabJobCache = {
19
- key: GitlabJobCacheKey;
20
- policy?: string;
21
- paths: string[];
22
- };
23
- export type GitlabJobCacheKey =
24
- | string
25
- | {
26
- files: string[];
27
- prefix?: string;
28
- };
29
- export type GitlabRule = {
30
- if?: string;
31
- when?: "always" | "on_success" | "manual" | "never"; // todo
32
- allow_failure?: boolean;
33
- };
34
- export type Retry = {
35
- max: number;
36
- when: string[];
37
- };
1
+ import type {
2
+ Artifacts as GitlabCiArtifacts,
3
+ JobTemplate,
4
+ Cache,
5
+ Rules,
6
+ } from "./gitlab-ci-yml";
38
7
 
39
- export type GitlabJobService = {
40
- name: string;
41
- command?: string[];
42
- entrypoint?: string[];
43
- alias?: string;
44
- };
8
+ export { Retry, Image as GitlabJobImage } from "./gitlab-ci-yml";
45
9
 
46
- export type GitlabJobImage =
47
- | string
48
- | {
49
- name: string;
50
- entrypoint?: string[];
51
- };
10
+ // Reports won't show up on MRs until https://gitlab.com/groups/gitlab-org/-/epics/8205
11
+ export interface Artifacts extends Omit<GitlabCiArtifacts, "paths"> {
12
+ paths: string[];
13
+ }
14
+ export type GitlabJobCache = Cache;
15
+ export type GitlabRule = Exclude<Rules, null>[number];
16
+ export type GitlabEnvironment = Omit<
17
+ Exclude<JobTemplate["environment"], undefined | string>,
18
+ "deployment_tier"
19
+ >;
52
20
 
53
- export type GitlabEnvironment = {
54
- url: string;
55
- name: string;
56
- kubernetes?: {
57
- namespace?: string;
58
- };
59
- action?: "stop" | "start" | "prepare" | "access"; // defaults to start
60
- on_stop?: string; // other job to run on stop
61
- auto_stop_in?: string;
62
- };
63
- export type GitlabJobDef = {
64
- stage: string;
65
- before_script?: string[];
66
- script: (string | undefined)[];
67
- interruptible?: boolean;
68
- needs?: Array<string | { job: string; artifacts: boolean }>;
21
+ export interface GitlabJobDef
22
+ extends Pick<
23
+ JobTemplate,
24
+ | "after_script"
25
+ | "allow_failure"
26
+ | "artifacts"
27
+ | "before_script"
28
+ | "coverage"
29
+ | "dependencies"
30
+ | "environment"
31
+ | "except"
32
+ | "hooks"
33
+ | "image"
34
+ | "interruptible"
35
+ | "needs"
36
+ | "only"
37
+ | "parallel"
38
+ | "release"
39
+ | "resource_group"
40
+ | "retry"
41
+ | "rules"
42
+ | "script"
43
+ | "services"
44
+ | "stage"
45
+ | "tags"
46
+ | "trigger"
47
+ | "variables"
48
+ > {
49
+ stage: JobTemplate["stage"];
69
50
  rules?: GitlabRule[];
70
51
  cache?: GitlabJobCache | GitlabJobCache[];
71
52
  artifacts?: Artifacts;
72
- retry?: Retry;
73
- services?: GitlabJobService[];
74
- image?: GitlabJobImage;
75
- variables?: GitlabVariables;
76
- dependencies?: string[];
77
- environment?: GitlabEnvironment;
78
- allow_failure?: boolean;
79
- parallel?: number;
80
53
  tags?: string[];
81
- trigger?: {
82
- strategy: "depend";
83
- include: Array<{
84
- artifact: string;
85
- job: string;
86
- }>;
87
- };
88
- };
89
-
90
- export type GitlabVariables = Record<string, string | undefined>;
54
+ }
91
55
 
92
56
  /**
93
57
  * this is not precicily the type of a gitlab-pipeline
94
58
  * the jobs nee to be merge into the object.
95
59
  * Problem is, that this type cannot be represented properly with typescript, see https://github.com/microsoft/TypeScript/issues/17867
96
60
  */
97
- export type GitlabPipeline = {
61
+ export interface GitlabPipeline extends Pick<JobTemplate, "variables"> {
98
62
  image: string;
99
- variables: GitlabVariables;
100
63
  workflow?: {
101
64
  rules: GitlabRule[];
102
65
  };
103
66
  stages: string[];
104
67
  jobs: Record<string, GitlabJobDef>;
105
- };
68
+ }
package/src/types/jobs.ts CHANGED
@@ -3,9 +3,8 @@ import type {
3
3
  GitlabEnvironment,
4
4
  GitlabJobCache,
5
5
  GitlabRule,
6
- GitlabVariables,
7
- GitlabJobService,
8
6
  GitlabJobImage,
7
+ GitlabJobDef,
9
8
  } from "./gitlab-types";
10
9
 
11
10
  export const BASE_STAGES = [
@@ -82,7 +81,7 @@ export type CatladderJob<S = BaseStage> = {
82
81
  /**
83
82
  * additional services, mainly used for docker
84
83
  */
85
- services?: GitlabJobService[];
84
+ services?: GitlabJobDef["services"];
86
85
 
87
86
  /**
88
87
  * image to use
@@ -92,7 +91,7 @@ export type CatladderJob<S = BaseStage> = {
92
91
  /**
93
92
  * variables to pass
94
93
  */
95
- variables: GitlabVariables;
94
+ variables: GitlabJobDef["variables"];
96
95
 
97
96
  /**
98
97
  * whether failures are allowed
@@ -1,7 +0,0 @@
1
- import type { Context } from "../..";
2
- import type { CatladderJob } from "../../types/jobs";
3
- export declare const createBuildJob: (context: Context, {
4
- script,
5
- variables,
6
- ...def
7
- }: Partial<CatladderJob>) => CatladderJob;