@catladder/pipeline 1.146.1 → 1.147.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/build/base/createAppBuildJob.d.ts +2 -2
- package/dist/build/base/createAppBuildJob.js +6 -6
- package/dist/build/base/index.d.ts +2 -2
- package/dist/build/base/writeBuildInfo.d.ts +2 -2
- package/dist/build/base/writeBuildInfo.js +1 -1
- package/dist/build/base/writeDotEnv.d.ts +2 -2
- package/dist/build/base/writeDotEnv.js +1 -1
- package/dist/build/custom/__tests__/testJob.test.js +11 -14
- package/dist/build/custom/buildJob.d.ts +2 -2
- package/dist/build/custom/buildJob.js +5 -5
- package/dist/build/custom/index.d.ts +2 -2
- package/dist/build/custom/testJob.d.ts +2 -2
- package/dist/build/custom/testJob.js +5 -5
- package/dist/build/docker.d.ts +32 -15
- package/dist/build/docker.js +41 -20
- package/dist/build/index.d.ts +2 -2
- package/dist/build/node/buildJob.d.ts +2 -2
- package/dist/build/node/buildJob.js +8 -8
- package/dist/build/node/cache.d.ts +5 -5
- package/dist/build/node/cache.js +5 -5
- package/dist/build/node/index.d.ts +4 -4
- package/dist/build/node/meteor.d.ts +2 -2
- package/dist/build/node/meteor.js +6 -6
- package/dist/build/node/testJob.d.ts +2 -2
- package/dist/build/node/testJob.js +11 -11
- 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/build.js +3 -3
- package/dist/build/rails/index.d.ts +2 -2
- package/dist/build/rails/test.d.ts +2 -2
- package/dist/build/rails/test.js +4 -4
- package/dist/build/sbom.d.ts +2 -2
- package/dist/build/sbom.js +2 -2
- package/dist/build/types.d.ts +34 -26
- package/dist/bundles/catladder-gitlab/index.js +2 -2
- 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/getLabels.js +1 -1
- package/dist/context/index.d.ts +7 -3
- package/dist/context/index.js +43 -12
- package/dist/deploy/base/deploy.d.ts +2 -2
- package/dist/deploy/base/deploy.js +9 -8
- 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 -11
- package/dist/deploy/cloudRun/artifactsRegistry.js +8 -9
- package/dist/deploy/cloudRun/cleanup.d.ts +2 -2
- package/dist/deploy/cloudRun/cloudRunRevisions.d.ts +2 -2
- package/dist/deploy/cloudRun/cloudRunRevisions.js +4 -5
- 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/cloudRunServices.js +1 -1
- package/dist/deploy/cloudRun/createJobs/common.js +2 -1
- 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/createJobs/index.js +2 -4
- 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 +7 -10
- package/dist/deploy/dockerTag/deployJob.d.ts +2 -2
- package/dist/deploy/dockerTag/deployJob.js +3 -5
- package/dist/deploy/index.d.ts +2 -2
- package/dist/deploy/kubernetes/cloudSql/index.d.ts +3 -3
- package/dist/deploy/kubernetes/cloudSql/index.js +11 -9
- package/dist/deploy/kubernetes/deployJob.d.ts +2 -2
- package/dist/deploy/kubernetes/deployJob.js +4 -7
- package/dist/deploy/kubernetes/kubeEnv.d.ts +2 -2
- package/dist/deploy/kubernetes/kubeEnv.js +2 -1
- package/dist/deploy/kubernetes/kubeValues.d.ts +2 -2
- package/dist/deploy/kubernetes/kubeValues.js +10 -10
- package/dist/deploy/kubernetes/mongodb.d.ts +2 -2
- package/dist/deploy/kubernetes/mongodb.js +11 -11
- package/dist/deploy/sbom.d.ts +4 -4
- package/dist/deploy/sbom.js +1 -1
- package/dist/deploy/types/index.d.ts +1 -1
- package/dist/deploy/types/index.js +1 -1
- package/dist/deploy/utils.d.ts +2 -2
- package/dist/deploy/utils.js +2 -1
- package/dist/pipeline/createJobsForComponent.d.ts +2 -2
- package/dist/pipeline/createJobsForComponent.js +6 -6
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +2 -2
- package/dist/types/context.d.ts +28 -2
- package/examples/__snapshots__/cloud-run-storybook.ts.snap +1687 -0
- package/examples/__snapshots__/cloud-run-with-ngnix.ts.snap +1971 -0
- package/examples/cloud-run-storybook.ts +24 -0
- package/examples/cloud-run-with-ngnix.ts +24 -0
- package/package.json +1 -1
- package/src/build/base/createAppBuildJob.ts +9 -9
- package/src/build/base/index.ts +2 -2
- package/src/build/base/writeBuildInfo.ts +3 -3
- package/src/build/base/writeDotEnv.ts +3 -3
- package/src/build/custom/__tests__/testJob.test.ts +8 -11
- package/src/build/custom/buildJob.ts +10 -11
- package/src/build/custom/index.ts +2 -2
- package/src/build/custom/testJob.ts +9 -7
- package/src/build/docker.ts +73 -29
- package/src/build/index.ts +2 -2
- package/src/build/node/buildJob.ts +19 -15
- package/src/build/node/cache.ts +10 -10
- package/src/build/node/index.ts +6 -4
- package/src/build/node/meteor.ts +16 -17
- package/src/build/node/testJob.ts +19 -16
- package/src/build/node/yarn.ts +6 -8
- package/src/build/rails/build.ts +7 -5
- package/src/build/rails/index.ts +2 -2
- package/src/build/rails/test.ts +8 -6
- package/src/build/sbom.ts +5 -5
- package/src/build/types.ts +53 -38
- 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 +3 -3
- package/src/context/index.ts +33 -7
- package/src/deploy/base/deploy.ts +10 -16
- 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 +16 -16
- package/src/deploy/cloudRun/cleanup.ts +2 -2
- package/src/deploy/cloudRun/cloudRunRevisions.ts +6 -8
- package/src/deploy/cloudRun/createJobs/cloudRunJobs.ts +10 -10
- package/src/deploy/cloudRun/createJobs/cloudRunServices.ts +4 -4
- package/src/deploy/cloudRun/createJobs/common.ts +1 -1
- 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 +3 -6
- 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 +10 -8
- package/src/deploy/dockerTag/deployJob.ts +6 -7
- package/src/deploy/index.ts +2 -2
- package/src/deploy/kubernetes/cloudSql/index.ts +10 -7
- package/src/deploy/kubernetes/deployJob.ts +3 -6
- package/src/deploy/kubernetes/kubeEnv.ts +3 -3
- package/src/deploy/kubernetes/kubeValues.ts +6 -6
- package/src/deploy/kubernetes/mongodb.ts +14 -14
- package/src/deploy/sbom.ts +9 -6
- package/src/deploy/types/index.ts +2 -2
- package/src/deploy/utils.ts +3 -3
- package/src/pipeline/createJobsForComponent.ts +17 -17
- package/src/pipeline/gitlab/createGitlabJobs.ts +2 -2
- package/src/types/config.ts +4 -2
- package/src/types/context.ts +33 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "../..";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
3
|
export type AppBuildJobDefinition = Partial<CatladderJob>;
|
|
4
|
-
export declare const createAppBuildJob: (context:
|
|
4
|
+
export declare const createAppBuildJob: (context: ComponentContext, {
|
|
5
5
|
script,
|
|
6
6
|
variables,
|
|
7
7
|
runnerVariables,
|
|
@@ -74,15 +74,15 @@ var createAppBuildJob = function (context, _a) {
|
|
|
74
74
|
image: (0, __1.getRunnerImage)("jobs-default"),
|
|
75
75
|
needs: [],
|
|
76
76
|
cache: [],
|
|
77
|
-
variables: __assign(__assign(__assign(__assign({}, variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), (_b = context.
|
|
78
|
-
runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {}), (_c = context.
|
|
77
|
+
variables: __assign(__assign(__assign(__assign({}, variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), context.environment.jobOnlyVars.build.envVars), (_b = context.build.config.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
78
|
+
runnerVariables: __assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), runnerVariables !== null && runnerVariables !== void 0 ? runnerVariables : {}), (_c = context.build.config.runnerVariables) !== null && _c !== void 0 ? _c : {}),
|
|
79
79
|
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(context.componentConfig.dotEnv === true // don't build when set to `local`
|
|
80
|
-
? (0, writeDotEnv_1.writeDotEnv)(context) : []), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.
|
|
80
|
+
? (0, writeDotEnv_1.writeDotEnv)(context) : []), false), __read((0, writeBuildInfo_1.writeBuildInfo)(context)), false), __read((0, yarn_1.ensureNodeVersion)(context.build)), false), ["cd ".concat(context.build.dir)], false), __read((_d = (0, utils_1.ensureArray)(script)) !== null && _d !== void 0 ? _d : []), false),
|
|
81
81
|
artifacts: {
|
|
82
|
-
paths: [(0, path_1.join)(context.
|
|
82
|
+
paths: [(0, path_1.join)(context.build.dir, "__build_info.json")],
|
|
83
83
|
reports: {
|
|
84
|
-
junit: (_f = (_e = context.
|
|
85
|
-
return (0, path_1.join)(context.
|
|
84
|
+
junit: (_f = (_e = context.build.config.artifactsReports) === null || _e === void 0 ? void 0 : _e.junit) === null || _f === void 0 ? void 0 : _f.map(function (p) {
|
|
85
|
+
return (0, path_1.join)(context.build.dir, p);
|
|
86
86
|
})
|
|
87
87
|
}
|
|
88
88
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
3
|
import type { DockerBuildJobDefinition } from "../docker";
|
|
4
4
|
import type { AppBuildJobDefinition } from "./createAppBuildJob";
|
|
5
|
-
export declare const createBuildJobs: (context:
|
|
5
|
+
export declare const createBuildJobs: (context: ComponentContext, definitions: {
|
|
6
6
|
appBuild?: AppBuildJobDefinition;
|
|
7
7
|
dockerBuild: DockerBuildJobDefinition;
|
|
8
8
|
}) => CatladderJob[];
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const writeBuildInfo: (context:
|
|
1
|
+
import type { ComponentContext } from "../../types";
|
|
2
|
+
export declare const writeBuildInfo: (context: ComponentContext) => string[];
|
|
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.writeBuildInfo = void 0;
|
|
7
7
|
var writeBuildInfo = function (context) {
|
|
8
|
-
return ["echo '{\"id\":\"".concat(context.environment.envVars.BUILD_INFO_BUILD_ID, "\",\"time\":\"").concat(context.environment.envVars.BUILD_INFO_BUILD_TIME, "\"}' > ").concat(context.
|
|
8
|
+
return ["echo '{\"id\":\"".concat(context.environment.envVars.BUILD_INFO_BUILD_ID, "\",\"time\":\"").concat(context.environment.envVars.BUILD_INFO_BUILD_TIME, "\"}' > ").concat(context.build.dir, "/__build_info.json")];
|
|
9
9
|
};
|
|
10
10
|
exports.writeBuildInfo = writeBuildInfo;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "../../types";
|
|
2
2
|
/**
|
|
3
3
|
* writes a .env file in the components folder
|
|
4
4
|
* @param context
|
|
5
5
|
* @returns
|
|
6
6
|
*/
|
|
7
|
-
export declare const writeDotEnv: (context:
|
|
7
|
+
export declare const writeDotEnv: (context: ComponentContext) => string[];
|
|
@@ -47,6 +47,6 @@ var writeDotEnv = function (context) {
|
|
|
47
47
|
value = _b[1];
|
|
48
48
|
return "".concat(key, "=").concat(value === null || value === void 0 ? void 0 : value.toString().replaceAll("\n", "\\n"));
|
|
49
49
|
}).join("\n");
|
|
50
|
-
return ["cat <<EOF > ".concat(context.
|
|
50
|
+
return ["cat <<EOF > ".concat(context.build.dir, "/.env\n").concat(keyValueString, "\nEOF")];
|
|
51
51
|
};
|
|
52
52
|
exports.writeDotEnv = writeDotEnv;
|
|
@@ -5,17 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var testJob_1 = require("../testJob");
|
|
7
7
|
describe("createCustomTestJobs", function () {
|
|
8
|
-
var componentConfig = {
|
|
9
|
-
dir: ".",
|
|
10
|
-
build: {
|
|
11
|
-
type: "custom",
|
|
12
|
-
docker: {
|
|
13
|
-
type: "custom"
|
|
14
|
-
},
|
|
15
|
-
jobImage: ""
|
|
16
|
-
},
|
|
17
|
-
deploy: {}
|
|
18
|
-
};
|
|
19
8
|
var baseContext = {
|
|
20
9
|
componentName: "testComponent",
|
|
21
10
|
environment: {
|
|
@@ -23,14 +12,22 @@ describe("createCustomTestJobs", function () {
|
|
|
23
12
|
build: {}
|
|
24
13
|
}
|
|
25
14
|
},
|
|
26
|
-
|
|
15
|
+
build: {
|
|
16
|
+
config: {
|
|
17
|
+
type: "custom",
|
|
18
|
+
docker: {
|
|
19
|
+
type: "custom"
|
|
20
|
+
},
|
|
21
|
+
jobImage: ""
|
|
22
|
+
}
|
|
23
|
+
}
|
|
27
24
|
};
|
|
28
25
|
it("throws error when not build type custom", function () {
|
|
29
|
-
|
|
26
|
+
baseContext.build.config.type = "node";
|
|
30
27
|
expect(function () {
|
|
31
28
|
return (0, testJob_1.createCustomTestJobs)(baseContext);
|
|
32
29
|
}).toThrowError("deploy config is not custom");
|
|
33
|
-
|
|
30
|
+
baseContext.build.config.type = "custom";
|
|
34
31
|
});
|
|
35
32
|
it("returns empty array if no audit, lint, and test definition", function () {
|
|
36
33
|
var jobs = (0, testJob_1.createCustomTestJobs)(baseContext);
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createCustomBuildJobs: (context:
|
|
3
|
+
export declare const createCustomBuildJobs: (context: ComponentContext) => CatladderJob[];
|
|
@@ -46,8 +46,8 @@ var RUNNER_BUILD_VARIABLES = {
|
|
|
46
46
|
KUBERNETES_MEMORY_LIMIT: "4Gi"
|
|
47
47
|
};
|
|
48
48
|
var createCustomBuildJobs = function (context) {
|
|
49
|
-
var _a, _b, _c
|
|
50
|
-
var buildConfig = context.
|
|
49
|
+
var _a, _b, _c;
|
|
50
|
+
var buildConfig = context.build.config;
|
|
51
51
|
if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
|
|
52
52
|
throw new Error("deploy config is not custom");
|
|
53
53
|
}
|
|
@@ -59,14 +59,14 @@ var createCustomBuildJobs = function (context) {
|
|
|
59
59
|
services: buildConfig.jobServices,
|
|
60
60
|
script: __spreadArray([], __read((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : []), false),
|
|
61
61
|
artifacts: {
|
|
62
|
-
paths: __spreadArray([(0, path_1.join)(context.
|
|
63
|
-
return (0, path_1.join)(context.
|
|
62
|
+
paths: __spreadArray([(0, path_1.join)(context.build.dir, "__build_info.json"), (0, path_1.join)(context.build.dir, "dist")], __read((_c = (_b = buildConfig.artifactsPaths) === null || _b === void 0 ? void 0 : _b.map(function (path) {
|
|
63
|
+
return (0, path_1.join)(context.build.dir, path);
|
|
64
64
|
})) !== null && _c !== void 0 ? _c : []), false),
|
|
65
65
|
expire_in: "1 day"
|
|
66
66
|
}
|
|
67
67
|
} : undefined,
|
|
68
68
|
dockerBuild: {
|
|
69
|
-
script: (0, docker_1.
|
|
69
|
+
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context),
|
|
70
70
|
variables: {}
|
|
71
71
|
}
|
|
72
72
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createCustomJobs: (context:
|
|
3
|
+
export declare const createCustomJobs: (context: ComponentContext) => CatladderJob[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
3
|
import type { Artifacts } from "../../types";
|
|
4
|
-
export declare const createCustomTestJobs: (context:
|
|
4
|
+
export declare const createCustomTestJobs: (context: ComponentContext) => CatladderJob[];
|
|
5
5
|
export type OptionalArtifacts = {
|
|
6
6
|
artifacts: Artifacts;
|
|
7
7
|
} | undefined;
|
|
@@ -60,13 +60,13 @@ var createCustomTestJobs = function (context) {
|
|
|
60
60
|
if (context.trigger === "taggedRelease") {
|
|
61
61
|
return [];
|
|
62
62
|
}
|
|
63
|
-
var buildConfig = context.
|
|
63
|
+
var buildConfig = context.build.config;
|
|
64
64
|
if (!(0, types_1.isOfBuildType)(buildConfig, "custom")) {
|
|
65
65
|
throw new Error("deploy config is not custom");
|
|
66
66
|
}
|
|
67
67
|
var base = {
|
|
68
68
|
variables: __assign(__assign({
|
|
69
|
-
APP_PATH: context.
|
|
69
|
+
APP_PATH: context.build.dir
|
|
70
70
|
}, context.environment.jobOnlyVars.build.envVars), (_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {}),
|
|
71
71
|
runnerVariables: RUNNER_CUSTOM_TEST_VARIABLES,
|
|
72
72
|
services: buildConfig.jobServices,
|
|
@@ -82,19 +82,19 @@ var createCustomTestJobs = function (context) {
|
|
|
82
82
|
cache: undefined,
|
|
83
83
|
script: __spreadArray([], __read((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : []), false),
|
|
84
84
|
allow_failure: true
|
|
85
|
-
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.
|
|
85
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_f = buildConfig.audit) === null || _f === void 0 ? void 0 : _f.artifactsReports, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifacts)) : null;
|
|
86
86
|
var lintJob = buildConfig.lint ? __assign(__assign(__assign({
|
|
87
87
|
name: "👮 lint"
|
|
88
88
|
}, base), {
|
|
89
89
|
image: (_j = (_h = buildConfig.lint) === null || _h === void 0 ? void 0 : _h.jobImage) !== null && _j !== void 0 ? _j : buildConfig.jobImage,
|
|
90
90
|
script: __spreadArray([], __read((_l = (0, utils_1.ensureArray)((_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.command)) !== null && _l !== void 0 ? _l : []), false)
|
|
91
|
-
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.
|
|
91
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.artifactsReports, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifacts)) : null;
|
|
92
92
|
var testJob = buildConfig.test ? __assign(__assign(__assign({
|
|
93
93
|
name: "🧪 test"
|
|
94
94
|
}, base), {
|
|
95
95
|
image: (_q = (_p = buildConfig.test) === null || _p === void 0 ? void 0 : _p.jobImage) !== null && _q !== void 0 ? _q : buildConfig.jobImage,
|
|
96
96
|
script: __spreadArray([], __read((_s = (0, utils_1.ensureArray)((_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.command)) !== null && _s !== void 0 ? _s : []), false)
|
|
97
|
-
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.
|
|
97
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.artifactsReports, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifacts)) : null;
|
|
98
98
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
99
99
|
};
|
|
100
100
|
exports.createCustomTestJobs = createCustomTestJobs;
|
package/dist/build/docker.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BuildConfigDocker } from ".";
|
|
2
|
+
import type { ComponentContext } from "../types";
|
|
2
3
|
import type { CatladderJob } from "../types/jobs";
|
|
3
|
-
export declare const getDockerImageVariables: (context:
|
|
4
|
+
export declare const getDockerImageVariables: (context: ComponentContext) => {
|
|
4
5
|
DOCKER_IMAGE_TAG: string;
|
|
5
6
|
DOCKER_REGISTRY: string;
|
|
6
7
|
DOCKER_IMAGE: import("../bash/BashExpression").StringOrBashExpression;
|
|
@@ -15,38 +16,54 @@ export declare const getDockerImageVariables: (context: Context) => {
|
|
|
15
16
|
/**
|
|
16
17
|
* Weather the context requires a docker build
|
|
17
18
|
*/
|
|
18
|
-
export declare const requiresDockerBuild: (
|
|
19
|
-
|
|
20
|
-
deploy
|
|
21
|
-
}
|
|
22
|
-
}: Context) => boolean;
|
|
23
|
-
export declare const getDockerBuildVariables: (context: Context) => {
|
|
19
|
+
export declare const requiresDockerBuild: (context: ComponentContext) => boolean;
|
|
20
|
+
export declare const getDockerBuildVariables: (context: ComponentContext) => {
|
|
24
21
|
DOCKER_IMAGE_TAG: string;
|
|
25
22
|
DOCKER_REGISTRY: string;
|
|
26
23
|
DOCKER_IMAGE: import("../bash/BashExpression").StringOrBashExpression;
|
|
27
24
|
DOCKER_CACHE_IMAGE: string;
|
|
28
|
-
DOCKERFILE_ADDITIONS: string | undefined;
|
|
29
|
-
DOCKERFILE_ADDITIONS_END: string | undefined;
|
|
30
25
|
APP_DIR: string;
|
|
31
26
|
DOCKER_DIR: string;
|
|
27
|
+
DOCKERFILE_ADDITIONS?: undefined;
|
|
28
|
+
DOCKERFILE_ADDITIONS_END?: undefined;
|
|
32
29
|
} | {
|
|
33
30
|
DOCKER_IMAGE_TAG: string;
|
|
34
31
|
DOCKER_REGISTRY: string;
|
|
35
32
|
DOCKER_CACHE_IMAGE: string;
|
|
36
33
|
DOCKER_IMAGE_NAME: string;
|
|
37
34
|
DOCKER_IMAGE: string;
|
|
35
|
+
APP_DIR: string;
|
|
36
|
+
DOCKER_DIR: string;
|
|
37
|
+
DOCKERFILE_ADDITIONS?: undefined;
|
|
38
|
+
DOCKERFILE_ADDITIONS_END?: undefined;
|
|
39
|
+
} | {
|
|
40
|
+
DOCKER_IMAGE_TAG: string;
|
|
41
|
+
DOCKER_REGISTRY: string;
|
|
42
|
+
DOCKER_IMAGE: import("../bash/BashExpression").StringOrBashExpression;
|
|
43
|
+
DOCKER_CACHE_IMAGE: string;
|
|
44
|
+
APP_DIR: string;
|
|
45
|
+
DOCKER_DIR: string;
|
|
38
46
|
DOCKERFILE_ADDITIONS: string | undefined;
|
|
39
47
|
DOCKERFILE_ADDITIONS_END: string | undefined;
|
|
48
|
+
} | {
|
|
49
|
+
DOCKER_IMAGE_TAG: string;
|
|
50
|
+
DOCKER_REGISTRY: string;
|
|
51
|
+
DOCKER_CACHE_IMAGE: string;
|
|
52
|
+
DOCKER_IMAGE_NAME: string;
|
|
53
|
+
DOCKER_IMAGE: string;
|
|
40
54
|
APP_DIR: string;
|
|
41
55
|
DOCKER_DIR: string;
|
|
56
|
+
DOCKERFILE_ADDITIONS: string | undefined;
|
|
57
|
+
DOCKERFILE_ADDITIONS_END: string | undefined;
|
|
42
58
|
};
|
|
43
59
|
export declare const DOCKER_BUILD_JOB_NAME = "\uD83D\uDD28 docker";
|
|
44
|
-
export declare const getDockerJobBaseProps: (
|
|
60
|
+
export declare const getDockerJobBaseProps: () => Pick<CatladderJob, "image" | "services" | "variables" | "runnerVariables">;
|
|
45
61
|
export type DockerBuildJobDefinition = Partial<CatladderJob>;
|
|
46
|
-
export declare const createDockerBuildJobBase: (context:
|
|
62
|
+
export declare const createDockerBuildJobBase: (context: ComponentContext, {
|
|
47
63
|
script,
|
|
48
64
|
...def
|
|
49
65
|
}: Partial<CatladderJob>) => CatladderJob;
|
|
50
|
-
export declare const gitlabDockerLogin: (context:
|
|
51
|
-
export declare const
|
|
52
|
-
export declare const
|
|
66
|
+
export declare const gitlabDockerLogin: (context: ComponentContext) => string[];
|
|
67
|
+
export declare const getDockerBuildScriptWithBuiltInDockerFile: (context: ComponentContext, defaultType?: BuildConfigDocker["type"]) => (string | undefined)[];
|
|
68
|
+
export declare const getDockerBuildDefaultScript: (context: ComponentContext, ensureDockerFileScript?: string | null) => (string | undefined)[];
|
|
69
|
+
export declare const hasDockerfile: (context: ComponentContext) => boolean;
|
package/dist/build/docker.js
CHANGED
|
@@ -57,22 +57,24 @@ var __importDefault = this && this.__importDefault || function (mod) {
|
|
|
57
57
|
Object.defineProperty(exports, "__esModule", {
|
|
58
58
|
value: true
|
|
59
59
|
});
|
|
60
|
-
exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
|
|
61
|
-
var lodash_1 = require("lodash");
|
|
62
|
-
var deploy_1 = require("../deploy");
|
|
63
|
-
var runner_1 = require("../runner");
|
|
60
|
+
exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.getDockerBuildScriptWithBuiltInDockerFile = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
|
|
64
61
|
var fs_1 = require("fs");
|
|
62
|
+
var lodash_1 = require("lodash");
|
|
65
63
|
var path_1 = __importDefault(require("path"));
|
|
66
|
-
var
|
|
64
|
+
var deploy_1 = require("../deploy");
|
|
67
65
|
var artifactsRegistry_1 = require("../deploy/cloudRun/artifactsRegistry");
|
|
68
66
|
var gcloudServiceAccountLoginCommands_1 = require("../deploy/cloudRun/utils/gcloudServiceAccountLoginCommands");
|
|
67
|
+
var runner_1 = require("../runner");
|
|
68
|
+
var gitlab_1 = require("../utils/gitlab");
|
|
69
69
|
var DOCKER_BUILD_RUNNER_REQUESTS = {
|
|
70
70
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
71
71
|
KUBERNETES_MEMORY_REQUEST: "1Gi",
|
|
72
72
|
KUBERNETES_MEMORY_LIMIT: "2Gi"
|
|
73
73
|
};
|
|
74
74
|
var getDockerImageVariables = function (context) {
|
|
75
|
-
|
|
75
|
+
var _a;
|
|
76
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
77
|
+
return __assign(__assign({}, (0, deploy_1.isOfDeployType)(deployConfig, "google-cloudrun") ? {
|
|
76
78
|
DOCKER_REGISTRY: (0, artifactsRegistry_1.getArtifactsRegistryHost)(context),
|
|
77
79
|
DOCKER_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryImageName)(context),
|
|
78
80
|
DOCKER_CACHE_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryBuildCacheImage)(context)
|
|
@@ -92,9 +94,10 @@ exports.getDockerImageVariables = getDockerImageVariables;
|
|
|
92
94
|
/**
|
|
93
95
|
* Weather the context requires a docker build
|
|
94
96
|
*/
|
|
95
|
-
var requiresDockerBuild = function (
|
|
96
|
-
var
|
|
97
|
-
|
|
97
|
+
var requiresDockerBuild = function (context) {
|
|
98
|
+
var _a;
|
|
99
|
+
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
100
|
+
return (0, deploy_1.isOfDeployType)(deployConfig, "kubernetes", "google-cloudrun", "dockerTag") || (0, deploy_1.isOfDeployType)(deployConfig, "custom") && deployConfig.requiresDocker;
|
|
98
101
|
};
|
|
99
102
|
exports.requiresDockerBuild = requiresDockerBuild;
|
|
100
103
|
// those need to be runner variables
|
|
@@ -107,18 +110,24 @@ var getDockerBuildRunnerVariables = function () {
|
|
|
107
110
|
};
|
|
108
111
|
};
|
|
109
112
|
|
|
113
|
+
var getDockerAdditions = function (build) {
|
|
114
|
+
var _a, _b;
|
|
115
|
+
if (!("docker" in build)) return {};
|
|
116
|
+
if (!build.docker) return {};
|
|
117
|
+
return {
|
|
118
|
+
DOCKERFILE_ADDITIONS: "additionsBegin" in build.docker ? (_a = build.docker.additionsBegin) === null || _a === void 0 ? void 0 : _a.join("\n") : undefined,
|
|
119
|
+
DOCKERFILE_ADDITIONS_END: "additionsEnd" in build.docker ? (_b = build.docker.additionsEnd) === null || _b === void 0 ? void 0 : _b.join("\n") : undefined
|
|
120
|
+
};
|
|
121
|
+
};
|
|
110
122
|
var getDockerBuildVariables = function (context) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
DOCKERFILE_ADDITIONS: (_b = (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.additionsBegin) === null || _b === void 0 ? void 0 : _b.join("\n"),
|
|
114
|
-
DOCKERFILE_ADDITIONS_END: (_d = (_c = context.componentConfig.build.docker) === null || _c === void 0 ? void 0 : _c.additionsEnd) === null || _d === void 0 ? void 0 : _d.join("\n"),
|
|
115
|
-
APP_DIR: context.componentConfig.dir,
|
|
123
|
+
return __assign(__assign(__assign({}, getDockerAdditions(context.build.config)), {
|
|
124
|
+
APP_DIR: context.build.dir,
|
|
116
125
|
DOCKER_DIR: "."
|
|
117
|
-
}, (0, exports.getDockerImageVariables)(context));
|
|
126
|
+
}), (0, exports.getDockerImageVariables)(context));
|
|
118
127
|
};
|
|
119
128
|
exports.getDockerBuildVariables = getDockerBuildVariables;
|
|
120
129
|
exports.DOCKER_BUILD_JOB_NAME = "🔨 docker";
|
|
121
|
-
var getDockerJobBaseProps = function (
|
|
130
|
+
var getDockerJobBaseProps = function () {
|
|
122
131
|
return {
|
|
123
132
|
image: (0, runner_1.getRunnerImage)("docker-build"),
|
|
124
133
|
services: [{
|
|
@@ -138,7 +147,7 @@ var createDockerBuildJobBase = function (context, _a) {
|
|
|
138
147
|
name: exports.DOCKER_BUILD_JOB_NAME,
|
|
139
148
|
envMode: "jobPerEnv",
|
|
140
149
|
stage: "build"
|
|
141
|
-
}, (0, exports.getDockerJobBaseProps)(
|
|
150
|
+
}, (0, exports.getDockerJobBaseProps)()), {
|
|
142
151
|
script: script || []
|
|
143
152
|
}), {
|
|
144
153
|
variables: (0, exports.getDockerBuildVariables)(context),
|
|
@@ -147,15 +156,27 @@ var createDockerBuildJobBase = function (context, _a) {
|
|
|
147
156
|
};
|
|
148
157
|
exports.createDockerBuildJobBase = createDockerBuildJobBase;
|
|
149
158
|
var gitlabDockerLogin = function (context) {
|
|
150
|
-
return (0, deploy_1.isOfDeployType)(context.
|
|
159
|
+
return context.deploy && (0, deploy_1.isOfDeployType)(context.deploy.config, "google-cloudrun") ? __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), ["gcloud auth configure-docker ".concat((0, artifactsRegistry_1.getArtifactsRegistryHost)(context))], false) : ["docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY"];
|
|
151
160
|
};
|
|
152
161
|
exports.gitlabDockerLogin = gitlabDockerLogin;
|
|
162
|
+
var BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS = {
|
|
163
|
+
meteor: "ensureMeteorDockerfile",
|
|
164
|
+
node: "ensureNodeDockerfile",
|
|
165
|
+
nginx: "ensureNginxDockerfile",
|
|
166
|
+
custom: null
|
|
167
|
+
};
|
|
168
|
+
var getDockerBuildScriptWithBuiltInDockerFile = function (context, defaultType) {
|
|
169
|
+
var _a;
|
|
170
|
+
var type = "docker" in context.componentConfig.build && context.componentConfig.build.docker && "type" in context.componentConfig.build.docker ? (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.type : defaultType;
|
|
171
|
+
return (0, exports.getDockerBuildDefaultScript)(context, type ? BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS[type] : null);
|
|
172
|
+
};
|
|
173
|
+
exports.getDockerBuildScriptWithBuiltInDockerFile = getDockerBuildScriptWithBuiltInDockerFile;
|
|
153
174
|
var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
|
|
154
|
-
return __spreadArray(__spreadArray(__spreadArray([ensureDockerFileScript], __read((0, gitlab_1.collapseableSection)("docker-login", "Docker Login")((0, exports.gitlabDockerLogin)(context))), false), __read((0, gitlab_1.collapseableSection)("docker-build", "Docker build")(["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/
|
|
175
|
+
return __spreadArray(__spreadArray(__spreadArray([ensureDockerFileScript !== null && ensureDockerFileScript !== void 0 ? ensureDockerFileScript : undefined], __read((0, gitlab_1.collapseableSection)("docker-login", "Docker Login")((0, exports.gitlabDockerLogin)(context))), false), __read((0, gitlab_1.collapseableSection)("docker-build", "Docker build")(["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/
|
|
155
176
|
])), false), __read((0, gitlab_1.collapseableSection)("docker-push", "Docker push and tag")(["docker push $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_CACHE_IMAGE", "docker push $DOCKER_CACHE_IMAGE"])), false).filter(Boolean);
|
|
156
177
|
};
|
|
157
178
|
exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
|
|
158
179
|
var hasDockerfile = function (context) {
|
|
159
|
-
return (0, fs_1.existsSync)(path_1.default.join(context.
|
|
180
|
+
return (0, fs_1.existsSync)(path_1.default.join(context.build.dir, "Dockerfile"));
|
|
160
181
|
};
|
|
161
182
|
exports.hasDockerfile = hasDockerfile;
|
package/dist/build/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "../types/context";
|
|
2
2
|
import type { EnvironmentContext } from "../types/environmentContext";
|
|
3
3
|
import type { CatladderJob } from "../types/jobs";
|
|
4
4
|
import type { BuildConfig, BuildConfigType } from "./types";
|
|
5
5
|
export * from "./types";
|
|
6
6
|
export * from "./node";
|
|
7
7
|
export type BuildTypes = { [type in BuildConfigType]: {
|
|
8
|
-
jobs: (context:
|
|
8
|
+
jobs: (context: ComponentContext) => CatladderJob[];
|
|
9
9
|
defaults: (envContext: EnvironmentContext<BuildConfigType, any>) => Partial<Extract<BuildConfig, {
|
|
10
10
|
type: type;
|
|
11
11
|
}>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createNodeBuildJobs: (context:
|
|
3
|
+
export declare const createNodeBuildJobs: (context: ComponentContext) => CatladderJob[];
|
|
@@ -46,20 +46,20 @@ var constants_1 = require("./constants");
|
|
|
46
46
|
var yarn_1 = require("./yarn");
|
|
47
47
|
var createNodeBuildJobs = function (context) {
|
|
48
48
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
49
|
-
var buildConfig = context.
|
|
49
|
+
var buildConfig = context.build.config;
|
|
50
50
|
if (!(0, types_1.isOfBuildType)(buildConfig, "node", "node-static", "storybook")) {
|
|
51
51
|
throw new Error("deploy config is not node, node-static or storybook");
|
|
52
52
|
}
|
|
53
53
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
54
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
54
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
55
55
|
return (0, base_1.createBuildJobs)(context, {
|
|
56
56
|
appBuild: buildConfig.buildCommand !== null ? {
|
|
57
57
|
image: (_a = buildConfig.jobImage) !== null && _a !== void 0 ? _a : defaultImage,
|
|
58
58
|
runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
59
|
-
cache: __spreadArray(__spreadArray(__spreadArray([], __read((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : []), false), __read((0, cache_1.getNodeCache)(context)), false), __read((0, cache_1.getNextCache)(context)), false),
|
|
59
|
+
cache: __spreadArray(__spreadArray(__spreadArray([], __read((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : []), false), __read((0, cache_1.getNodeCache)(context.build)), false), __read((0, cache_1.getNextCache)(context)), false),
|
|
60
60
|
script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : []), false),
|
|
61
61
|
artifacts: {
|
|
62
|
-
paths: __spreadArray([context.
|
|
62
|
+
paths: __spreadArray([context.build.dir], __read((_e = (_d = context.build.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.currentWorkspaceDependencies) !== null && _e !== void 0 ? _e : []), false).flatMap(function (dir) {
|
|
63
63
|
var _a, _b;
|
|
64
64
|
return __spreadArray([(0, path_1.join)(dir, "__build_info.json"), (0, path_1.join)(dir, "dist"), (0, path_1.join)(dir, ".next")], __read((_b = (_a = buildConfig.artifactsPaths) === null || _a === void 0 ? void 0 : _a.map(function (path) {
|
|
65
65
|
return (0, path_1.join)(dir, path);
|
|
@@ -71,12 +71,12 @@ var createNodeBuildJobs = function (context) {
|
|
|
71
71
|
jobTags: buildConfig.jobTags
|
|
72
72
|
} : undefined,
|
|
73
73
|
dockerBuild: {
|
|
74
|
-
script: (0, docker_1.
|
|
75
|
-
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
|
|
74
|
+
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "nginx" : "node"),
|
|
75
|
+
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context.build, "pull")), false),
|
|
76
76
|
variables: {
|
|
77
77
|
// only required for non static
|
|
78
|
-
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context),
|
|
79
|
-
DOCKER_COPY_WORKSPACE_FILES: (_g = (_f = context.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.pathsToCopyInDocker.map(function (dir) {
|
|
78
|
+
DOCKER_COPY_AND_INSTALL_APP: (0, yarn_1.getDockerAppCopyAndBuildScript)(context.build),
|
|
79
|
+
DOCKER_COPY_WORKSPACE_FILES: (_g = (_f = context.build.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.pathsToCopyInDocker.map(function (dir) {
|
|
80
80
|
return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir);
|
|
81
81
|
})) === null || _g === void 0 ? void 0 : _g.join("\n")
|
|
82
82
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { BuildContext, ComponentContext } from "../../types/context";
|
|
2
2
|
import type { GitlabJobCache } from "../../types/gitlab-types";
|
|
3
|
-
export declare const getYarnCache: (context:
|
|
4
|
-
export declare const getNodeModulesCache: (context:
|
|
5
|
-
export declare const getNodeCache: (context:
|
|
6
|
-
export declare const getNextCache: (context:
|
|
3
|
+
export declare const getYarnCache: (context: BuildContext, policy?: string) => GitlabJobCache[];
|
|
4
|
+
export declare const getNodeModulesCache: (context: BuildContext, policy?: string) => GitlabJobCache[];
|
|
5
|
+
export declare const getNodeCache: (context: BuildContext, policy?: string) => GitlabJobCache[];
|
|
6
|
+
export declare const getNextCache: (context: ComponentContext) => GitlabJobCache[];
|
package/dist/build/node/cache.js
CHANGED
|
@@ -54,9 +54,9 @@ var getYarnCache = function (context, policy) {
|
|
|
54
54
|
policy: policy,
|
|
55
55
|
paths: [".yarn"]
|
|
56
56
|
} : {
|
|
57
|
-
key: (0, slugify_1.default)(context.
|
|
57
|
+
key: (0, slugify_1.default)(context.dir) + "-yarn",
|
|
58
58
|
policy: policy,
|
|
59
|
-
paths: [(0, path_1.join)(context.
|
|
59
|
+
paths: [(0, path_1.join)(context.dir, ".yarn")]
|
|
60
60
|
}];
|
|
61
61
|
};
|
|
62
62
|
exports.getYarnCache = getYarnCache;
|
|
@@ -70,12 +70,12 @@ var getNodeModulesCache = function (context, policy) {
|
|
|
70
70
|
// It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
|
|
71
71
|
return [{
|
|
72
72
|
// if component is in a shared workspace, use workspace cache. use individual cache else
|
|
73
|
-
key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1.default)(context.
|
|
73
|
+
key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1.default)(context.dir) + "-node-modules",
|
|
74
74
|
// 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
|
|
75
75
|
policy: policy,
|
|
76
76
|
paths: __spreadArray([], __read(componentIsInWorkspace ? (0, lodash_1.uniq)(__spreadArray(["node_modules"], __read((_c = (_b = context.packageManagerInfo) === null || _b === void 0 ? void 0 : _b.workspaces.map(function (w) {
|
|
77
77
|
return (0, path_1.join)(w.location, "node_modules");
|
|
78
|
-
})) !== null && _c !== void 0 ? _c : []), false)) : [(0, path_1.join)(context.
|
|
78
|
+
})) !== null && _c !== void 0 ? _c : []), false)) : [(0, path_1.join)(context.dir, "node_modules")]), false)
|
|
79
79
|
}];
|
|
80
80
|
};
|
|
81
81
|
exports.getNodeModulesCache = getNodeModulesCache;
|
|
@@ -90,7 +90,7 @@ var getNextCache = function (context) {
|
|
|
90
90
|
return [{
|
|
91
91
|
key: context.componentName + "-next-cache",
|
|
92
92
|
policy: "pull-push",
|
|
93
|
-
paths: [context.
|
|
93
|
+
paths: [context.build.dir + "/.next/cache/"]
|
|
94
94
|
}];
|
|
95
95
|
};
|
|
96
96
|
exports.getNextCache = getNextCache;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createNodeJobs: (context:
|
|
4
|
-
export declare const createStorybookJobs: (context:
|
|
5
|
-
export declare const createMeteorJobs: (context:
|
|
3
|
+
export declare const createNodeJobs: (context: ComponentContext) => CatladderJob[];
|
|
4
|
+
export declare const createStorybookJobs: (context: ComponentContext) => CatladderJob[];
|
|
5
|
+
export declare const createMeteorJobs: (context: ComponentContext) => CatladderJob[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createMeteorBuildJobs: (context:
|
|
3
|
+
export declare const createMeteorBuildJobs: (context: ComponentContext) => CatladderJob[];
|
|
@@ -46,18 +46,18 @@ var getMeteorCache = function (context) {
|
|
|
46
46
|
return [{
|
|
47
47
|
key: context.componentName + "meteor-build-cache",
|
|
48
48
|
policy: "pull-push",
|
|
49
|
-
paths: [(0, path_1.join)(context.
|
|
49
|
+
paths: [(0, path_1.join)(context.build.dir, ".meteor/local/resolver-result-cache.json"), (0, path_1.join)(context.build.dir, ".meteor/local/plugin-cache"), (0, path_1.join)(context.build.dir, ".meteor/local/isopacks"), (0, path_1.join)(context.build.dir, ".meteor/local/bundler-cache/scanner")]
|
|
50
50
|
}];
|
|
51
51
|
};
|
|
52
52
|
var createMeteorBuildJobs = function (context) {
|
|
53
|
-
var buildConfig = context.
|
|
53
|
+
var buildConfig = context.build.config;
|
|
54
54
|
if (!(0, types_1.isOfBuildType)(buildConfig, "meteor")) {
|
|
55
55
|
throw new Error("deploy config is not meteor");
|
|
56
56
|
}
|
|
57
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
57
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
58
58
|
return (0, base_1.createBuildJobs)(context, {
|
|
59
59
|
appBuild: buildConfig.buildCommand !== null ? {
|
|
60
|
-
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read(getMeteorCache(context)), false),
|
|
60
|
+
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context.build)), false), __read(getMeteorCache(context)), false),
|
|
61
61
|
image: (0, runner_1.getRunnerImage)("jobs-meteor"),
|
|
62
62
|
variables: {
|
|
63
63
|
METEOR_DISABLE_OPTIMISTIC_CACHING: "1" // see https://forums.meteor.com/t/veeery-long-building-time-inside-docker-container/58673/17?u=macrozone
|
|
@@ -65,11 +65,11 @@ var createMeteorBuildJobs = function (context) {
|
|
|
65
65
|
|
|
66
66
|
script: __spreadArray(__spreadArray([], __read(yarnInstall), false), ['echo "add healthcheck package"', "meteor add panter:healthroute --allow-superuser", "meteor add qualia:prod-shell --allow-superuser", 'TOOL_NODE_FLAGS="--max_old_space_size=3584 --min_semi_space_size=8 --max_semi_space_size=256 --optimize_for_size" meteor build ./dist --architecture os.linux.x86_64 --allow-superuser --server-only --directory', "cp ./__build_info.json ./dist/bundle/programs/server"], false),
|
|
67
67
|
artifacts: {
|
|
68
|
-
paths: [context.
|
|
68
|
+
paths: [context.build.dir + "/__build_info.json", context.build.dir + "/dist"]
|
|
69
69
|
}
|
|
70
70
|
} : undefined,
|
|
71
71
|
dockerBuild: {
|
|
72
|
-
script: (0, docker_1.
|
|
72
|
+
script: (0, docker_1.getDockerBuildScriptWithBuiltInDockerFile)(context, "meteor"),
|
|
73
73
|
variables: {
|
|
74
74
|
METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? "true" : ""
|
|
75
75
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "../../types/context";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createNodeTestJobs: (context:
|
|
3
|
+
export declare const createNodeTestJobs: (context: ComponentContext) => CatladderJob[];
|