@catladder/pipeline 1.146.0 → 1.146.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/dist/build/base/createAppBuildJob.d.ts +2 -2
- package/dist/build/base/createAppBuildJob.js +1 -1
- package/dist/build/base/index.d.ts +2 -2
- package/dist/build/base/writeBuildInfo.d.ts +2 -2
- package/dist/build/base/writeDotEnv.d.ts +2 -2
- package/dist/build/custom/buildJob.d.ts +2 -2
- package/dist/build/custom/index.d.ts +2 -2
- package/dist/build/custom/testJob.d.ts +2 -2
- package/dist/build/docker.d.ts +9 -9
- package/dist/build/index.d.ts +2 -2
- package/dist/build/node/buildJob.d.ts +2 -2
- package/dist/build/node/buildJob.js +6 -6
- package/dist/build/node/cache.d.ts +5 -5
- package/dist/build/node/cache.js +4 -4
- package/dist/build/node/index.d.ts +4 -4
- package/dist/build/node/meteor.d.ts +2 -2
- package/dist/build/node/meteor.js +2 -2
- package/dist/build/node/testJob.d.ts +2 -2
- package/dist/build/node/testJob.js +6 -6
- package/dist/build/node/yarn.d.ts +4 -4
- package/dist/build/node/yarn.js +1 -1
- package/dist/build/rails/build.d.ts +2 -2
- package/dist/build/rails/index.d.ts +2 -2
- package/dist/build/rails/test.d.ts +2 -2
- package/dist/build/sbom.d.ts +2 -2
- package/dist/build/sbom.js +1 -1
- package/dist/bundles/catladder-gitlab/index.js +1 -1
- package/dist/constants.js +1 -1
- package/dist/context/getEnvironment.d.ts +2 -2
- package/dist/context/getEnvironmentContext.d.ts +2 -2
- package/dist/context/getEnvironmentVariables.d.ts +4 -4
- package/dist/context/getLabels.d.ts +2 -2
- package/dist/context/index.d.ts +7 -3
- package/dist/context/index.js +12 -3
- package/dist/deploy/base/deploy.d.ts +2 -2
- package/dist/deploy/base/index.d.ts +2 -2
- package/dist/deploy/base/rollback.d.ts +2 -2
- package/dist/deploy/base/stop.d.ts +2 -2
- package/dist/deploy/cloudRun/artifactsRegistry.d.ts +7 -7
- package/dist/deploy/cloudRun/cleanup.d.ts +2 -2
- package/dist/deploy/cloudRun/cloudRunRevisions.d.ts +2 -2
- package/dist/deploy/cloudRun/createJobs/cloudRunJobs.d.ts +6 -6
- package/dist/deploy/cloudRun/createJobs/cloudRunServices.d.ts +3 -3
- package/dist/deploy/cloudRun/createJobs/common.d.ts +4 -4
- package/dist/deploy/cloudRun/createJobs/getCloudRunDeployScripts.d.ts +2 -2
- package/dist/deploy/cloudRun/createJobs/getCloudRunStopScripts.d.ts +2 -2
- package/dist/deploy/cloudRun/createJobs/index.d.ts +2 -2
- package/dist/deploy/cloudRun/utils/database.d.ts +3 -3
- package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.d.ts +2 -2
- package/dist/deploy/cloudRun/utils/getServiceName.d.ts +2 -2
- package/dist/deploy/custom/deployJob.d.ts +2 -2
- package/dist/deploy/custom/deployJob.js +1 -1
- package/dist/deploy/dockerTag/deployJob.d.ts +2 -2
- package/dist/deploy/index.d.ts +2 -2
- package/dist/deploy/kubernetes/cloudSql/index.d.ts +3 -3
- package/dist/deploy/kubernetes/deployJob.d.ts +2 -2
- package/dist/deploy/kubernetes/kubeEnv.d.ts +2 -2
- package/dist/deploy/kubernetes/kubeValues.d.ts +2 -2
- package/dist/deploy/kubernetes/mongodb.d.ts +2 -2
- package/dist/deploy/sbom.d.ts +4 -4
- package/dist/deploy/utils.d.ts +2 -2
- package/dist/pipeline/createJobsForComponent.d.ts +2 -2
- package/dist/pipeline/createJobsForComponent.js +1 -1
- package/dist/pipeline/generatePipelineFiles.js +15 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +2 -2
- package/dist/types/context.d.ts +16 -2
- package/package.json +1 -1
- package/src/build/base/createAppBuildJob.ts +3 -3
- package/src/build/base/index.ts +2 -2
- package/src/build/base/writeBuildInfo.ts +2 -2
- package/src/build/base/writeDotEnv.ts +2 -2
- package/src/build/custom/__tests__/testJob.test.ts +5 -5
- package/src/build/custom/buildJob.ts +4 -2
- package/src/build/custom/index.ts +2 -2
- package/src/build/custom/testJob.ts +4 -2
- package/src/build/docker.ts +9 -9
- package/src/build/index.ts +2 -2
- package/src/build/node/buildJob.ts +13 -9
- package/src/build/node/cache.ts +9 -9
- package/src/build/node/index.ts +6 -4
- package/src/build/node/meteor.ts +10 -5
- package/src/build/node/testJob.ts +11 -8
- package/src/build/node/yarn.ts +6 -8
- package/src/build/rails/build.ts +4 -2
- package/src/build/rails/index.ts +2 -2
- package/src/build/rails/test.ts +4 -2
- package/src/build/sbom.ts +4 -4
- package/src/context/getEnvironment.ts +2 -2
- package/src/context/getEnvironmentContext.ts +2 -2
- package/src/context/getEnvironmentVariables.ts +7 -4
- package/src/context/getLabels.ts +2 -2
- package/src/context/index.ts +15 -5
- package/src/deploy/base/deploy.ts +2 -2
- package/src/deploy/base/index.ts +2 -2
- package/src/deploy/base/rollback.ts +2 -2
- package/src/deploy/base/stop.ts +2 -2
- package/src/deploy/cloudRun/artifactsRegistry.ts +12 -7
- package/src/deploy/cloudRun/cleanup.ts +2 -2
- package/src/deploy/cloudRun/cloudRunRevisions.ts +3 -3
- package/src/deploy/cloudRun/createJobs/cloudRunJobs.ts +10 -10
- package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +3 -3
- package/src/deploy/cloudRun/createJobs/common.ts +4 -4
- package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +5 -2
- package/src/deploy/cloudRun/createJobs/getCloudRunStopScripts.ts +2 -2
- package/src/deploy/cloudRun/createJobs/index.ts +2 -2
- package/src/deploy/cloudRun/utils/database.ts +3 -3
- package/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.ts +4 -2
- package/src/deploy/cloudRun/utils/getServiceName.ts +2 -2
- package/src/deploy/custom/deployJob.ts +7 -3
- package/src/deploy/dockerTag/deployJob.ts +4 -2
- package/src/deploy/index.ts +2 -2
- package/src/deploy/kubernetes/cloudSql/index.ts +3 -3
- package/src/deploy/kubernetes/deployJob.ts +2 -2
- package/src/deploy/kubernetes/kubeEnv.ts +2 -2
- package/src/deploy/kubernetes/kubeValues.ts +3 -3
- package/src/deploy/kubernetes/mongodb.ts +8 -8
- package/src/deploy/sbom.ts +8 -4
- package/src/deploy/utils.ts +2 -2
- package/src/pipeline/createJobsForComponent.ts +11 -7
- package/src/pipeline/generatePipelineFiles.ts +20 -11
- package/src/pipeline/gitlab/createGitlabJobs.ts +2 -2
- package/src/types/config.ts +2 -2
- package/src/types/context.ts +18 -2
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import { isFunction } from "lodash";
|
|
2
2
|
import { BUILD_TYPES } from "../build";
|
|
3
|
-
import type {
|
|
4
|
-
import {
|
|
3
|
+
import type { CreateComponentContextContext } from "../context";
|
|
4
|
+
import { createComponentContext } from "../context";
|
|
5
5
|
import { DEPLOY_TYPES } from "../deploy";
|
|
6
|
-
import type {
|
|
6
|
+
import type {
|
|
7
|
+
CatladderJobWithContext,
|
|
8
|
+
ComponentContext,
|
|
9
|
+
Context,
|
|
10
|
+
} from "../types/context";
|
|
7
11
|
import type { CatladderJob } from "../types/jobs";
|
|
8
12
|
import { getPackageManagerInfo } from "./packageManager";
|
|
9
13
|
|
|
10
14
|
const injectDefaultVarsInCustomJobs = (
|
|
11
|
-
context:
|
|
15
|
+
context: ComponentContext,
|
|
12
16
|
jobs: CatladderJob[],
|
|
13
17
|
) =>
|
|
14
18
|
jobs.map(({ variables, ...job }) => ({
|
|
@@ -18,7 +22,7 @@ const injectDefaultVarsInCustomJobs = (
|
|
|
18
22
|
},
|
|
19
23
|
...job,
|
|
20
24
|
}));
|
|
21
|
-
const getCustomJobs = (context:
|
|
25
|
+
const getCustomJobs = (context: ComponentContext) => {
|
|
22
26
|
if (!context.componentConfig.customJobs) {
|
|
23
27
|
return [];
|
|
24
28
|
}
|
|
@@ -40,14 +44,14 @@ const createRawJobs = (context: Context): CatladderJob[] => {
|
|
|
40
44
|
};
|
|
41
45
|
|
|
42
46
|
export const createJobsForComponent = async (
|
|
43
|
-
contextContext: Omit<
|
|
47
|
+
contextContext: Omit<CreateComponentContextContext, "packageManagerInfo">,
|
|
44
48
|
): Promise<Array<CatladderJobWithContext>> => {
|
|
45
49
|
const packageManagerInfo = await getPackageManagerInfo(
|
|
46
50
|
contextContext.config,
|
|
47
51
|
contextContext.componentName,
|
|
48
52
|
);
|
|
49
53
|
|
|
50
|
-
const context = await
|
|
54
|
+
const context = await createComponentContext({
|
|
51
55
|
...contextContext,
|
|
52
56
|
packageManagerInfo,
|
|
53
57
|
});
|
|
@@ -11,19 +11,28 @@ export async function generatePipelineFiles<T extends PipelineType>(
|
|
|
11
11
|
if (mode === "childpipeline") {
|
|
12
12
|
const trigger = getPipelineTriggerForGitlabChildPipeline();
|
|
13
13
|
|
|
14
|
-
const { jobs, ...mainPipeline } =
|
|
15
|
-
pipelineType,
|
|
16
|
-
trigger,
|
|
17
|
-
config,
|
|
18
|
-
);
|
|
14
|
+
const { jobs, image, stages, variables, workflow, ...mainPipeline } =
|
|
15
|
+
await createChildPipeline(pipelineType, trigger, config);
|
|
19
16
|
// need to spread out the jobs, forgot why
|
|
20
|
-
await writeYamlfile(`__pipeline.yml`, {
|
|
17
|
+
await writeYamlfile(`__pipeline.yml`, {
|
|
18
|
+
image,
|
|
19
|
+
stages,
|
|
20
|
+
variables,
|
|
21
|
+
workflow,
|
|
22
|
+
...mainPipeline,
|
|
23
|
+
...jobs,
|
|
24
|
+
});
|
|
21
25
|
} else {
|
|
22
|
-
const { jobs, ...mainPipeline } =
|
|
23
|
-
pipelineType,
|
|
24
|
-
config,
|
|
25
|
-
);
|
|
26
|
+
const { jobs, image, stages, variables, workflow, ...mainPipeline } =
|
|
27
|
+
await createMainPipeline(pipelineType, config);
|
|
26
28
|
// need to spread out the jobs, forgot why
|
|
27
|
-
await writeYamlfile(`.gitlab-ci.yml`, {
|
|
29
|
+
await writeYamlfile(`.gitlab-ci.yml`, {
|
|
30
|
+
image,
|
|
31
|
+
stages,
|
|
32
|
+
variables,
|
|
33
|
+
workflow,
|
|
34
|
+
...mainPipeline,
|
|
35
|
+
...jobs,
|
|
36
|
+
});
|
|
28
37
|
}
|
|
29
38
|
}
|
|
@@ -3,7 +3,7 @@ import { getInjectVarsScript } from "../../bash/getInjectVarsScript";
|
|
|
3
3
|
import { BASE_RETRY } from "../../defaults";
|
|
4
4
|
import type {
|
|
5
5
|
CatladderJobWithContext,
|
|
6
|
-
|
|
6
|
+
ComponentContext,
|
|
7
7
|
GitlabJobDef,
|
|
8
8
|
GitlabRule,
|
|
9
9
|
} from "../../types";
|
|
@@ -203,7 +203,7 @@ export const makeGitlabJob = (
|
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
const addGitlabEnvironment = (
|
|
206
|
-
context:
|
|
206
|
+
context: ComponentContext,
|
|
207
207
|
environment: CatladderJob["environment"],
|
|
208
208
|
job: GitlabJobDef,
|
|
209
209
|
componentName: string,
|
package/src/types/config.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { BuildConfig } from "../build/types";
|
|
|
2
2
|
import type { DeployConfig } from "../deploy/types";
|
|
3
3
|
|
|
4
4
|
import type { CatladderJob } from "./jobs";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ComponentContext } from "./context";
|
|
6
6
|
import type { PartialDeep } from "./utils";
|
|
7
7
|
import type { PipelineType } from "..";
|
|
8
8
|
|
|
@@ -151,7 +151,7 @@ export type ComponentConfig<C extends ConfigProps = never> = {
|
|
|
151
151
|
* to let us know about why you need to use custom jobs.
|
|
152
152
|
* This feedback will help us to generalize use cases
|
|
153
153
|
*/
|
|
154
|
-
customJobs?: CatladderJob[] | ((context:
|
|
154
|
+
customJobs?: CatladderJob[] | ((context: ComponentContext) => CatladderJob[]);
|
|
155
155
|
|
|
156
156
|
/**
|
|
157
157
|
* whether to create a .env
|
package/src/types/context.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { StringOrBashExpression } from "../bash/BashExpression";
|
|
2
|
+
import type { BuildConfig } from "../build";
|
|
2
3
|
import type { PredefinedVariables, SecretEnvVar } from "../context";
|
|
3
4
|
import type {
|
|
4
5
|
PipelineTrigger,
|
|
@@ -82,17 +83,32 @@ export type ContextBeforeConfig = {
|
|
|
82
83
|
fullConfig: Config;
|
|
83
84
|
packageManagerInfo?: PackageManagerInfo;
|
|
84
85
|
};
|
|
85
|
-
|
|
86
|
+
|
|
87
|
+
export type BuildContext = {
|
|
88
|
+
dir: string;
|
|
89
|
+
packageManagerInfo?: PackageManagerInfo;
|
|
90
|
+
config: BuildConfig;
|
|
91
|
+
};
|
|
92
|
+
export type ComponentContext = {
|
|
86
93
|
componentName: string;
|
|
87
94
|
componentConfig: ComponentConfig;
|
|
95
|
+
buildContext: BuildContext;
|
|
88
96
|
fullConfig: Config;
|
|
89
97
|
environment: Environment;
|
|
90
98
|
|
|
91
99
|
trigger?: PipelineTrigger;
|
|
92
100
|
pipelineType?: PipelineType;
|
|
101
|
+
/**
|
|
102
|
+
* @deprecated use buildContext.packageManagerInfo instead
|
|
103
|
+
*/
|
|
93
104
|
packageManagerInfo?: PackageManagerInfo;
|
|
94
105
|
};
|
|
95
106
|
|
|
107
|
+
/**
|
|
108
|
+
* @deprecated use ComponentContext instead
|
|
109
|
+
*/
|
|
110
|
+
export type Context = ComponentContext;
|
|
111
|
+
|
|
96
112
|
export type CatladderJobWithContext<S = BaseStage> = CatladderJob<S> & {
|
|
97
|
-
context:
|
|
113
|
+
context: ComponentContext;
|
|
98
114
|
};
|