@catladder/pipeline 0.0.0-node16-ddfae617 → 0.0.0-prettier-cbceeed9
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/bin/catladder-gitlab-dev.js +3 -0
- package/bin/catladder-gitlab.js +1 -1
- package/dist/build/base/createBuildJob.d.ts +2 -2
- package/dist/build/base/createBuildJob.js +15 -30
- package/dist/build/base/writeBuildInfo.d.ts +2 -0
- package/dist/build/base/{getBuildInfo.js → writeBuildInfo.js} +3 -6
- package/dist/build/custom/buildJob.d.ts +3 -0
- package/dist/build/custom/buildJob.js +83 -0
- package/dist/build/custom/index.d.ts +3 -0
- package/dist/build/custom/index.js +40 -0
- package/dist/build/docker.d.ts +33 -9
- package/dist/build/docker.js +51 -54
- package/dist/build/index.d.ts +6 -5
- package/dist/build/index.js +20 -6
- package/dist/build/node/buildJob.d.ts +2 -2
- package/dist/build/node/buildJob.js +3 -25
- package/dist/build/node/cache.d.ts +2 -2
- package/dist/build/node/cache.js +19 -22
- package/dist/build/node/index.d.ts +1 -1
- package/dist/build/node/index.js +3 -16
- package/dist/build/node/meteor.d.ts +1 -1
- package/dist/build/node/meteor.js +9 -20
- package/dist/build/node/testJob.d.ts +2 -2
- package/dist/build/node/testJob.js +7 -21
- package/dist/build/node/yarn.d.ts +1 -1
- package/dist/build/node/yarn.js +14 -15
- package/dist/build/rails/build.d.ts +3 -0
- package/dist/build/rails/build.js +51 -0
- package/dist/build/rails/index.d.ts +3 -0
- package/dist/build/rails/index.js +41 -0
- package/dist/build/rails/test.d.ts +3 -0
- package/dist/build/rails/test.js +94 -0
- package/dist/build/types.d.ts +84 -9
- package/dist/build/types.js +0 -4
- package/dist/bundles/catladder-gitlab/index.js +32979 -0
- package/dist/catladder-gitlab.js +7 -26
- package/dist/config/{configruedEnvs.test.d.ts → __tests__/configruedEnvs.test.d.ts} +0 -0
- package/dist/config/{configruedEnvs.test.js → __tests__/configruedEnvs.test.js} +10 -12
- package/dist/config/configruedEnvs.d.ts +1 -1
- package/dist/config/configruedEnvs.js +7 -22
- package/dist/config/index.js +0 -4
- package/dist/config/readConfig.d.ts +1 -1
- package/dist/config/readConfig.js +2 -13
- package/dist/constants.js +1 -1
- package/dist/context/{resolveReferences.test.d.ts → __tests__/resolveReferences.test.d.ts} +0 -0
- package/dist/context/__tests__/resolveReferences.test.js +336 -0
- package/dist/context/getEnvConfig.d.ts +2 -0
- package/dist/context/getEnvConfig.js +18 -0
- package/dist/context/getEnvType.d.ts +4 -0
- package/dist/context/getEnvType.js +13 -0
- package/dist/context/getEnvironment.d.ts +3 -0
- package/dist/{pipeline/createChildPipeline.test.js → context/getEnvironment.js} +42 -84
- package/dist/context/getEnvironmentContext.d.ts +4 -0
- package/dist/context/getEnvironmentContext.js +33 -0
- package/dist/context/getEnvironmentVariables.d.ts +10 -0
- package/dist/context/getEnvironmentVariables.js +260 -0
- package/dist/context/getLabels.d.ts +8 -0
- package/dist/context/getLabels.js +38 -0
- package/dist/context/index.d.ts +5 -6
- package/dist/context/index.js +158 -208
- package/dist/context/resolveReferences.d.ts +1 -3
- package/dist/context/resolveReferences.js +213 -52
- package/dist/defaults/index.d.ts +1 -1
- package/dist/deploy/base.d.ts +4 -2
- package/dist/deploy/base.js +38 -33
- package/dist/deploy/cloudRun/deployJob.d.ts +3 -0
- package/dist/deploy/cloudRun/deployJob.js +238 -0
- package/dist/deploy/cloudRun/index.d.ts +4 -0
- package/dist/deploy/cloudRun/index.js +112 -0
- package/dist/deploy/cloudRun/utils/createArgsString.d.ts +11 -0
- package/dist/deploy/cloudRun/utils/createArgsString.js +55 -0
- package/dist/deploy/cloudRun/utils/database.d.ts +4 -0
- package/dist/deploy/cloudRun/utils/database.js +64 -0
- package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.d.ts +2 -0
- package/dist/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.js +10 -0
- package/dist/deploy/cloudRun/utils/jobName.d.ts +1 -0
- package/dist/deploy/cloudRun/utils/jobName.js +8 -0
- package/dist/deploy/custom/deployJob.d.ts +2 -2
- package/dist/deploy/custom/deployJob.js +10 -16
- package/dist/deploy/custom/index.d.ts +2 -1
- package/dist/deploy/custom/index.js +14 -19
- package/dist/deploy/dockerTag/deployJob.d.ts +3 -0
- package/dist/deploy/dockerTag/deployJob.js +24 -0
- package/dist/deploy/dockerTag/index.d.ts +2 -0
- package/dist/deploy/dockerTag/index.js +17 -0
- package/dist/deploy/index.d.ts +12 -8
- package/dist/deploy/index.js +7 -20
- package/dist/deploy/kubernetes/additionalSecretKeys.d.ts +4 -0
- package/dist/deploy/kubernetes/additionalSecretKeys.js +24 -0
- package/dist/deploy/kubernetes/cloudSql/index.d.ts +13 -0
- package/dist/deploy/kubernetes/cloudSql/index.js +30 -0
- package/dist/deploy/kubernetes/deployJob.d.ts +2 -2
- package/dist/deploy/kubernetes/deployJob.js +17 -91
- package/dist/deploy/kubernetes/index.d.ts +3 -1
- package/dist/deploy/kubernetes/index.js +42 -4
- package/dist/deploy/kubernetes/kubeEnv.d.ts +9 -0
- package/dist/deploy/kubernetes/kubeEnv.js +72 -0
- package/dist/deploy/kubernetes/kubeValues.d.ts +97 -0
- package/dist/deploy/kubernetes/kubeValues.js +124 -0
- package/dist/deploy/kubernetes/mongodb.d.ts +18 -5
- package/dist/deploy/kubernetes/mongodb.js +96 -10
- package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +25 -21
- package/dist/deploy/kubernetes/processSecretsAsFiles.js +2 -10
- package/dist/deploy/types/base.d.ts +14 -0
- package/dist/deploy/types/base.js +3 -0
- package/dist/deploy/types/custom.d.ts +33 -0
- package/dist/deploy/types/custom.js +3 -0
- package/dist/deploy/types/dockerTag.d.ts +10 -0
- package/dist/deploy/types/dockerTag.js +3 -0
- package/dist/deploy/types/googleCloudRun.d.ts +121 -0
- package/dist/deploy/types/googleCloudRun.js +3 -0
- package/dist/deploy/types/index.d.ts +22 -0
- package/dist/deploy/types/index.js +31 -0
- package/dist/deploy/types/kubernetes.d.ts +276 -0
- package/dist/deploy/types/kubernetes.js +3 -0
- package/dist/deploy/utils.d.ts +2 -2
- package/dist/deploy/utils.js +3 -10
- package/dist/index.js +0 -10
- package/dist/pipeline/commitInfo/getBuildId.d.ts +1 -0
- package/dist/pipeline/commitInfo/getBuildId.js +135 -0
- package/dist/pipeline/commitInfo/getCommitInfo.d.ts +2 -0
- package/dist/pipeline/commitInfo/getCommitInfo.js +140 -0
- package/dist/pipeline/createAllJobs.d.ts +8 -0
- package/dist/{build/tests/storybook.test.js → pipeline/createAllJobs.js} +54 -104
- package/dist/pipeline/createChildPipeline.d.ts +2 -2
- package/dist/pipeline/createChildPipeline.js +40 -121
- package/dist/pipeline/createJobsForComponent.d.ts +3 -0
- package/dist/pipeline/{createJobs.js → createJobsForComponent.js} +33 -192
- package/dist/pipeline/gitlab/createGitlabJobs.d.ts +14 -0
- package/dist/pipeline/gitlab/createGitlabJobs.js +260 -0
- package/dist/pipeline/index.d.ts +1 -1
- package/dist/pipeline/index.js +1 -5
- package/dist/pipeline/packageManager.d.ts +1 -1
- package/dist/pipeline/packageManager.js +20 -173
- package/dist/pipeline/yarn/yarnUtils.d.ts +4 -0
- package/dist/pipeline/yarn/yarnUtils.js +193 -0
- package/dist/rules/index.d.ts +3 -1
- package/dist/rules/index.js +7 -6
- package/dist/runner/index.d.ts +2 -3
- package/dist/runner/index.js +0 -3
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +19 -25
- package/dist/types/config.js +6 -16
- package/dist/types/context.d.ts +16 -3
- package/dist/types/environmentContext.d.ts +28 -0
- package/dist/types/environmentContext.js +3 -0
- package/dist/types/gitlab-types.d.ts +39 -7
- package/dist/types/index.js +0 -6
- package/dist/types/jobs.d.ts +25 -17
- package/dist/types/jobs.js +1 -1
- package/dist/types/pipeline.d.ts +1 -1
- package/dist/types/utils.d.ts +1 -0
- package/dist/types/utils.js +3 -0
- package/dist/utils/gitlab.d.ts +5 -0
- package/dist/utils/gitlab.js +48 -0
- package/dist/utils/index.js +5 -15
- package/examples/__snapshots__/cloud-run-memory-limit.ts.snap +1560 -0
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.ts.snap +1560 -0
- package/examples/__snapshots__/cloud-run-non-public.ts.snap +1560 -0
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.ts.snap +3092 -0
- package/examples/__snapshots__/cloud-run-with-sql.ts.snap +3103 -0
- package/examples/__snapshots__/custom-build-job.ts.snap +1162 -0
- package/examples/__snapshots__/custom-envs.ts.snap +261 -0
- package/examples/__snapshots__/kubernetes-application-customization.ts.snap +2280 -0
- package/examples/__snapshots__/kubernetes-with-jobs.ts.snap +4077 -0
- package/examples/__snapshots__/rails-k8s-with-worker.ts.snap +1911 -0
- package/examples/__snapshots__/wait-for-other-deploy.ts.snap +1626 -0
- package/examples/__utils__/helpers.ts +14 -0
- package/examples/cloud-run-memory-limit.ts +28 -0
- package/examples/cloud-run-no-cpu-throttling.ts +33 -0
- package/examples/cloud-run-non-public.ts +27 -0
- package/examples/cloud-run-with-sql-reuse-db.ts +54 -0
- package/examples/cloud-run-with-sql.ts +61 -0
- package/examples/custom-build-job.ts +28 -0
- package/examples/custom-envs.ts +31 -0
- package/examples/kubernetes-application-customization.ts +57 -0
- package/examples/kubernetes-with-jobs.ts +68 -0
- package/examples/rails-k8s-with-worker.ts +95 -0
- package/examples/wait-for-other-deploy.ts +36 -0
- package/package.json +16 -13
- package/scripts/bundle +2 -0
- package/src/build/base/createBuildJob.ts +12 -5
- package/src/build/base/{getBuildInfo.ts → writeBuildInfo.ts} +2 -2
- package/src/build/custom/buildJob.ts +64 -0
- package/src/build/custom/index.ts +7 -0
- package/src/build/docker.ts +58 -33
- package/src/build/index.ts +24 -5
- package/src/build/node/buildJob.ts +2 -2
- package/src/build/node/cache.ts +19 -8
- package/src/build/node/index.ts +1 -1
- package/src/build/node/meteor.ts +8 -2
- package/src/build/node/testJob.ts +4 -2
- package/src/build/node/yarn.ts +21 -10
- package/src/build/rails/build.ts +38 -0
- package/src/build/rails/index.ts +8 -0
- package/src/build/rails/test.ts +86 -0
- package/src/build/types.ts +97 -2
- package/src/catladder-gitlab.ts +4 -2
- package/src/config/{configruedEnvs.test.ts → __tests__/configruedEnvs.test.ts} +3 -3
- package/src/config/configruedEnvs.ts +2 -7
- package/src/config/readConfig.ts +1 -1
- package/src/context/{resolveReferences.test.ts → __tests__/resolveReferences.test.ts} +23 -38
- package/src/context/getEnvConfig.ts +21 -0
- package/src/context/getEnvType.ts +17 -0
- package/src/context/getEnvironment.ts +40 -0
- package/src/context/getEnvironmentContext.ts +57 -0
- package/src/context/getEnvironmentVariables.ts +155 -0
- package/src/context/getLabels.ts +20 -0
- package/src/context/index.ts +28 -193
- package/src/context/resolveReferences.ts +35 -31
- package/src/defaults/index.ts +1 -1
- package/src/deploy/base.ts +43 -19
- package/src/deploy/cloudRun/deployJob.ts +276 -0
- package/src/deploy/cloudRun/index.ts +95 -0
- package/src/deploy/cloudRun/utils/createArgsString.ts +26 -0
- package/src/deploy/cloudRun/utils/database.ts +55 -0
- package/src/deploy/cloudRun/utils/gcloudServiceAccountLoginCommands.ts +14 -0
- package/src/deploy/cloudRun/utils/jobName.ts +2 -0
- package/src/deploy/custom/deployJob.ts +13 -3
- package/src/deploy/custom/index.ts +9 -1
- package/src/deploy/dockerTag/deployJob.ts +31 -0
- package/src/deploy/dockerTag/index.ts +9 -0
- package/src/deploy/index.ts +26 -17
- package/src/deploy/kubernetes/additionalSecretKeys.ts +23 -0
- package/src/deploy/kubernetes/cloudSql/index.ts +28 -0
- package/src/deploy/kubernetes/deployJob.ts +21 -78
- package/src/deploy/kubernetes/index.ts +42 -1
- package/src/deploy/kubernetes/kubeEnv.ts +48 -0
- package/src/deploy/kubernetes/kubeValues.ts +96 -0
- package/src/deploy/kubernetes/mongodb.ts +104 -7
- package/src/deploy/kubernetes/processSecretsAsFiles.ts +1 -1
- package/src/deploy/types/base.ts +17 -0
- package/src/deploy/types/custom.ts +36 -0
- package/src/deploy/types/dockerTag.ts +12 -0
- package/src/deploy/types/googleCloudRun.ts +179 -0
- package/src/deploy/types/index.ts +28 -0
- package/src/deploy/types/kubernetes.ts +301 -0
- package/src/deploy/utils.ts +6 -2
- package/src/pipeline/commitInfo/getBuildId.ts +6 -0
- package/src/pipeline/commitInfo/getCommitInfo.ts +12 -0
- package/src/pipeline/createAllJobs.ts +38 -0
- package/src/pipeline/createChildPipeline.ts +9 -20
- package/src/pipeline/createJobsForComponent.ts +64 -0
- package/src/pipeline/gitlab/createGitlabJobs.ts +149 -0
- package/src/pipeline/index.ts +1 -1
- package/src/pipeline/packageManager.ts +4 -38
- package/src/pipeline/yarn/yarnUtils.ts +37 -0
- package/src/rules/index.ts +9 -6
- package/src/runner/index.ts +2 -1
- package/src/types/config.ts +26 -13
- package/src/types/context.ts +23 -2
- package/src/types/environmentContext.ts +33 -0
- package/src/types/gitlab-types.ts +36 -6
- package/src/types/jobs.ts +30 -6
- package/src/types/pipeline.ts +1 -1
- package/src/types/utils.ts +7 -0
- package/src/utils/gitlab.ts +23 -0
- package/tsconfig.json +3 -1
- package/dist/build/base/getBuildInfo.d.ts +0 -2
- package/dist/build/tests/storybook.test.d.ts +0 -1
- package/dist/context/resolveReferences.test.js +0 -141
- package/dist/deploy/kubernetes/cloudsql.d.ts +0 -6
- package/dist/deploy/kubernetes/cloudsql.js +0 -16
- package/dist/deploy/types.d.ts +0 -196
- package/dist/deploy/types.js +0 -16
- package/dist/pipeline/createChildPipeline.test.d.ts +0 -1
- package/dist/pipeline/createJobs.d.ts +0 -3
- package/dist/pipeline/gitlab/makeGitlabJob.d.ts +0 -8
- package/dist/pipeline/gitlab/makeGitlabJob.js +0 -45
- package/src/build/tests/storybook.test.ts +0 -54
- package/src/deploy/kubernetes/cloudsql.ts +0 -12
- package/src/deploy/types.ts +0 -189
- package/src/pipeline/createChildPipeline.test.ts +0 -49
- package/src/pipeline/createJobs.ts +0 -195
- package/src/pipeline/gitlab/makeGitlabJob.ts +0 -16
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { join } from "path";
|
|
2
|
+
import type { Context } from "../../types/context";
|
|
3
|
+
import { ensureArray } from "../../utils";
|
|
4
|
+
import { APP_BUILD_JOB_NAME } from "../base/constants";
|
|
5
|
+
import { createBuildJob } from "../base/createBuildJob";
|
|
6
|
+
import { createDockerBuildJobDefault, requiresDockerBuild } from "../docker";
|
|
7
|
+
import { isOfBuildType } from "../types";
|
|
8
|
+
|
|
9
|
+
import type { CatladderJob } from "../../types/jobs";
|
|
10
|
+
|
|
11
|
+
const RUNNER_BUILD_VARIABLES = {
|
|
12
|
+
KUBERNETES_CPU_REQUEST: "0.5",
|
|
13
|
+
KUBERNETES_CPU_LIMIT: "2",
|
|
14
|
+
KUBERNETES_MEMORY_REQUEST: "2Gi",
|
|
15
|
+
KUBERNETES_MEMORY_LIMIT: "4Gi",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
export const createCustomBuildJobs = (context: Context): CatladderJob[] => {
|
|
19
|
+
const buildConfig = context.componentConfig.build;
|
|
20
|
+
|
|
21
|
+
if (!isOfBuildType(buildConfig, "custom")) {
|
|
22
|
+
throw new Error("deploy config is not custom");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const appBuildJob: CatladderJob | null =
|
|
26
|
+
buildConfig.buildCommand !== null
|
|
27
|
+
? createBuildJob(context, {
|
|
28
|
+
image: buildConfig.jobImage,
|
|
29
|
+
variables: {
|
|
30
|
+
...RUNNER_BUILD_VARIABLES,
|
|
31
|
+
},
|
|
32
|
+
cache: buildConfig.jobCache,
|
|
33
|
+
services: buildConfig.jobServices,
|
|
34
|
+
script: [...(ensureArray(buildConfig.buildCommand) ?? [])],
|
|
35
|
+
artifacts: {
|
|
36
|
+
paths: [
|
|
37
|
+
join(context.componentConfig.dir, "__build_info.json"),
|
|
38
|
+
join(context.componentConfig.dir, "dist"),
|
|
39
|
+
...(buildConfig.artifactsPaths?.map((path) =>
|
|
40
|
+
join(context.componentConfig.dir, path)
|
|
41
|
+
) ?? []),
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
})
|
|
45
|
+
: null;
|
|
46
|
+
return [
|
|
47
|
+
...(appBuildJob ? [appBuildJob] : []),
|
|
48
|
+
...(requiresDockerBuild(context)
|
|
49
|
+
? [
|
|
50
|
+
createDockerBuildJobDefault(context, {
|
|
51
|
+
script: [
|
|
52
|
+
buildConfig.docker?.type === "nginx"
|
|
53
|
+
? "ensureNginxDockerfile"
|
|
54
|
+
: "", // e.g. custom,
|
|
55
|
+
].filter(Boolean),
|
|
56
|
+
|
|
57
|
+
variables: {},
|
|
58
|
+
|
|
59
|
+
needs: appBuildJob ? [APP_BUILD_JOB_NAME] : [],
|
|
60
|
+
}),
|
|
61
|
+
]
|
|
62
|
+
: []),
|
|
63
|
+
];
|
|
64
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Context } from "../../types/context";
|
|
2
|
+
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
+
import { createCustomBuildJobs } from "./buildJob";
|
|
4
|
+
|
|
5
|
+
export const createCustomJobs = (context: Context): CatladderJob[] => {
|
|
6
|
+
return [...createCustomBuildJobs(context)];
|
|
7
|
+
};
|
package/src/build/docker.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { merge } from "lodash";
|
|
2
2
|
import { isOfDeployType } from "../deploy";
|
|
3
3
|
import { getRunnerImage } from "../runner";
|
|
4
|
-
import { Context } from "../types";
|
|
5
|
-
import { CatladderJob } from "../types/jobs";
|
|
4
|
+
import type { Context } from "../types";
|
|
5
|
+
import type { CatladderJob } from "../types/jobs";
|
|
6
6
|
|
|
7
7
|
const DOCKER_RUNNER_BUILD_VARIABLES = {
|
|
8
8
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
@@ -11,73 +11,97 @@ const DOCKER_RUNNER_BUILD_VARIABLES = {
|
|
|
11
11
|
KUBERNETES_MEMORY_LIMIT: "2Gi",
|
|
12
12
|
};
|
|
13
13
|
|
|
14
|
+
export const getDockerImageVariables = (context: Context) => {
|
|
15
|
+
return {
|
|
16
|
+
DOCKER_REGISTRY: "$CI_REGISTRY",
|
|
17
|
+
DOCKER_REGISTRY_IMAGE_PATH: "$CI_REGISTRY_IMAGE",
|
|
18
|
+
DOCKER_CACHE_IMAGE:
|
|
19
|
+
"$DOCKER_REGISTRY_IMAGE_PATH/caches/" + context.componentName,
|
|
20
|
+
DOCKER_IMAGE_NAME:
|
|
21
|
+
context.environment.shortName + "/" + context.componentName,
|
|
22
|
+
DOCKER_IMAGE: "$DOCKER_REGISTRY_IMAGE_PATH/$DOCKER_IMAGE_NAME",
|
|
23
|
+
DOCKER_IMAGE_TAG: "$CI_COMMIT_SHA",
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
14
27
|
export const requiresDockerBuild = (context: Context) => {
|
|
15
28
|
const deployConfig = context.componentConfig.deploy;
|
|
16
29
|
if (isOfDeployType(deployConfig, "kubernetes")) {
|
|
17
30
|
return true;
|
|
18
31
|
}
|
|
19
32
|
|
|
33
|
+
if (isOfDeployType(deployConfig, "google-cloudrun")) {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
|
|
20
37
|
if (isOfDeployType(deployConfig, "custom") && deployConfig.requiresDocker) {
|
|
21
38
|
return true;
|
|
22
39
|
}
|
|
23
40
|
|
|
41
|
+
if (isOfDeployType(deployConfig, "dockerTag")) {
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
|
|
24
45
|
return false;
|
|
25
46
|
};
|
|
26
47
|
|
|
48
|
+
const getDockerBaseVariables = () => ({
|
|
49
|
+
DOCKER_HOST: "tcp://0.0.0.0:2375",
|
|
50
|
+
DOCKER_TLS_CERTDIR: "",
|
|
51
|
+
DOCKER_DRIVER: "overlay2",
|
|
52
|
+
DOCKER_BUILDKIT: "1", // see https://docs.docker.com/develop/develop-images/build_enhancements/
|
|
53
|
+
});
|
|
54
|
+
|
|
27
55
|
export const getDockerBuildVariables = (context: Context) => {
|
|
28
56
|
return {
|
|
29
57
|
...DOCKER_RUNNER_BUILD_VARIABLES,
|
|
30
|
-
DOCKER_BUILDKIT: "1", // see https://docs.docker.com/develop/develop-images/build_enhancements/
|
|
31
58
|
DOCKERFILE_ADDITIONS:
|
|
32
59
|
context.componentConfig.build.docker?.additionsBegin?.join("\n"),
|
|
33
60
|
DOCKERFILE_ADDITIONS_END:
|
|
34
61
|
context.componentConfig.build.docker?.additionsEnd?.join("\n"),
|
|
35
62
|
APP_DIR: context.componentConfig.dir,
|
|
36
|
-
DOCKER_HOST: "tcp://0.0.0.0:2375",
|
|
37
|
-
DOCKER_TLS_CERTDIR: "",
|
|
38
|
-
DOCKER_DIR: ".", // relative to componentdir
|
|
39
|
-
IMAGE_TAG: "$CI_COMMIT_SHA",
|
|
40
|
-
DOCKER_DRIVER: "overlay2",
|
|
41
63
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
context.environment.shortName +
|
|
45
|
-
"/" +
|
|
46
|
-
context.componentName,
|
|
64
|
+
DOCKER_DIR: ".", // relative to componentdir
|
|
65
|
+
...getDockerBaseVariables(),
|
|
47
66
|
|
|
48
|
-
|
|
67
|
+
...getDockerImageVariables(context),
|
|
49
68
|
};
|
|
50
69
|
};
|
|
51
70
|
|
|
52
71
|
export const DOCKER_BUILD_JOB_NAME = "🔨 docker";
|
|
53
|
-
|
|
72
|
+
export const getDockerJobBaseProps = (context: Context) => {
|
|
73
|
+
return {
|
|
74
|
+
image: getRunnerImage("docker-build"),
|
|
75
|
+
services: [
|
|
76
|
+
{
|
|
77
|
+
name: "docker:20-dind", // see see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27300#note_466755332
|
|
78
|
+
command: ["--tls=false"],
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
variables: getDockerBaseVariables(),
|
|
82
|
+
};
|
|
83
|
+
};
|
|
54
84
|
export const createDockerBuildJobBase = (
|
|
55
85
|
context: Context,
|
|
56
|
-
{ script,
|
|
86
|
+
{ script, ...def }: Partial<CatladderJob>
|
|
57
87
|
): CatladderJob => {
|
|
58
88
|
return merge(
|
|
59
89
|
{
|
|
60
90
|
name: DOCKER_BUILD_JOB_NAME,
|
|
61
91
|
envMode: "jobPerEnv",
|
|
62
92
|
stage: "build",
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
services: [
|
|
66
|
-
{
|
|
67
|
-
name: "docker:20-dind", // see see https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27300#note_466755332
|
|
68
|
-
command: ["--tls=false"],
|
|
69
|
-
},
|
|
70
|
-
],
|
|
71
|
-
variables: {
|
|
72
|
-
...getDockerBuildVariables(context),
|
|
73
|
-
...(variables ?? {}),
|
|
74
|
-
},
|
|
93
|
+
...getDockerJobBaseProps(context),
|
|
75
94
|
script: script || [],
|
|
76
95
|
},
|
|
96
|
+
{
|
|
97
|
+
variables: getDockerBuildVariables(context),
|
|
98
|
+
},
|
|
77
99
|
def
|
|
78
100
|
);
|
|
79
101
|
};
|
|
80
102
|
|
|
103
|
+
export const gitlabDockerLogin =
|
|
104
|
+
"docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY";
|
|
81
105
|
export const createDockerBuildJobDefault = (
|
|
82
106
|
context: Context,
|
|
83
107
|
{ script, ...def }: Partial<CatladderJob>
|
|
@@ -85,11 +109,12 @@ export const createDockerBuildJobDefault = (
|
|
|
85
109
|
return createDockerBuildJobBase(context, {
|
|
86
110
|
script: [
|
|
87
111
|
...(script || []),
|
|
88
|
-
|
|
89
|
-
"docker
|
|
90
|
-
"docker
|
|
91
|
-
"docker
|
|
92
|
-
"docker
|
|
112
|
+
gitlabDockerLogin,
|
|
113
|
+
"docker version",
|
|
114
|
+
"docker build --network host --cache-from $DOCKER_CACHE_IMAGE --tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1", //BUILDKIT_INLINE_CACHE, see https://testdriven.io/blog/faster-ci-builds-with-docker-cache/
|
|
115
|
+
"docker push $DOCKER_IMAGE:$DOCKER_IMAGE_TAG",
|
|
116
|
+
"docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_CACHE_IMAGE",
|
|
117
|
+
"docker push $DOCKER_CACHE_IMAGE",
|
|
93
118
|
],
|
|
94
119
|
...def,
|
|
95
120
|
});
|
package/src/build/index.ts
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
|
-
import { Context } from "../types/context";
|
|
1
|
+
import type { Context } from "../types/context";
|
|
2
|
+
import type { EnvironmentContext } from "../types/environmentContext";
|
|
2
3
|
|
|
3
|
-
import { CatladderJob } from "../types/jobs";
|
|
4
|
+
import type { CatladderJob } from "../types/jobs";
|
|
5
|
+
import { createCustomJobs } from "./custom";
|
|
4
6
|
import { createNodeJobs, createStorybookJobs, createMeteorJobs } from "./node";
|
|
7
|
+
import { createRailsJobs } from "./rails";
|
|
5
8
|
|
|
6
|
-
import { BuildConfig } from "./types";
|
|
9
|
+
import type { BuildConfig, BuildConfigType } from "./types";
|
|
7
10
|
export * from "./types";
|
|
8
11
|
export * from "./node";
|
|
9
12
|
|
|
10
13
|
export type BuildTypes = {
|
|
11
|
-
[type in
|
|
14
|
+
[type in BuildConfigType]: {
|
|
12
15
|
jobs: (context: Context) => CatladderJob[];
|
|
13
|
-
defaults: (
|
|
16
|
+
defaults: (
|
|
17
|
+
envContext: EnvironmentContext<BuildConfigType, any>
|
|
18
|
+
) => Partial<Extract<BuildConfig, { type: type }>>;
|
|
14
19
|
};
|
|
15
20
|
};
|
|
16
21
|
|
|
@@ -40,4 +45,18 @@ export const BUILD_TYPES: BuildTypes = {
|
|
|
40
45
|
startCommand: "node main.js",
|
|
41
46
|
}),
|
|
42
47
|
},
|
|
48
|
+
custom: {
|
|
49
|
+
jobs: createCustomJobs,
|
|
50
|
+
defaults: () => ({}),
|
|
51
|
+
},
|
|
52
|
+
rails: {
|
|
53
|
+
jobs: createRailsJobs,
|
|
54
|
+
defaults: () => ({
|
|
55
|
+
startCommand: "/cnb/process/web",
|
|
56
|
+
cnbBuilder: {
|
|
57
|
+
image: "heroku/buildpacks:20",
|
|
58
|
+
packVersion: "0.28.0",
|
|
59
|
+
},
|
|
60
|
+
}),
|
|
61
|
+
},
|
|
43
62
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context } from "../../types/context";
|
|
1
|
+
import type { Context } from "../../types/context";
|
|
2
2
|
import { ensureArray } from "../../utils";
|
|
3
3
|
import { APP_BUILD_JOB_NAME } from "../base/constants";
|
|
4
4
|
import { createBuildJob } from "../base/createBuildJob";
|
|
@@ -8,7 +8,7 @@ import { isOfBuildType } from "../types";
|
|
|
8
8
|
import { getNextCache, getNodeCache, getYarnCache } from "./cache";
|
|
9
9
|
import { NODE_RUNNER_BUILD_VARIABLES } from "./constants";
|
|
10
10
|
import { getYarnInstall, getYarnInstallCommand } from "./yarn";
|
|
11
|
-
import { CatladderJob } from "../../types/jobs";
|
|
11
|
+
import type { CatladderJob } from "../../types/jobs";
|
|
12
12
|
|
|
13
13
|
export const createNodeBuildJobs = (context: Context): CatladderJob[] => {
|
|
14
14
|
const buildConfig = context.componentConfig.build;
|
package/src/build/node/cache.ts
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
import { join } from "path";
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
2
|
+
import slugify from "slugify";
|
|
3
|
+
import type { Context } from "../../types/context";
|
|
4
|
+
import type { GitlabJobCache } from "../../types/gitlab-types";
|
|
4
5
|
|
|
5
6
|
export const getYarnCache = (
|
|
6
7
|
context: Context,
|
|
7
8
|
policy = "pull-push"
|
|
8
9
|
): GitlabJobCache[] => {
|
|
10
|
+
const componentIsInWorkspace =
|
|
11
|
+
context.packageManagerInfo?.componentIsInWorkspace;
|
|
9
12
|
return [
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
componentIsInWorkspace
|
|
14
|
+
? {
|
|
15
|
+
key: "yarn",
|
|
16
|
+
policy,
|
|
17
|
+
paths: [".yarn"],
|
|
18
|
+
}
|
|
19
|
+
: {
|
|
20
|
+
key: slugify(context.componentConfig.dir) + "-yarn",
|
|
21
|
+
policy,
|
|
22
|
+
paths: [join(context.componentConfig.dir, ".yarn")],
|
|
23
|
+
},
|
|
15
24
|
];
|
|
16
25
|
};
|
|
17
26
|
|
|
@@ -22,12 +31,14 @@ export const getNodeModulesCache = (
|
|
|
22
31
|
const componentIsInWorkspace =
|
|
23
32
|
context.packageManagerInfo?.componentIsInWorkspace;
|
|
24
33
|
|
|
34
|
+
// We intentionally do not use the contents of yarn.lock as a cache key, as yarn install should always guarantee that the files are updated, but it can still use part of the cache if not all packages are up-to-date.
|
|
35
|
+
// It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
|
|
25
36
|
return [
|
|
26
37
|
{
|
|
27
38
|
// if component is in a shared workspace, use workspace cache. use individual cache else
|
|
28
39
|
key: componentIsInWorkspace
|
|
29
40
|
? "node-modules-workspace"
|
|
30
|
-
: context.componentConfig.dir + "-node-modules", // we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
|
|
41
|
+
: slugify(context.componentConfig.dir) + "-node-modules", // we use the dirname, not the component name, because in certain cases we have two apps in the same directory and want to share the cache, e.g. when having storybook in the same package.json
|
|
31
42
|
policy,
|
|
32
43
|
paths: [
|
|
33
44
|
...(componentIsInWorkspace
|
package/src/build/node/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Context } from "../../types/context";
|
|
2
|
-
import { CatladderJob } from "../../types/jobs";
|
|
2
|
+
import type { CatladderJob } from "../../types/jobs";
|
|
3
3
|
import { createNodeBuildJobs } from "./buildJob";
|
|
4
4
|
import { createMeteorBuildJobs } from "./meteor";
|
|
5
5
|
import { createNodeTestJobs } from "./testJob";
|
package/src/build/node/meteor.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { join } from "path";
|
|
2
2
|
import { getRunnerImage } from "../../runner";
|
|
3
|
-
import { GitlabJobCache } from "../../types";
|
|
3
|
+
import type { GitlabJobCache } from "../../types";
|
|
4
4
|
import type { Context } from "../../types/context";
|
|
5
5
|
|
|
6
|
-
import { CatladderJob } from "../../types/jobs";
|
|
6
|
+
import type { CatladderJob } from "../../types/jobs";
|
|
7
7
|
|
|
8
8
|
import { APP_BUILD_JOB_NAME } from "../base/constants";
|
|
9
9
|
import { createBuildJob } from "../base/createBuildJob";
|
|
@@ -40,6 +40,9 @@ export const createMeteorBuildJobs = (context: Context): CatladderJob[] => {
|
|
|
40
40
|
? createBuildJob(context, {
|
|
41
41
|
cache: [...getNodeCache(context), ...getMeteorCache(context)],
|
|
42
42
|
image: getRunnerImage("jobs-meteor"),
|
|
43
|
+
variables: {
|
|
44
|
+
METEOR_DISABLE_OPTIMISTIC_CACHING: "1", // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
|
|
45
|
+
},
|
|
43
46
|
script: [
|
|
44
47
|
...yarnInstall,
|
|
45
48
|
|
|
@@ -63,6 +66,9 @@ export const createMeteorBuildJobs = (context: Context): CatladderJob[] => {
|
|
|
63
66
|
...(appBuildJob ? [appBuildJob] : []),
|
|
64
67
|
createDockerBuildJobDefault(context, {
|
|
65
68
|
script: ["ensureMeteorDockerfile"],
|
|
69
|
+
variables: {
|
|
70
|
+
METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? "true" : "",
|
|
71
|
+
},
|
|
66
72
|
needs: appBuildJob ? [APP_BUILD_JOB_NAME] : [],
|
|
67
73
|
}),
|
|
68
74
|
];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { getRunnerImage } from "../../runner";
|
|
2
|
+
import type { Context } from "../../types/context";
|
|
3
|
+
import type { CatladderJob } from "../../types/jobs";
|
|
3
4
|
import { ensureArray, notNil } from "../../utils";
|
|
4
5
|
import { getNodeCache } from "./cache";
|
|
5
6
|
import { NODE_RUNNER_BUILD_VARIABLES } from "./constants";
|
|
@@ -63,6 +64,7 @@ export const createNodeTestJobs = (context: Context): CatladderJob[] => {
|
|
|
63
64
|
name: "🧪 test",
|
|
64
65
|
|
|
65
66
|
...base,
|
|
67
|
+
image: getRunnerImage("jobs-testing-chrome"),
|
|
66
68
|
cache: getNodeCache(context),
|
|
67
69
|
script: [
|
|
68
70
|
`cd ${context.componentConfig.dir}`,
|
package/src/build/node/yarn.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Context } from "../../types";
|
|
1
|
+
import type { Context } from "../../types";
|
|
2
2
|
|
|
3
3
|
export const getYarnInstallCommand = (
|
|
4
4
|
context: Context,
|
|
@@ -6,18 +6,29 @@ export const getYarnInstallCommand = (
|
|
|
6
6
|
prodOnly?: boolean;
|
|
7
7
|
noScripts?: boolean;
|
|
8
8
|
}
|
|
9
|
-
) =>
|
|
10
|
-
context.packageManagerInfo?.isClassic
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
) => {
|
|
10
|
+
if (context.packageManagerInfo?.isClassic) {
|
|
11
|
+
return `yarn install --frozen-lockfile ${
|
|
12
|
+
options?.prodOnly ? "--production" : ""
|
|
13
|
+
} ${options?.noScripts ? "--ignore-scripts" : ""}`;
|
|
14
|
+
}
|
|
15
|
+
// is modern
|
|
16
|
+
|
|
17
|
+
// yarn >= 4 ships with build in plugins, see https://github.com/yarnpkg/berry/pull/4253
|
|
18
|
+
// trying to import those fail on this version
|
|
19
|
+
const doesNotShipWithBuiltInPlugins = ["2", "3"].some((v) =>
|
|
20
|
+
context.packageManagerInfo?.version.startsWith(v)
|
|
21
|
+
);
|
|
22
|
+
return options?.prodOnly
|
|
23
|
+
? `${options?.noScripts ? "YARN_ENABLE_SCRIPTS=false " : ""}${
|
|
24
|
+
doesNotShipWithBuiltInPlugins
|
|
25
|
+
? "yarn plugin import workspace-tools && "
|
|
26
|
+
: " "
|
|
27
|
+
}yarn workspaces focus --production && yarn rebuild` // needs yarn plugin import workspace-tools
|
|
18
28
|
: `${
|
|
19
29
|
options?.noScripts ? "YARN_ENABLE_SCRIPTS=false " : ""
|
|
20
30
|
}yarn install --immutable`;
|
|
31
|
+
};
|
|
21
32
|
|
|
22
33
|
export const ensureNodeVersion = (context: Context) => [
|
|
23
34
|
"if [ -f ./.nvmrc ]; then source /root/.nvm/nvm.sh && nvm install <<< .nvmrc; fi",
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Context } from "../..";
|
|
2
|
+
import { isOfBuildType } from "../types";
|
|
3
|
+
import type { CatladderJob } from "../../types/jobs";
|
|
4
|
+
import { createDockerBuildJobBase, gitlabDockerLogin } from "../docker";
|
|
5
|
+
|
|
6
|
+
export const createRailsBuildJobs = (context: Context): CatladderJob[] => {
|
|
7
|
+
const buildConfig = context.componentConfig.build;
|
|
8
|
+
if (!isOfBuildType(buildConfig, "rails")) {
|
|
9
|
+
// should not happen
|
|
10
|
+
throw new Error("build type is not rails");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const cnbConf = buildConfig.cnbBuilder;
|
|
14
|
+
|
|
15
|
+
const packEnvArgs = Object.entries(cnbConf?.buildVars ?? {})
|
|
16
|
+
.map(([k, v]) => `--env '${k}${v ? `=${v}` : ""}'`)
|
|
17
|
+
.join(" ");
|
|
18
|
+
|
|
19
|
+
return [
|
|
20
|
+
createDockerBuildJobBase(context, {
|
|
21
|
+
variables: context.componentConfig.build.extraVars,
|
|
22
|
+
// custom script
|
|
23
|
+
script: [
|
|
24
|
+
gitlabDockerLogin,
|
|
25
|
+
`docker pull $DOCKER_CACHE_IMAGE || true`,
|
|
26
|
+
`wget --output-document=- https://github.com/buildpacks/pack/releases/download/v${cnbConf?.packVersion}/pack-v${cnbConf?.packVersion}-linux.tgz | tar -zx --directory /usr/local/bin pack`,
|
|
27
|
+
`chmod +x /usr/local/bin/pack`,
|
|
28
|
+
// replace private git ssh gem sources with https to make bundler with credentials via env var work
|
|
29
|
+
`sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock`,
|
|
30
|
+
`pack build "$DOCKER_IMAGE:$DOCKER_IMAGE_TAG" --builder '${
|
|
31
|
+
cnbConf?.image
|
|
32
|
+
}' --publish --cache-image "$DOCKER_CACHE_IMAGE" ${packEnvArgs} ${
|
|
33
|
+
cnbConf?.packExtraArgs?.join(" ") ?? ""
|
|
34
|
+
}`,
|
|
35
|
+
],
|
|
36
|
+
}),
|
|
37
|
+
];
|
|
38
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Context } from "../../types";
|
|
2
|
+
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
+
import { createRailsBuildJobs } from "./build";
|
|
4
|
+
import { createRailsTestJobs } from "./test";
|
|
5
|
+
|
|
6
|
+
export const createRailsJobs = (context: Context): CatladderJob[] => {
|
|
7
|
+
return [...createRailsTestJobs(context), ...createRailsBuildJobs(context)];
|
|
8
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Context } from "../..";
|
|
2
|
+
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
+
import { ensureArray, notNil } from "../../utils";
|
|
4
|
+
|
|
5
|
+
export const createRailsTestJobs = (context: Context): CatladderJob[] => {
|
|
6
|
+
// don't run tests after release
|
|
7
|
+
if (context.commitInfo?.trigger === "taggedRelease") {
|
|
8
|
+
return [];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const buildConfig = context.componentConfig.build;
|
|
12
|
+
|
|
13
|
+
const base: Omit<CatladderJob, "script" | "name"> = {
|
|
14
|
+
variables: buildConfig.extraVars ?? {},
|
|
15
|
+
stage: "test",
|
|
16
|
+
needs: [],
|
|
17
|
+
envMode: "none",
|
|
18
|
+
};
|
|
19
|
+
const defaultImage = "docker.io/ruby";
|
|
20
|
+
const bundlerCacheDir = "tmp/cache";
|
|
21
|
+
const bundlerInstall = [
|
|
22
|
+
`bundle config set path '${bundlerCacheDir}'`,
|
|
23
|
+
"bundle install -j $(nproc)",
|
|
24
|
+
];
|
|
25
|
+
const bundlerCache = {
|
|
26
|
+
key: {
|
|
27
|
+
files: ["Gemfile.lock"],
|
|
28
|
+
prefix: "$CI_JOB_IMAGE", // a changed image might have different OS libraries which no longer work with the cached gems
|
|
29
|
+
},
|
|
30
|
+
paths: [bundlerCacheDir],
|
|
31
|
+
};
|
|
32
|
+
const auditJob: CatladderJob | null =
|
|
33
|
+
buildConfig.audit !== false
|
|
34
|
+
? {
|
|
35
|
+
name: "🛡 audit",
|
|
36
|
+
|
|
37
|
+
...base,
|
|
38
|
+
cache: undefined, // audit does not need bundle install and no cache
|
|
39
|
+
image: buildConfig.audit?.jobImage ?? defaultImage,
|
|
40
|
+
script: [
|
|
41
|
+
`cd ${context.componentConfig.dir}`,
|
|
42
|
+
...(ensureArray(buildConfig.audit?.command) ?? [
|
|
43
|
+
"gem install bundler-audit",
|
|
44
|
+
"bundle audit check",
|
|
45
|
+
]),
|
|
46
|
+
],
|
|
47
|
+
allow_failure: true,
|
|
48
|
+
}
|
|
49
|
+
: null;
|
|
50
|
+
|
|
51
|
+
const lintJob: CatladderJob | null =
|
|
52
|
+
buildConfig.lint !== false
|
|
53
|
+
? {
|
|
54
|
+
name: "👮 lint",
|
|
55
|
+
|
|
56
|
+
...base,
|
|
57
|
+
cache: bundlerCache,
|
|
58
|
+
image: buildConfig.lint?.jobImage ?? defaultImage,
|
|
59
|
+
script: [
|
|
60
|
+
`cd ${context.componentConfig.dir}`,
|
|
61
|
+
...bundlerInstall,
|
|
62
|
+
...(ensureArray(buildConfig.lint?.command) ?? [
|
|
63
|
+
"bundle exec rubocop",
|
|
64
|
+
]),
|
|
65
|
+
],
|
|
66
|
+
}
|
|
67
|
+
: null;
|
|
68
|
+
const testJob: CatladderJob | null =
|
|
69
|
+
buildConfig.test !== false
|
|
70
|
+
? {
|
|
71
|
+
name: "🧪 test",
|
|
72
|
+
|
|
73
|
+
...base,
|
|
74
|
+
cache: bundlerCache,
|
|
75
|
+
image: buildConfig.test?.jobImage ?? defaultImage,
|
|
76
|
+
script: [
|
|
77
|
+
`cd ${context.componentConfig.dir}`,
|
|
78
|
+
...bundlerInstall,
|
|
79
|
+
...(ensureArray(buildConfig.test?.command) ?? [
|
|
80
|
+
"bundle exec rspec",
|
|
81
|
+
]),
|
|
82
|
+
],
|
|
83
|
+
}
|
|
84
|
+
: null;
|
|
85
|
+
return [auditJob, lintJob, testJob].filter(notNil);
|
|
86
|
+
};
|