@catladder/pipeline 1.153.1 → 1.154.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.
- package/dist/build/artifacts/createBuildJobArtifact.d.ts +3 -0
- package/dist/build/artifacts/createBuildJobArtifact.js +97 -0
- package/dist/build/base/createAppBuildJob.d.ts +3 -3
- package/dist/build/base/createAppBuildJob.js +9 -15
- package/dist/build/base/index.d.ts +6 -2
- package/dist/build/base/index.js +14 -5
- package/dist/build/base/writeDotEnv.js +2 -1
- package/dist/build/custom/__tests__/testJob.test.js +1 -1
- package/dist/build/custom/buildJob.js +3 -10
- package/dist/build/docker.js +3 -3
- package/dist/build/index.d.ts +13 -6
- package/dist/build/index.js +29 -7
- package/dist/build/node/buildJob.d.ts +7 -2
- package/dist/build/node/buildJob.js +40 -33
- package/dist/build/node/cache.d.ts +2 -2
- package/dist/build/node/cache.js +8 -4
- package/dist/build/node/index.d.ts +2 -2
- package/dist/build/node/meteor.js +3 -6
- package/dist/build/node/testJob.d.ts +3 -2
- package/dist/build/node/testJob.js +9 -4
- package/dist/build/node/yarn.js +1 -1
- package/dist/build/rails/build.d.ts +1 -1
- package/dist/build/rails/build.js +7 -2
- package/dist/build/rails/test.d.ts +1 -1
- package/dist/build/rails/test.js +5 -0
- package/dist/build/sbom.js +3 -2
- package/dist/build/types.d.ts +48 -4
- package/dist/build/types.js +7 -1
- package/dist/bundles/catladder-gitlab/index.js +2 -2
- package/dist/constants.js +1 -1
- package/dist/context/createAllComponentsContext.d.ts +12 -0
- package/dist/context/createAllComponentsContext.js +159 -0
- package/dist/context/createComponentContext.d.ts +1 -5
- package/dist/context/createComponentContext.js +82 -20
- package/dist/context/createWorkspaceContext.d.ts +16 -0
- package/dist/context/createWorkspaceContext.js +173 -0
- package/dist/context/getBuildInfoVariables.d.ts +1 -1
- package/dist/context/getEnvironmentContext.d.ts +1 -1
- package/dist/context/getEnvironmentVariables.d.ts +2 -2
- package/dist/context/getEnvironmentVariables.js +5 -4
- package/dist/context/getLabels.js +4 -4
- package/dist/deploy/base/deploy.d.ts +1 -1
- package/dist/deploy/base/deploy.js +18 -5
- package/dist/deploy/cloudRun/artifactsRegistry.js +2 -2
- package/dist/deploy/cloudRun/createJobs/common.d.ts +4 -4
- package/dist/deploy/cloudRun/index.d.ts +2 -2
- package/dist/deploy/custom/index.d.ts +2 -2
- package/dist/deploy/dockerTag/index.d.ts +2 -2
- package/dist/deploy/index.d.ts +7 -7
- package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +3 -1
- package/dist/deploy/kubernetes/cloudSql/index.js +1 -1
- package/dist/deploy/kubernetes/deployJob.js +2 -2
- package/dist/deploy/kubernetes/index.d.ts +2 -2
- package/dist/deploy/sbom.d.ts +1 -1
- package/dist/deploy/sbom.js +4 -3
- package/dist/deploy/types/index.d.ts +3 -3
- package/dist/pipeline/createAllJobs.d.ts +12 -10
- package/dist/pipeline/createAllJobs.js +94 -51
- package/dist/pipeline/createJobsForComponent.js +2 -3
- package/dist/pipeline/createJobsForWorkspace.d.ts +3 -0
- package/dist/pipeline/createJobsForWorkspace.js +12 -0
- package/dist/pipeline/createMainPipeline.js +26 -6
- package/dist/pipeline/gitlab/createGitlabJobs.d.ts +3 -16
- package/dist/pipeline/gitlab/createGitlabJobs.js +191 -73
- package/dist/pipeline/packageManager.d.ts +3 -2
- package/dist/pipeline/packageManager.js +43 -15
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +5 -4
- package/dist/types/context.d.ts +77 -12
- package/dist/types/context.js +10 -1
- package/dist/types/environmentContext.d.ts +5 -6
- package/dist/types/jobs.d.ts +5 -0
- package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-meteor-with-worker.ts.snap +8 -0
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-no-service.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-non-public.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-post-stop-job.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-service-gen2.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-service-increase-timout.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-service-with-volumes.ts.snap +8 -8
- package/examples/__snapshots__/cloud-run-storybook.ts.snap +4 -8
- package/examples/__snapshots__/cloud-run-with-ngnix.ts.snap +4 -8
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +16 -16
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +589 -1097
- package/examples/__snapshots__/cloud-run-with-worker.ts.snap +8 -8
- package/examples/__snapshots__/custom-build-job-with-tests.ts.snap +4 -0
- package/examples/__snapshots__/custom-build-job.ts.snap +4 -0
- package/examples/__snapshots__/custom-deploy.ts.snap +8 -8
- package/examples/__snapshots__/custom-envs.ts.snap +18 -12
- package/examples/__snapshots__/custom-sbom-java.ts.snap +4 -0
- package/examples/__snapshots__/kubernetes-application-customization.ts.snap +8 -8
- package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +8 -8
- package/examples/__snapshots__/kubernetes-with-cloud-sql.ts.snap +8 -8
- package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +16 -16
- package/examples/__snapshots__/kubernetes-with-mongodb.ts.snap +8 -8
- package/examples/__snapshots__/local-dot-env.ts.snap +8 -8
- package/examples/__snapshots__/meteor-kubernetes.ts.snap +8 -0
- package/examples/__snapshots__/multiline-var.ts.snap +16 -16
- package/examples/__snapshots__/native-app.ts.snap +24 -16
- package/examples/__snapshots__/node-build-with-custom-image.ts.snap +8 -8
- package/examples/__snapshots__/node-build-with-docker-additions.ts.snap +8 -8
- package/examples/__snapshots__/wait-for-other-deploy.ts.snap +16 -16
- package/examples/cloud-run-with-sql.ts +9 -2
- package/package.json +1 -1
- package/src/build/artifacts/createBuildJobArtifact.ts +61 -0
- package/src/build/base/createAppBuildJob.ts +26 -22
- package/src/build/base/index.ts +31 -4
- package/src/build/base/writeDotEnv.ts +6 -2
- package/src/build/custom/__tests__/testJob.test.ts +4 -4
- package/src/build/custom/buildJob.ts +2 -13
- package/src/build/docker.ts +6 -7
- package/src/build/index.ts +39 -7
- package/src/build/node/buildJob.ts +68 -56
- package/src/build/node/cache.ts +17 -8
- package/src/build/node/index.ts +4 -2
- package/src/build/node/meteor.ts +3 -9
- package/src/build/node/testJob.ts +21 -7
- package/src/build/node/yarn.ts +2 -2
- package/src/build/rails/build.ts +14 -4
- package/src/build/rails/test.ts +9 -1
- package/src/build/sbom.ts +7 -2
- package/src/build/types.ts +68 -4
- package/src/context/createAllComponentsContext.ts +31 -0
- package/src/context/createComponentContext.ts +59 -20
- package/src/context/createWorkspaceContext.ts +56 -0
- package/src/context/getBuildInfoVariables.ts +2 -1
- package/src/context/getEnvironmentContext.ts +2 -2
- package/src/context/getEnvironmentVariables.ts +12 -6
- package/src/context/getLabels.ts +2 -2
- package/src/deploy/base/deploy.ts +33 -7
- package/src/deploy/cloudRun/artifactsRegistry.ts +2 -3
- package/src/deploy/cloudRun/createJobs/common.ts +4 -4
- package/src/deploy/cloudRun/index.ts +68 -67
- package/src/deploy/custom/index.ts +2 -2
- package/src/deploy/dockerTag/index.ts +8 -7
- package/src/deploy/index.ts +11 -9
- package/src/deploy/kubernetes/additionalSecretKeys.ts +3 -1
- package/src/deploy/kubernetes/cloudSql/index.ts +1 -1
- package/src/deploy/kubernetes/deployJob.ts +2 -2
- package/src/deploy/kubernetes/index.ts +42 -41
- package/src/deploy/sbom.ts +9 -4
- package/src/pipeline/createAllJobs.ts +56 -55
- package/src/pipeline/createChildPipeline.ts +1 -0
- package/src/pipeline/createJobsForComponent.ts +5 -4
- package/src/pipeline/createJobsForWorkspace.ts +12 -0
- package/src/pipeline/createMainPipeline.ts +38 -23
- package/src/pipeline/gitlab/createGitlabJobs.ts +283 -119
- package/src/pipeline/packageManager.ts +25 -9
- package/src/types/config.ts +4 -1
- package/src/types/context.ts +105 -11
- package/src/types/environmentContext.ts +6 -7
- package/src/types/jobs.ts +3 -1
package/src/types/context.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import type { StringOrBashExpression } from "../bash/BashExpression";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
BuildConfigFromWorkspace,
|
|
4
|
+
BuildConfigStandalone,
|
|
5
|
+
WorkspaceBuildConfig,
|
|
6
|
+
} from "../build";
|
|
3
7
|
import type { PredefinedVariables, SecretEnvVar } from "../context";
|
|
4
8
|
import type { DeployConfig } from "../deploy";
|
|
5
9
|
import type {
|
|
6
|
-
PipelineTrigger,
|
|
7
10
|
ComponentConfig,
|
|
8
11
|
Config,
|
|
9
12
|
EnvType,
|
|
13
|
+
PipelineTrigger,
|
|
10
14
|
} from "./config";
|
|
11
15
|
import type { BaseStage, CatladderJob } from "./jobs";
|
|
12
16
|
import type { PipelineType } from "./pipeline";
|
|
@@ -68,12 +72,15 @@ export type YarnWorkspace = {
|
|
|
68
72
|
workspaceDependencies: string[];
|
|
69
73
|
mismatchedWorkspaceDependencies: string[];
|
|
70
74
|
};
|
|
71
|
-
export type
|
|
75
|
+
export type YarnPackageManagerInfoBase = {
|
|
72
76
|
type: "yarn";
|
|
73
77
|
version: string;
|
|
74
78
|
workspaces: YarnWorkspace[];
|
|
75
|
-
currentWorkspace?: YarnWorkspace;
|
|
76
79
|
isClassic: boolean;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
export type YarnPackageManagerInfoComponent = YarnPackageManagerInfoBase & {
|
|
83
|
+
currentWorkspace?: YarnWorkspace;
|
|
77
84
|
componentIsInWorkspace: boolean;
|
|
78
85
|
pathsToCopyInDocker: string[];
|
|
79
86
|
currentWorkspaceDependencies: string[];
|
|
@@ -81,25 +88,80 @@ export type YarnPackageManagerInfoComponent = {
|
|
|
81
88
|
|
|
82
89
|
export type PackageManagerInfoComponent = YarnPackageManagerInfoComponent;
|
|
83
90
|
|
|
91
|
+
/**
|
|
92
|
+
* not confuse with yarn workspaces
|
|
93
|
+
*/
|
|
94
|
+
export type PackageManagerInfoBase = YarnPackageManagerInfoBase;
|
|
95
|
+
|
|
84
96
|
export type ContextBeforeConfig = {
|
|
85
97
|
componentName: string;
|
|
86
98
|
fullConfig: Config;
|
|
87
99
|
packageManagerInfo?: PackageManagerInfoComponent;
|
|
88
100
|
};
|
|
89
101
|
|
|
90
|
-
export type
|
|
102
|
+
export type BuildContextBase = {
|
|
103
|
+
/**
|
|
104
|
+
* the directory where the component or workspace is located
|
|
105
|
+
*/
|
|
91
106
|
dir: string;
|
|
107
|
+
/**
|
|
108
|
+
* directories of all components that are part of the build.
|
|
109
|
+
* In case of a standalone build, this is just the dir of the component + yarn workspace dependencies (if mode = all)
|
|
110
|
+
*
|
|
111
|
+
* in case of a workspace this contains all components in the workspace (+ yarn workspace dependencies if mode = all)
|
|
112
|
+
*/
|
|
113
|
+
getComponentDirs: (mode: "direct" | "all") => string[];
|
|
114
|
+
};
|
|
92
115
|
|
|
93
|
-
|
|
116
|
+
export type BuildContextComponentBase = BuildContextBase;
|
|
117
|
+
|
|
118
|
+
export type BuildContextStandalone<
|
|
119
|
+
C extends BuildConfigStandalone = BuildConfigStandalone,
|
|
120
|
+
> = BuildContextComponentBase & {
|
|
121
|
+
config: C;
|
|
122
|
+
type: "standalone";
|
|
123
|
+
buildType: C["type"];
|
|
94
124
|
};
|
|
95
125
|
|
|
96
|
-
export type
|
|
126
|
+
export type BuildContextFromWorkspace = BuildContextComponentBase & {
|
|
127
|
+
config: BuildConfigFromWorkspace;
|
|
128
|
+
workspaceName: string;
|
|
129
|
+
buildType: WorkspaceBuildConfig["type"];
|
|
130
|
+
/**
|
|
131
|
+
* merged docker config
|
|
132
|
+
*/
|
|
133
|
+
workspaceBuildConfig: WorkspaceBuildConfig;
|
|
134
|
+
type: "fromWorkspace";
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
export type BuildContextWorkspace = BuildContextBase & {
|
|
138
|
+
type: "workspace";
|
|
139
|
+
buildType: WorkspaceBuildConfig["type"];
|
|
140
|
+
config: WorkspaceBuildConfig;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export type BuildContextComponent =
|
|
144
|
+
| BuildContextStandalone
|
|
145
|
+
| BuildContextFromWorkspace;
|
|
146
|
+
|
|
147
|
+
export type BuildContext = BuildContextComponent | BuildContextWorkspace;
|
|
148
|
+
|
|
97
149
|
export type DeployContext = {
|
|
98
150
|
config: DeployConfig;
|
|
99
151
|
};
|
|
100
|
-
export type ComponentContext
|
|
101
|
-
|
|
152
|
+
export type ComponentContext<
|
|
153
|
+
BC extends BuildContextComponent = BuildContextComponent,
|
|
154
|
+
> = {
|
|
155
|
+
type: "component";
|
|
102
156
|
env: string;
|
|
157
|
+
/**
|
|
158
|
+
* the name of the component
|
|
159
|
+
*/
|
|
160
|
+
name: string;
|
|
161
|
+
/**
|
|
162
|
+
* @deprecated use name instead
|
|
163
|
+
*/
|
|
164
|
+
componentName: string;
|
|
103
165
|
|
|
104
166
|
/**
|
|
105
167
|
* the merged component config.
|
|
@@ -108,7 +170,7 @@ export type ComponentContext = {
|
|
|
108
170
|
*
|
|
109
171
|
*/
|
|
110
172
|
componentConfig: ComponentConfig;
|
|
111
|
-
build:
|
|
173
|
+
build: BC;
|
|
112
174
|
deploy?: DeployContext | null;
|
|
113
175
|
fullConfig: Config;
|
|
114
176
|
environment: Environment;
|
|
@@ -121,4 +183,36 @@ export type ComponentContext = {
|
|
|
121
183
|
customJobs?: CatladderJob[];
|
|
122
184
|
};
|
|
123
185
|
|
|
124
|
-
export type Context = ComponentContext;
|
|
186
|
+
export type Context = ComponentContext | WorkspaceContext;
|
|
187
|
+
|
|
188
|
+
export type CatladderJobWithContext<S = BaseStage> = CatladderJob<S> & {
|
|
189
|
+
context: ComponentContext;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
export const componentContextIsStandaloneBuild = (
|
|
193
|
+
context: ComponentContext<BuildContextComponent>,
|
|
194
|
+
): context is ComponentContext<BuildContextStandalone> => {
|
|
195
|
+
return context.build.type === "standalone";
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
export const componentContextHasWorkspaceBuild = (
|
|
199
|
+
context: ComponentContext<BuildContextComponent>,
|
|
200
|
+
): context is ComponentContext<BuildContextFromWorkspace> => {
|
|
201
|
+
return context.build.type === "fromWorkspace";
|
|
202
|
+
};
|
|
203
|
+
|
|
204
|
+
export type WorkspaceContext = {
|
|
205
|
+
type: "workspace";
|
|
206
|
+
/**
|
|
207
|
+
* the name of the workspace
|
|
208
|
+
*/
|
|
209
|
+
name: string;
|
|
210
|
+
fullConfig: Config;
|
|
211
|
+
workspaceConfig: WorkspaceBuildConfig;
|
|
212
|
+
packageManagerInfo: PackageManagerInfoBase;
|
|
213
|
+
components: Array<ComponentContext>;
|
|
214
|
+
build: BuildContextWorkspace;
|
|
215
|
+
trigger: PipelineTrigger;
|
|
216
|
+
pipelineType: PipelineType;
|
|
217
|
+
env: string;
|
|
218
|
+
};
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
import type { StringOrBashExpression } from "../bash/BashExpression";
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type { DeployConfigType } from "../deploy";
|
|
2
|
+
import type { BuildConfig } from "../build";
|
|
3
|
+
import type { DeployConfig } from "../deploy";
|
|
5
4
|
import type { Config, EnvConfigWithComponent, EnvType } from "./config";
|
|
6
5
|
import type { PipelineType } from "./pipeline";
|
|
7
6
|
|
|
8
7
|
export type EnvironmentContext<
|
|
9
|
-
B extends
|
|
10
|
-
D extends
|
|
8
|
+
B extends BuildConfig = BuildConfig,
|
|
9
|
+
D extends DeployConfig = DeployConfig,
|
|
11
10
|
> = {
|
|
12
11
|
envConfigRaw: EnvConfigWithComponent;
|
|
13
|
-
buildConfigRaw: false |
|
|
14
|
-
deployConfigRaw: false |
|
|
12
|
+
buildConfigRaw: false | B;
|
|
13
|
+
deployConfigRaw: false | D;
|
|
15
14
|
|
|
16
15
|
env: string;
|
|
17
16
|
envType: EnvType;
|
package/src/types/jobs.ts
CHANGED
|
@@ -25,7 +25,8 @@ export type BaseStage = (typeof BASE_STAGES)[number];
|
|
|
25
25
|
|
|
26
26
|
export type CatladderJobNeed =
|
|
27
27
|
| string
|
|
28
|
-
| { job: string; artifacts: boolean; componentName?: string }
|
|
28
|
+
| { job: string; artifacts: boolean; componentName?: string }
|
|
29
|
+
| { job: string; artifacts: boolean; workspaceName: string };
|
|
29
30
|
|
|
30
31
|
export type CatladderJobEnvironmentConfig = {
|
|
31
32
|
action?: GitlabEnvironment["action"];
|
|
@@ -61,6 +62,7 @@ export type CatladderJob<S = BaseStage> = {
|
|
|
61
62
|
needsStages?: {
|
|
62
63
|
stage: S;
|
|
63
64
|
artifacts?: boolean;
|
|
65
|
+
workspaceName?: string;
|
|
64
66
|
}[];
|
|
65
67
|
|
|
66
68
|
/**
|