@catladder/pipeline 1.144.0 → 1.145.0
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/bash/BashExpression.d.ts +40 -0
- package/dist/bash/BashExpression.js +124 -0
- package/dist/bash/bashExpressionPerPipelineType.d.ts +6 -0
- package/dist/bash/bashExpressionPerPipelineType.js +11 -0
- package/dist/bash/bashYaml.d.ts +10 -0
- package/dist/bash/bashYaml.js +46 -0
- package/dist/bash/getInjectVarsScript.d.ts +2 -0
- package/dist/bash/getInjectVarsScript.js +45 -0
- package/dist/bash/replaceAsync.d.ts +2 -0
- package/dist/{pipeline/commitInfo/getCommitInfo.js → bash/replaceAsync.js} +49 -21
- package/dist/build/base/__tests__/createArtifactsConfig.test.js +3 -1
- package/dist/build/base/constants.js +3 -1
- package/dist/build/base/createAppBuildJob.d.ts +2 -1
- package/dist/build/base/createAppBuildJob.js +10 -6
- package/dist/build/base/createArtifactsConfig.d.ts +1 -1
- package/dist/build/base/createArtifactsConfig.js +3 -1
- package/dist/build/base/index.js +3 -1
- package/dist/build/base/writeBuildInfo.js +4 -3
- package/dist/build/base/writeDotEnv.js +12 -3
- package/dist/build/custom/__tests__/testJob.test.js +3 -1
- package/dist/build/custom/buildJob.js +4 -12
- package/dist/build/custom/index.js +3 -1
- package/dist/build/custom/testJob.d.ts +1 -1
- package/dist/build/custom/testJob.js +18 -14
- package/dist/build/docker.d.ts +5 -31
- package/dist/build/docker.js +16 -9
- package/dist/build/index.d.ts +1 -1
- package/dist/build/index.js +13 -7
- package/dist/build/node/buildJob.js +4 -12
- package/dist/build/node/cache.js +6 -3
- package/dist/build/node/constants.js +3 -1
- package/dist/build/node/index.js +3 -1
- package/dist/build/node/meteor.js +5 -2
- package/dist/build/node/testJob.js +18 -14
- package/dist/build/node/yarn.d.ts +3 -2
- package/dist/build/node/yarn.js +6 -3
- package/dist/build/rails/build.js +3 -1
- package/dist/build/rails/index.js +3 -1
- package/dist/build/rails/test.js +15 -11
- package/dist/build/sbom.js +3 -1
- package/dist/build/types.d.ts +24 -18
- package/dist/build/types.js +3 -1
- package/dist/bundles/catladder-gitlab/index.js +3 -3
- package/dist/catladder-gitlab.js +10 -54
- package/dist/config/__tests__/configruedEnvs.test.js +3 -1
- package/dist/config/configruedEnvs.js +3 -1
- package/dist/config/index.js +13 -7
- package/dist/config/readConfig.js +6 -5
- package/dist/constants.js +5 -3
- package/dist/context/__tests__/resolveReferences.test.js +40 -8
- package/dist/context/getBuildInfoVariables.d.ts +7 -0
- package/dist/context/getBuildInfoVariables.js +29 -0
- package/dist/context/getEnvConfig.js +3 -1
- package/dist/context/getEnvType.js +3 -1
- package/dist/context/getEnvironment.d.ts +3 -3
- package/dist/context/getEnvironment.js +10 -14
- package/dist/context/getEnvironmentContext.d.ts +7 -3
- package/dist/context/getEnvironmentContext.js +21 -11
- package/dist/context/getEnvironmentVariables.d.ts +26 -5
- package/dist/context/getEnvironmentVariables.js +41 -25
- package/dist/context/getLabels.js +4 -2
- package/dist/context/getReviewSlug.d.ts +4 -0
- package/dist/context/getReviewSlug.js +22 -0
- package/dist/context/index.d.ts +12 -3
- package/dist/context/index.js +21 -15
- package/dist/context/resolveReferences.d.ts +3 -1
- package/dist/context/resolveReferences.js +53 -21
- package/dist/context/transformJobOnlyVars.d.ts +5 -2
- package/dist/context/transformJobOnlyVars.js +4 -2
- package/dist/context/utils/envVars.d.ts +1 -1
- package/dist/context/utils/envVars.js +5 -2
- package/dist/defaults/index.js +3 -1
- package/dist/deploy/base/deploy.d.ts +1 -1
- package/dist/deploy/base/deploy.js +12 -11
- package/dist/deploy/base/index.js +3 -1
- package/dist/deploy/base/rollback.d.ts +1 -1
- package/dist/deploy/base/rollback.js +13 -9
- package/dist/deploy/base/stop.d.ts +1 -1
- package/dist/deploy/base/stop.js +16 -11
- package/dist/deploy/base/types.d.ts +1 -1
- package/dist/deploy/base/types.js +3 -1
- package/dist/deploy/base/variables.js +3 -1
- package/dist/deploy/cloudRun/artifactsRegistry.d.ts +2 -1
- package/dist/deploy/cloudRun/artifactsRegistry.js +6 -4
- package/dist/deploy/cloudRun/cleanup.js +3 -1
- package/dist/deploy/cloudRun/cloudRunRevisions.js +3 -1
- package/dist/deploy/cloudRun/createJobs/cloudRunJobs.js +8 -5
- package/dist/deploy/cloudRun/createJobs/cloudRunServices.d.ts +2 -2
- package/dist/deploy/cloudRun/createJobs/cloudRunServices.js +6 -3
- package/dist/deploy/cloudRun/createJobs/common.d.ts +3 -3
- package/dist/deploy/cloudRun/createJobs/common.js +3 -1
- package/dist/deploy/cloudRun/createJobs/constants.d.ts +1 -0
- package/dist/deploy/cloudRun/createJobs/constants.js +7 -0
- package/dist/deploy/cloudRun/createJobs/getCloudRunDeployScripts.js +9 -2
- package/dist/deploy/cloudRun/createJobs/getCloudRunStopScripts.js +3 -1
- package/dist/deploy/cloudRun/createJobs/index.js +25 -8
- package/dist/deploy/cloudRun/createJobs/volumes.js +3 -1
- package/dist/deploy/cloudRun/index.js +5 -3
- package/dist/deploy/cloudRun/utils/createArgsString.d.ts +2 -1
- package/dist/deploy/cloudRun/utils/createArgsString.js +3 -1
- package/dist/deploy/cloudRun/utils/database.js +13 -13
- package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js +3 -1
- package/dist/deploy/cloudRun/utils/getServiceName.d.ts +1 -1
- package/dist/deploy/cloudRun/utils/getServiceName.js +3 -1
- package/dist/deploy/cloudRun/utils/jobName.d.ts +2 -1
- package/dist/deploy/cloudRun/utils/jobName.js +4 -2
- package/dist/deploy/cloudRun/utils/removeFirstLinesFromCommandOutput.js +3 -1
- package/dist/deploy/cloudSql/utils.d.ts +2 -1
- package/dist/deploy/cloudSql/utils.js +7 -2
- package/dist/deploy/custom/deployJob.js +3 -1
- package/dist/deploy/custom/index.js +3 -1
- package/dist/deploy/dockerTag/deployJob.js +3 -1
- package/dist/deploy/dockerTag/index.js +3 -1
- package/dist/deploy/index.d.ts +4 -3
- package/dist/deploy/index.js +13 -7
- package/dist/deploy/kubernetes/additionalSecretKeys.js +3 -1
- package/dist/deploy/kubernetes/cloudSql/index.d.ts +3 -2
- package/dist/deploy/kubernetes/cloudSql/index.js +6 -4
- package/dist/deploy/kubernetes/deployJob.js +22 -15
- package/dist/deploy/kubernetes/index.js +51 -14
- package/dist/deploy/kubernetes/kubeEnv.d.ts +3 -2
- package/dist/deploy/kubernetes/kubeEnv.js +7 -4
- package/dist/deploy/kubernetes/kubeValues.d.ts +2 -2
- package/dist/deploy/kubernetes/kubeValues.js +3 -2
- package/dist/deploy/kubernetes/mongodb.js +3 -1
- package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +2 -1
- package/dist/deploy/kubernetes/processSecretsAsFiles.js +3 -1
- package/dist/deploy/sbom.js +3 -1
- package/dist/deploy/types/base.d.ts +8 -2
- package/dist/deploy/types/base.js +3 -1
- package/dist/deploy/types/custom.d.ts +1 -1
- package/dist/deploy/types/custom.js +3 -1
- package/dist/deploy/types/dockerTag.d.ts +1 -1
- package/dist/deploy/types/dockerTag.js +3 -1
- package/dist/deploy/types/googleCloudRun.d.ts +19 -18
- package/dist/deploy/types/googleCloudRun.js +3 -1
- package/dist/deploy/types/index.d.ts +6 -6
- package/dist/deploy/types/index.js +13 -7
- package/dist/deploy/types/kubernetes.d.ts +22 -22
- package/dist/deploy/types/kubernetes.js +3 -1
- package/dist/deploy/utils.js +3 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +16 -9
- package/dist/packageInfos.d.ts +2 -0
- package/dist/packageInfos.js +14 -0
- package/dist/pipeline/createAllJobs.d.ts +13 -5
- package/dist/pipeline/createAllJobs.js +21 -10
- package/dist/pipeline/createChildPipeline.d.ts +1 -1
- package/dist/pipeline/createChildPipeline.js +24 -7
- package/dist/pipeline/createJobsForComponent.d.ts +3 -3
- package/dist/pipeline/createJobsForComponent.js +19 -18
- package/dist/pipeline/createMainPipeline.d.ts +3 -0
- package/dist/pipeline/createMainPipeline.js +248 -0
- package/dist/pipeline/generatePipelineFiles.d.ts +2 -0
- package/dist/pipeline/generatePipelineFiles.js +178 -0
- package/dist/pipeline/getPipelineStages.js +3 -1
- package/dist/pipeline/gitlab/createGitlabJobs.d.ts +15 -5
- package/dist/pipeline/gitlab/createGitlabJobs.js +98 -25
- package/dist/pipeline/gitlab/createGitlabPipeline.d.ts +7 -2
- package/dist/pipeline/gitlab/createGitlabPipeline.js +34 -17
- package/dist/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.d.ts +1 -0
- package/dist/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.js +29 -0
- package/dist/pipeline/gitlab/gitlabReleaseJobs.d.ts +33 -0
- package/dist/pipeline/gitlab/gitlabReleaseJobs.js +24 -0
- package/dist/pipeline/index.d.ts +3 -1
- package/dist/pipeline/index.js +16 -8
- package/dist/pipeline/packageManager.js +4 -2
- package/dist/pipeline/yarn/yarnUtils.js +6 -4
- package/dist/rules/index.d.ts +4 -1
- package/dist/rules/index.js +25 -18
- package/dist/runner/index.d.ts +1 -1
- package/dist/runner/index.js +3 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +18 -15
- package/dist/types/config.js +5 -2
- package/dist/types/context.d.ts +37 -32
- package/dist/types/context.js +3 -1
- package/dist/types/environmentContext.d.ts +11 -7
- package/dist/types/environmentContext.js +3 -1
- package/dist/types/gitlab-ci-yml.d.ts +30 -30
- package/dist/types/gitlab-ci-yml.js +3 -2
- package/dist/types/gitlab-types.d.ts +4 -6
- package/dist/types/gitlab-types.js +3 -1
- package/dist/types/index.js +13 -7
- package/dist/types/jobs.d.ts +23 -6
- package/dist/types/jobs.js +3 -1
- package/dist/types/pipeline.d.ts +4 -3
- package/dist/types/pipeline.js +3 -1
- package/dist/types/utils.d.ts +1 -1
- package/dist/types/utils.js +3 -1
- package/dist/utils/gitlab.js +3 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/writeFiles.d.ts +7 -0
- package/dist/{pipeline/commitInfo/getBuildId.js → utils/writeFiles.js} +39 -22
- package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +480 -384
- package/examples/__snapshots__/cloud-run-meteor-with-worker.ts.snap +462 -366
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +480 -384
- package/examples/__snapshots__/cloud-run-no-service.ts.snap +501 -393
- package/examples/__snapshots__/cloud-run-non-public.ts.snap +480 -384
- package/examples/__snapshots__/cloud-run-post-stop-job.ts.snap +489 -392
- package/examples/__snapshots__/cloud-run-service-gen2.ts.snap +480 -384
- package/examples/__snapshots__/cloud-run-service-with-volumes.ts.snap +501 -401
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +1155 -915
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +1116 -888
- package/examples/__snapshots__/cloud-run-with-worker.ts.snap +482 -386
- package/examples/__snapshots__/custom-build-job-with-tests.ts.snap +452 -356
- package/examples/__snapshots__/custom-build-job.ts.snap +434 -350
- package/examples/__snapshots__/custom-deploy.ts.snap +319 -223
- package/examples/__snapshots__/custom-envs.ts.snap +123 -81
- package/examples/__snapshots__/custom-sbom-java.ts.snap +434 -350
- package/examples/__snapshots__/kubernetes-application-customization.ts.snap +846 -969
- package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.ts.snap +886 -957
- package/examples/__snapshots__/kubernetes-with-cloud-sql.ts.snap +894 -969
- package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +1626 -1728
- package/examples/__snapshots__/kubernetes-with-mongodb.ts.snap +974 -1137
- package/examples/__snapshots__/local-dot-env.ts.snap +480 -384
- package/examples/__snapshots__/meteor-kubernetes.ts.snap +906 -1069
- package/examples/__snapshots__/multiline-var.ts.snap +4500 -0
- package/examples/__snapshots__/native-app.ts.snap +706 -578
- package/examples/__snapshots__/node-build-with-custom-image.ts.snap +480 -384
- package/examples/__snapshots__/node-build-with-docker-additions.ts.snap +488 -384
- package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +1656 -1942
- package/examples/__snapshots__/wait-for-other-deploy.ts.snap +287 -231
- package/examples/custom-deploy.ts +7 -7
- package/examples/multiline-var.ts +64 -0
- package/package.json +5 -8
- package/src/bash/BashExpression.ts +81 -0
- package/src/bash/bashExpressionPerPipelineType.ts +16 -0
- package/src/bash/bashYaml.ts +46 -0
- package/src/bash/getInjectVarsScript.ts +12 -0
- package/src/bash/replaceAsync.ts +50 -0
- package/src/build/base/createAppBuildJob.ts +6 -2
- package/src/build/base/writeBuildInfo.ts +1 -1
- package/src/build/base/writeDotEnv.ts +6 -1
- package/src/build/custom/buildJob.ts +2 -4
- package/src/build/custom/testJob.ts +3 -2
- package/src/build/docker.ts +15 -7
- package/src/build/node/buildJob.ts +1 -3
- package/src/build/node/testJob.ts +3 -2
- package/src/build/node/yarn.ts +9 -4
- package/src/build/rails/test.ts +2 -1
- package/src/build/types.ts +8 -1
- package/src/catladder-gitlab.ts +8 -55
- package/src/config/readConfig.ts +2 -3
- package/src/constants.ts +5 -2
- package/src/context/__tests__/resolveReferences.test.ts +11 -6
- package/src/context/getBuildInfoVariables.ts +40 -0
- package/src/context/getEnvironment.ts +7 -30
- package/src/context/getEnvironmentContext.ts +25 -29
- package/src/context/getEnvironmentVariables.ts +61 -36
- package/src/context/getReviewSlug.ts +27 -0
- package/src/context/index.ts +24 -23
- package/src/context/resolveReferences.ts +28 -8
- package/src/context/transformJobOnlyVars.ts +5 -2
- package/src/context/utils/envVars.ts +2 -1
- package/src/deploy/base/deploy.ts +20 -18
- package/src/deploy/base/rollback.ts +8 -10
- package/src/deploy/base/stop.ts +8 -9
- package/src/deploy/cloudRun/artifactsRegistry.ts +9 -4
- package/src/deploy/cloudRun/createJobs/cloudRunJobs.ts +12 -7
- package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +3 -2
- package/src/deploy/cloudRun/createJobs/constants.ts +1 -0
- package/src/deploy/cloudRun/createJobs/getCloudRunDeployScripts.ts +20 -2
- package/src/deploy/cloudRun/createJobs/index.ts +17 -8
- package/src/deploy/cloudRun/index.ts +14 -6
- package/src/deploy/cloudRun/utils/createArgsString.ts +2 -1
- package/src/deploy/cloudRun/utils/database.ts +2 -2
- package/src/deploy/cloudRun/utils/jobName.ts +7 -2
- package/src/deploy/cloudSql/utils.ts +12 -9
- package/src/deploy/index.ts +2 -1
- package/src/deploy/kubernetes/cloudSql/index.ts +3 -2
- package/src/deploy/kubernetes/deployJob.ts +24 -10
- package/src/deploy/kubernetes/index.ts +15 -8
- package/src/deploy/kubernetes/kubeEnv.ts +8 -6
- package/src/deploy/kubernetes/kubeValues.ts +0 -1
- package/src/deploy/kubernetes/processSecretsAsFiles.ts +2 -1
- package/src/deploy/types/base.ts +6 -0
- package/src/deploy/types/googleCloudRun.ts +2 -0
- package/src/index.ts +2 -1
- package/src/packageInfos.ts +10 -0
- package/src/pipeline/createAllJobs.ts +24 -10
- package/src/pipeline/createChildPipeline.ts +19 -8
- package/src/pipeline/createJobsForComponent.ts +14 -22
- package/src/pipeline/createMainPipeline.ts +88 -0
- package/src/pipeline/generatePipelineFiles.ts +29 -0
- package/src/pipeline/gitlab/createGitlabJobs.ts +174 -51
- package/src/pipeline/gitlab/createGitlabPipeline.ts +16 -14
- package/src/pipeline/gitlab/getPipelineTriggerForGitlabChildPipeline.ts +46 -0
- package/src/pipeline/gitlab/gitlabReleaseJobs.ts +20 -0
- package/src/pipeline/index.ts +2 -0
- package/src/rules/index.ts +15 -9
- package/src/types/config.ts +11 -2
- package/src/types/context.ts +39 -26
- package/src/types/environmentContext.ts +12 -6
- package/src/types/gitlab-ci-yml.ts +0 -1
- package/src/types/gitlab-types.ts +5 -4
- package/src/types/jobs.ts +28 -3
- package/src/types/pipeline.ts +4 -0
- package/src/utils/writeFiles.ts +40 -0
- package/dist/deploy/cloudRun/createJobs/variables.d.ts +0 -5
- package/dist/deploy/cloudRun/createJobs/variables.js +0 -19
- package/dist/pipeline/commitInfo/getBuildId.d.ts +0 -6
- package/dist/pipeline/commitInfo/getCommitInfo.d.ts +0 -2
- package/src/deploy/cloudRun/createJobs/variables.ts +0 -21
- package/src/pipeline/commitInfo/getBuildId.ts +0 -17
- package/src/pipeline/commitInfo/getCommitInfo.ts +0 -15
|
@@ -70,7 +70,6 @@ export const createKubeValues = (context: Context) => {
|
|
|
70
70
|
|
|
71
71
|
// we remove the application config because it can be just the value `false` which is a convenience feature, but not supported in the helm chart
|
|
72
72
|
// we only merge the rest of the values in
|
|
73
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
74
73
|
const { application, jobs, cronjobs, ...rest } = values ?? {};
|
|
75
74
|
|
|
76
75
|
const env = createKubeEnv(context);
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { omit } from "lodash";
|
|
2
2
|
import type { DeployConfigKubernetesValues } from "../types";
|
|
3
|
+
import type { StringOrBashExpression } from "../../bash/BashExpression";
|
|
3
4
|
|
|
4
5
|
export const processSecretsAsFiles = <
|
|
5
6
|
T extends {
|
|
6
7
|
env: {
|
|
7
|
-
secret: Record<string,
|
|
8
|
+
secret: Record<string, StringOrBashExpression>;
|
|
8
9
|
};
|
|
9
10
|
} & DeployConfigKubernetesValues
|
|
10
11
|
>(
|
package/src/deploy/types/base.ts
CHANGED
|
@@ -31,6 +31,12 @@ export type DeployConfigBase = {
|
|
|
31
31
|
* @deprecated use deploy.jobVars for deploy job specific variables
|
|
32
32
|
*/
|
|
33
33
|
extraVars?: Record<string, string>;
|
|
34
|
+
/**
|
|
35
|
+
* additional vars only for the runner.
|
|
36
|
+
* Also if you use services: that require env vars, you need to set them here.
|
|
37
|
+
*
|
|
38
|
+
*/
|
|
39
|
+
runnerVariables?: Record<string, string>;
|
|
34
40
|
};
|
|
35
41
|
|
|
36
42
|
export type AllowUnknownProps<T extends Record<string, unknown>> = T &
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from "./pipeline
|
|
1
|
+
export * from "./pipeline";
|
|
2
2
|
export * from "./types";
|
|
3
3
|
export * from "./rules";
|
|
4
4
|
export * from "./runner";
|
|
@@ -6,3 +6,4 @@ export * from "./config";
|
|
|
6
6
|
export * from "./context";
|
|
7
7
|
export * from "./build";
|
|
8
8
|
export * from "./deploy";
|
|
9
|
+
export * from "./utils/writeFiles";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// we can't import the package.json directly, because the bundling process will inline it
|
|
2
|
+
// but the version is only set during deployement, when its already bundled
|
|
3
|
+
// instead we need to use require.main.path to get the path of the main module, which is actually the file in the bin
|
|
4
|
+
// this will point to the root package.json
|
|
5
|
+
|
|
6
|
+
const path = require.main?.path + "/../package.json";
|
|
7
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
8
|
+
const ownPkg = require(path);
|
|
9
|
+
|
|
10
|
+
export default ownPkg;
|
|
@@ -1,17 +1,29 @@
|
|
|
1
1
|
import { getAllEnvsByTrigger } from "../config";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
2
|
+
import type {
|
|
3
|
+
CatladderJobWithContext,
|
|
4
|
+
Config,
|
|
5
|
+
PipelineTrigger,
|
|
6
|
+
PipelineType,
|
|
7
|
+
} from "../types";
|
|
4
8
|
import { createJobsForComponent } from "./createJobsForComponent";
|
|
5
9
|
|
|
6
10
|
export type AllCatladderJobs = {
|
|
7
11
|
[componentName: string]: {
|
|
8
|
-
[env: string]: Array<
|
|
12
|
+
[env: string]: Array<CatladderJobWithContext>;
|
|
9
13
|
};
|
|
10
14
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
+
|
|
16
|
+
export type AllJobsContext = {
|
|
17
|
+
config: Config;
|
|
18
|
+
trigger: PipelineTrigger;
|
|
19
|
+
pipelineType: PipelineType;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const createAllJobs = async ({
|
|
23
|
+
config,
|
|
24
|
+
trigger,
|
|
25
|
+
pipelineType,
|
|
26
|
+
}: AllJobsContext): Promise<AllCatladderJobs> => {
|
|
15
27
|
return Object.fromEntries(
|
|
16
28
|
await Promise.all(
|
|
17
29
|
Object.keys(config.components).map(async (componentName) => {
|
|
@@ -22,12 +34,14 @@ export const createAllJobs = async (
|
|
|
22
34
|
await Promise.all(
|
|
23
35
|
envs.map(async (env) => [
|
|
24
36
|
env,
|
|
25
|
-
|
|
37
|
+
|
|
38
|
+
await createJobsForComponent({
|
|
26
39
|
config,
|
|
27
40
|
componentName,
|
|
28
41
|
env,
|
|
29
|
-
trigger
|
|
30
|
-
|
|
42
|
+
trigger,
|
|
43
|
+
pipelineType,
|
|
44
|
+
}),
|
|
31
45
|
])
|
|
32
46
|
)
|
|
33
47
|
),
|
|
@@ -1,24 +1,35 @@
|
|
|
1
|
+
import { RULES_ALWAYS } from "../rules";
|
|
2
|
+
|
|
1
3
|
import type { Pipeline, PipelineType } from "../types";
|
|
2
4
|
import type { Config, PipelineTrigger } from "../types/config";
|
|
3
5
|
import { createAllJobs } from "./createAllJobs";
|
|
4
6
|
import { getPipelineStages } from "./getPipelineStages";
|
|
5
7
|
import { createGitlabJobs } from "./gitlab/createGitlabJobs";
|
|
6
|
-
import {
|
|
8
|
+
import { createGitlabPipelineWithDefaults } from "./gitlab/createGitlabPipeline";
|
|
7
9
|
|
|
8
10
|
export const createChildPipeline = async <T extends PipelineType>(
|
|
9
|
-
|
|
11
|
+
pipelineType: T,
|
|
10
12
|
trigger: PipelineTrigger,
|
|
11
13
|
config: Config
|
|
12
14
|
): Promise<Pipeline<T>> => {
|
|
13
|
-
const jobs = await createAllJobs(
|
|
15
|
+
const jobs = await createAllJobs({
|
|
16
|
+
config,
|
|
17
|
+
trigger,
|
|
18
|
+
pipelineType,
|
|
19
|
+
});
|
|
14
20
|
const stages = getPipelineStages(config);
|
|
15
21
|
|
|
16
|
-
if (
|
|
22
|
+
if (pipelineType === "gitlab") {
|
|
17
23
|
const gitlabJobs = await createGitlabJobs(jobs);
|
|
18
|
-
return
|
|
24
|
+
return createGitlabPipelineWithDefaults({
|
|
25
|
+
workflow: {
|
|
26
|
+
rules: RULES_ALWAYS,
|
|
27
|
+
},
|
|
19
28
|
stages,
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
jobs: Object.fromEntries(
|
|
30
|
+
gitlabJobs.map(({ gitlabJob, name }) => [name, gitlabJob])
|
|
31
|
+
),
|
|
32
|
+
}) as Pipeline<T>;
|
|
22
33
|
}
|
|
23
|
-
throw new Error(`${
|
|
34
|
+
throw new Error(`${pipelineType} is not supported`);
|
|
24
35
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { isFunction } from "lodash";
|
|
2
2
|
import { BUILD_TYPES } from "../build";
|
|
3
|
+
import type { CreateContextContext } from "../context";
|
|
3
4
|
import { createContext } from "../context";
|
|
4
5
|
import { DEPLOY_TYPES } from "../deploy";
|
|
5
|
-
import type {
|
|
6
|
-
import type { CommitInfo, Context } from "../types/context";
|
|
6
|
+
import type { CatladderJobWithContext, Context } from "../types/context";
|
|
7
7
|
import type { CatladderJob } from "../types/jobs";
|
|
8
|
-
import { getBaseCommitInfo } from "./commitInfo/getCommitInfo";
|
|
9
8
|
import { getPackageManagerInfo } from "./packageManager";
|
|
10
9
|
|
|
11
10
|
const injectDefaultVarsInCustomJobs = (
|
|
@@ -39,25 +38,18 @@ const createRawJobs = (context: Context): CatladderJob[] => {
|
|
|
39
38
|
const customJobs = getCustomJobs(context);
|
|
40
39
|
return [...buildJobs, ...deployJobs, ...customJobs];
|
|
41
40
|
};
|
|
42
|
-
export const createJobsForComponent = async (
|
|
43
|
-
config: Config,
|
|
44
|
-
componentName: string,
|
|
45
|
-
env: string,
|
|
46
|
-
trigger: PipelineTrigger
|
|
47
|
-
): Promise<Array<CatladderJob>> => {
|
|
48
|
-
const commitInfo: CommitInfo = {
|
|
49
|
-
...(await getBaseCommitInfo()),
|
|
50
|
-
trigger,
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const packageManagerInfo = await getPackageManagerInfo(config, componentName);
|
|
54
41
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
42
|
+
export const createJobsForComponent = async (
|
|
43
|
+
contextContext: Omit<CreateContextContext, "packageManagerInfo">
|
|
44
|
+
): Promise<Array<CatladderJobWithContext>> => {
|
|
45
|
+
const packageManagerInfo = await getPackageManagerInfo(
|
|
46
|
+
contextContext.config,
|
|
47
|
+
contextContext.componentName
|
|
61
48
|
);
|
|
62
|
-
|
|
49
|
+
|
|
50
|
+
const context = await createContext({
|
|
51
|
+
...contextContext,
|
|
52
|
+
packageManagerInfo,
|
|
53
|
+
});
|
|
54
|
+
return createRawJobs(context).map((job) => ({ ...job, context }));
|
|
63
55
|
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import {
|
|
2
|
+
RULE_IS_MAIN_BRANCH,
|
|
3
|
+
RULE_IS_MERGE_REQUEST,
|
|
4
|
+
RULE_IS_TAGGED_RELEASE,
|
|
5
|
+
RULE_NEVER_ON_RELEASE_COMMIT,
|
|
6
|
+
} from "../rules";
|
|
7
|
+
import type {
|
|
8
|
+
GitlabJobDef,
|
|
9
|
+
GitlabRule,
|
|
10
|
+
Pipeline,
|
|
11
|
+
PipelineTrigger,
|
|
12
|
+
PipelineType,
|
|
13
|
+
} from "../types";
|
|
14
|
+
import { ALL_PIPELINE_TRIGGERS, type Config } from "../types/config";
|
|
15
|
+
import { createAllJobs } from "./createAllJobs";
|
|
16
|
+
import { getPipelineStages } from "./getPipelineStages";
|
|
17
|
+
import { createGitlabJobs } from "./gitlab/createGitlabJobs";
|
|
18
|
+
import { createGitlabPipelineWithDefaults } from "./gitlab/createGitlabPipeline";
|
|
19
|
+
import { getGitlabReleaseJobs } from "./gitlab/gitlabReleaseJobs";
|
|
20
|
+
|
|
21
|
+
export const createMainPipeline = async <T extends PipelineType>(
|
|
22
|
+
pipelineType: T,
|
|
23
|
+
config: Config
|
|
24
|
+
): Promise<Pipeline<T>> => {
|
|
25
|
+
const stages = getPipelineStages(config);
|
|
26
|
+
|
|
27
|
+
if (pipelineType === "gitlab") {
|
|
28
|
+
// for all triggers create jobs and add base rules
|
|
29
|
+
|
|
30
|
+
const allJobsPerTrigger = await Promise.all(
|
|
31
|
+
ALL_PIPELINE_TRIGGERS.map(
|
|
32
|
+
async (trigger) =>
|
|
33
|
+
await createGitlabJobs(
|
|
34
|
+
await createAllJobs({ config, trigger, pipelineType }),
|
|
35
|
+
getGitlabRulesForTrigger(trigger)
|
|
36
|
+
)
|
|
37
|
+
)
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
const allJobs = allJobsPerTrigger
|
|
41
|
+
.flat()
|
|
42
|
+
// sort by componentName in the same order as they appear in the config
|
|
43
|
+
// this is purely for better readability in git diffs when you add new components
|
|
44
|
+
.sort((a, b) => {
|
|
45
|
+
const componentNames = Object.keys(config.components);
|
|
46
|
+
const aIndex = componentNames.findIndex((c) => c === a.componentName);
|
|
47
|
+
const bIndex = componentNames.findIndex((c) => c === b.componentName);
|
|
48
|
+
return aIndex - bIndex;
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
.reduce((acc, { gitlabJob, name }) => {
|
|
52
|
+
// merge jobs, if a job is already there, merge the rules
|
|
53
|
+
// this is currently needed because of envMode: "none", which creates the same job for all triggers, so it can appear multiple times
|
|
54
|
+
if (acc[name]) {
|
|
55
|
+
acc[name].rules = [
|
|
56
|
+
...(acc[name].rules ?? []),
|
|
57
|
+
...(gitlabJob.rules ?? []),
|
|
58
|
+
];
|
|
59
|
+
} else {
|
|
60
|
+
acc[name] = gitlabJob;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return acc;
|
|
64
|
+
}, {} as { [key: string]: GitlabJobDef });
|
|
65
|
+
|
|
66
|
+
return createGitlabPipelineWithDefaults({
|
|
67
|
+
stages: [...stages, "release"],
|
|
68
|
+
jobs: {
|
|
69
|
+
...allJobs,
|
|
70
|
+
...getGitlabReleaseJobs(),
|
|
71
|
+
},
|
|
72
|
+
}) as Pipeline<T>;
|
|
73
|
+
}
|
|
74
|
+
throw new Error(`${pipelineType} is not supported`);
|
|
75
|
+
};
|
|
76
|
+
function getGitlabRulesForTrigger(trigger: PipelineTrigger): GitlabRule[] {
|
|
77
|
+
// mainBranch: on push to main branch
|
|
78
|
+
// mr: on merge request
|
|
79
|
+
// taggedRelease: on tag
|
|
80
|
+
switch (trigger) {
|
|
81
|
+
case "mainBranch":
|
|
82
|
+
return [RULE_NEVER_ON_RELEASE_COMMIT, RULE_IS_MAIN_BRANCH];
|
|
83
|
+
case "mr":
|
|
84
|
+
return [RULE_IS_MERGE_REQUEST];
|
|
85
|
+
case "taggedRelease":
|
|
86
|
+
return [RULE_IS_TAGGED_RELEASE];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Config, PipelineMode, PipelineType } from "../types";
|
|
2
|
+
import { writeYamlfile } from "../utils/writeFiles";
|
|
3
|
+
import { createChildPipeline } from "./createChildPipeline";
|
|
4
|
+
import { createMainPipeline } from "./createMainPipeline";
|
|
5
|
+
import { getPipelineTriggerForGitlabChildPipeline } from "./gitlab/getPipelineTriggerForGitlabChildPipeline";
|
|
6
|
+
export async function generatePipelineFiles<T extends PipelineType>(
|
|
7
|
+
config: Config,
|
|
8
|
+
pipelineType: T,
|
|
9
|
+
mode: PipelineMode<T>
|
|
10
|
+
) {
|
|
11
|
+
if (mode === "childpipeline") {
|
|
12
|
+
const trigger = getPipelineTriggerForGitlabChildPipeline();
|
|
13
|
+
|
|
14
|
+
const { jobs, ...mainPipeline } = await createChildPipeline(
|
|
15
|
+
pipelineType,
|
|
16
|
+
trigger,
|
|
17
|
+
config
|
|
18
|
+
);
|
|
19
|
+
// need to spread out the jobs, forgot why
|
|
20
|
+
await writeYamlfile(`__pipeline.yml`, { ...jobs, ...mainPipeline });
|
|
21
|
+
} else {
|
|
22
|
+
const { jobs, ...mainPipeline } = await createMainPipeline(
|
|
23
|
+
pipelineType,
|
|
24
|
+
config
|
|
25
|
+
);
|
|
26
|
+
// need to spread out the jobs, forgot why
|
|
27
|
+
await writeYamlfile(`.gitlab-ci.yml`, { ...jobs, ...mainPipeline });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -1,16 +1,29 @@
|
|
|
1
|
-
import { isObject } from "lodash";
|
|
1
|
+
import { isObject, merge } from "lodash";
|
|
2
|
+
import { getInjectVarsScript } from "../../bash/getInjectVarsScript";
|
|
2
3
|
import { BASE_RETRY } from "../../defaults";
|
|
3
|
-
import type {
|
|
4
|
+
import type {
|
|
5
|
+
CatladderJobWithContext,
|
|
6
|
+
Context,
|
|
7
|
+
GitlabJobDef,
|
|
8
|
+
GitlabRule,
|
|
9
|
+
} from "../../types";
|
|
4
10
|
import type { CatladderJob, CatladderJobNeed } from "../../types/jobs";
|
|
5
|
-
import type { AllCatladderJobs } from "../createAllJobs";
|
|
6
11
|
import { notNil } from "../../utils";
|
|
12
|
+
import { collapseableSection } from "../../utils/gitlab";
|
|
13
|
+
import type { AllCatladderJobs } from "../createAllJobs";
|
|
7
14
|
|
|
8
|
-
export type AllGitlabJobs =
|
|
15
|
+
export type AllGitlabJobs = {
|
|
16
|
+
name: string;
|
|
17
|
+
gitlabJob: GitlabJobDef;
|
|
18
|
+
componentName: string;
|
|
19
|
+
env: string;
|
|
20
|
+
}[];
|
|
9
21
|
|
|
10
|
-
const
|
|
22
|
+
export const GITLAB_ENVIRONMENT_URL_VARIABLE = "CL_GITLAB_ENVIRONMENT_URL";
|
|
23
|
+
const removeUndefined = (obj: GitlabJobDef): GitlabJobDef =>
|
|
11
24
|
Object.fromEntries(
|
|
12
25
|
Object.entries(obj).filter(([, value]) => value !== undefined)
|
|
13
|
-
) as
|
|
26
|
+
) as GitlabJobDef;
|
|
14
27
|
const getFullJobName = (
|
|
15
28
|
name: string,
|
|
16
29
|
componentName: string,
|
|
@@ -47,6 +60,7 @@ export const makeGitlabJob = (
|
|
|
47
60
|
componentName: string,
|
|
48
61
|
env: string,
|
|
49
62
|
{
|
|
63
|
+
environment,
|
|
50
64
|
envMode,
|
|
51
65
|
needsStages,
|
|
52
66
|
needsOtherComponent,
|
|
@@ -54,9 +68,14 @@ export const makeGitlabJob = (
|
|
|
54
68
|
needs,
|
|
55
69
|
jobTags,
|
|
56
70
|
script,
|
|
71
|
+
context,
|
|
72
|
+
variables,
|
|
73
|
+
runnerVariables,
|
|
74
|
+
when,
|
|
57
75
|
...job
|
|
58
|
-
}:
|
|
59
|
-
allJobs: AllCatladderJobs
|
|
76
|
+
}: CatladderJobWithContext<string>,
|
|
77
|
+
allJobs: AllCatladderJobs,
|
|
78
|
+
baseRules?: GitlabRule[]
|
|
60
79
|
): [fullName: string, job: GitlabJobDef] => {
|
|
61
80
|
const stage = envMode === "stagePerEnv" ? `${job.stage} ${env}` : job.stage;
|
|
62
81
|
|
|
@@ -106,57 +125,161 @@ export const makeGitlabJob = (
|
|
|
106
125
|
envMode !== "none" ? env : undefined
|
|
107
126
|
);
|
|
108
127
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
// backwards compatibility, some may still use KUBERNETES_CPU_REQUEST, KUBERNETES_MEMORY_REQUEST, etc. in variables.
|
|
129
|
+
// those should now be set in the runnerVariables as they don't work in the variables key of the catladder job, becuase those get injected
|
|
130
|
+
const PIPELINE_RUNNER_VARIABLES = [
|
|
131
|
+
"KUBERNETES_CPU_REQUEST",
|
|
132
|
+
"KUBERNETES_MEMORY_REQUEST",
|
|
133
|
+
"KUBERNETES_CPU_LIMIT",
|
|
134
|
+
"KUBERNETES_MEMORY_LIMIT",
|
|
135
|
+
];
|
|
136
|
+
// remove those from variables and add them to runnerVariables
|
|
137
|
+
|
|
138
|
+
const varsInjectScripts = collapseableSection(
|
|
139
|
+
"injectvars",
|
|
140
|
+
"Injecting variables"
|
|
141
|
+
)([
|
|
142
|
+
...getInjectVarsScript(
|
|
143
|
+
// remove legacy variables
|
|
144
|
+
Object.fromEntries(
|
|
145
|
+
Object.entries(variables ?? {}).filter(
|
|
146
|
+
([key]) => !PIPELINE_RUNNER_VARIABLES.includes(key)
|
|
147
|
+
)
|
|
148
|
+
)
|
|
149
|
+
),
|
|
150
|
+
]);
|
|
151
|
+
|
|
152
|
+
const legacyRunnerVariables = Object.fromEntries(
|
|
153
|
+
Object.entries(variables ?? {}).filter(([key]) =>
|
|
154
|
+
PIPELINE_RUNNER_VARIABLES.includes(key)
|
|
155
|
+
)
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
if (Object.keys(legacyRunnerVariables).length > 0) {
|
|
159
|
+
console.warn(
|
|
160
|
+
`Legacy variables detected in ${fullJobName}: ${Object.keys(
|
|
161
|
+
legacyRunnerVariables
|
|
162
|
+
).join(", ")}. Please move them to the runnerVariables key.`
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
const rules = [
|
|
166
|
+
...(job.rules ?? []),
|
|
167
|
+
...(baseRules
|
|
168
|
+
? baseRules.map((rule) => ({
|
|
169
|
+
when: when,
|
|
170
|
+
...rule,
|
|
171
|
+
}))
|
|
172
|
+
: when
|
|
173
|
+
? [{ when }]
|
|
174
|
+
: []),
|
|
175
|
+
];
|
|
176
|
+
const modified = addGitlabEnvironment(
|
|
177
|
+
context,
|
|
178
|
+
environment,
|
|
179
|
+
{
|
|
180
|
+
...job,
|
|
181
|
+
rules: rules.length > 0 ? rules : undefined,
|
|
182
|
+
variables: {
|
|
183
|
+
...legacyRunnerVariables,
|
|
184
|
+
...runnerVariables,
|
|
185
|
+
},
|
|
186
|
+
script: [...varsInjectScripts, ...(script?.filter(notNil) ?? [])],
|
|
187
|
+
tags: jobTags,
|
|
188
|
+
stage,
|
|
189
|
+
|
|
190
|
+
// sort in a predictable manner for snapshot tests
|
|
191
|
+
needs: deduplicatedGitlabNeeds,
|
|
192
|
+
retry: BASE_RETRY,
|
|
193
|
+
interruptible: true,
|
|
194
|
+
},
|
|
195
|
+
componentName,
|
|
196
|
+
env,
|
|
197
|
+
allJobs
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
const gitlabJob: GitlabJobDef = removeUndefined(modified);
|
|
130
201
|
|
|
131
202
|
return [fullJobName, gitlabJob];
|
|
132
203
|
};
|
|
133
204
|
|
|
134
|
-
|
|
205
|
+
const addGitlabEnvironment = (
|
|
206
|
+
context: Context,
|
|
207
|
+
environment: CatladderJob["environment"],
|
|
208
|
+
job: GitlabJobDef,
|
|
209
|
+
componentName: string,
|
|
210
|
+
env: string, // TODO: we could actually pull this from contxt
|
|
135
211
|
allJobs: AllCatladderJobs
|
|
136
|
-
):
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
212
|
+
): GitlabJobDef => {
|
|
213
|
+
if (!environment) {
|
|
214
|
+
return job;
|
|
215
|
+
}
|
|
216
|
+
const { url, envType } = context.environment;
|
|
217
|
+
const { on_stop, ...restEnvironment } = environment;
|
|
218
|
+
// those can be dynamic, so we therefore have to do this: https://docs.gitlab.com/ee/ci/environments/#set-a-dynamic-environment-url
|
|
143
219
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
220
|
+
const dotEnvFile = "gitlab_environment.env";
|
|
221
|
+
|
|
222
|
+
const scriptToAdd = [
|
|
223
|
+
`echo "${GITLAB_ENVIRONMENT_URL_VARIABLE}=${url}" >> ${dotEnvFile}`,
|
|
224
|
+
];
|
|
225
|
+
|
|
226
|
+
// this is NOT a bashVariable since it NEEDS to be used as a string in gitlab
|
|
227
|
+
const gitlabEnvironmentName =
|
|
228
|
+
envType === "review"
|
|
229
|
+
? `${env}/$CI_COMMIT_REF_NAME/${componentName}` // FIXME: should be replaced with mr name as well
|
|
230
|
+
: `${env}/${componentName}`;
|
|
231
|
+
|
|
232
|
+
return {
|
|
233
|
+
...job,
|
|
234
|
+
environment: {
|
|
235
|
+
name: gitlabEnvironmentName,
|
|
236
|
+
url: `$${GITLAB_ENVIRONMENT_URL_VARIABLE}`,
|
|
237
|
+
...(on_stop
|
|
238
|
+
? {
|
|
239
|
+
on_stop: getFullReferencedJobName(
|
|
240
|
+
on_stop,
|
|
148
241
|
componentName,
|
|
149
242
|
env,
|
|
150
|
-
job,
|
|
151
243
|
allJobs
|
|
152
|
-
)
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
244
|
+
),
|
|
245
|
+
}
|
|
246
|
+
: {}),
|
|
247
|
+
...restEnvironment,
|
|
248
|
+
},
|
|
249
|
+
artifacts: merge(job.artifacts ?? {}, {
|
|
250
|
+
reports: {
|
|
251
|
+
dotenv: `${dotEnvFile}`,
|
|
252
|
+
},
|
|
253
|
+
}),
|
|
254
|
+
|
|
255
|
+
script: [...(job.script ?? []), ...scriptToAdd],
|
|
256
|
+
};
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export const createGitlabJobs = async (
|
|
260
|
+
allJobs: AllCatladderJobs,
|
|
261
|
+
baseRules?: GitlabRule[]
|
|
262
|
+
): Promise<AllGitlabJobs> => {
|
|
263
|
+
return Object.keys(allJobs).flatMap((componentName) => {
|
|
264
|
+
const componentJobs = allJobs[componentName];
|
|
265
|
+
return Object.keys(componentJobs).flatMap((env) => {
|
|
266
|
+
const jobs = componentJobs[env];
|
|
267
|
+
|
|
268
|
+
return jobs.flatMap((job) => {
|
|
269
|
+
const [fullJobName, gitlabJob] = makeGitlabJob(
|
|
270
|
+
componentName,
|
|
271
|
+
env,
|
|
272
|
+
job,
|
|
273
|
+
allJobs,
|
|
274
|
+
baseRules
|
|
275
|
+
);
|
|
276
|
+
return {
|
|
277
|
+
name: fullJobName,
|
|
278
|
+
gitlabJob,
|
|
279
|
+
componentName,
|
|
280
|
+
env,
|
|
158
281
|
};
|
|
159
|
-
}
|
|
160
|
-
};
|
|
161
|
-
}
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
});
|
|
162
285
|
};
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import { RULES_ALWAYS } from "../../rules";
|
|
2
1
|
import { getRunnerImage } from "../../runner";
|
|
3
2
|
import type { Pipeline } from "../../types";
|
|
4
|
-
import type { AllGitlabJobs } from "./createGitlabJobs";
|
|
5
3
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
type PickRequired<T, K extends keyof T> = Required<Pick<T, K>> & Omit<T, K>;
|
|
5
|
+
|
|
6
|
+
export const createGitlabPipelineWithDefaults = ({
|
|
7
|
+
image,
|
|
8
|
+
variables,
|
|
9
|
+
...config
|
|
10
|
+
}: PickRequired<
|
|
11
|
+
Partial<Pipeline<"gitlab">>,
|
|
12
|
+
"stages" | "jobs"
|
|
13
|
+
>): Pipeline<"gitlab"> => {
|
|
10
14
|
return {
|
|
11
|
-
image: getRunnerImage("jobs-default"), // default image
|
|
15
|
+
image: image ?? getRunnerImage("jobs-default"), // default image
|
|
12
16
|
variables: {
|
|
13
17
|
FF_USE_FASTZIP: "true",
|
|
14
|
-
GIT_DEPTH: 1, // no need the full depth
|
|
15
|
-
|
|
16
|
-
workflow: {
|
|
17
|
-
rules: RULES_ALWAYS,
|
|
18
|
+
GIT_DEPTH: "1", // no need the full depth
|
|
19
|
+
...(variables ?? {}),
|
|
18
20
|
},
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
|
|
22
|
+
...config,
|
|
21
23
|
};
|
|
22
|
-
}
|
|
24
|
+
};
|