@catladder/pipeline 0.0.0-refactor-docker-427f63d6 โ 0.0.0-refactor-docker-45f6e733
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 +3 -3
- 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 +11 -15
- package/dist/build/docker.js +17 -14
- package/dist/build/index.d.ts +2 -2
- package/dist/build/node/buildJob.d.ts +2 -2
- package/dist/build/node/buildJob.js +7 -7
- 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 +5 -5
- 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/bundles/catladder-gitlab/index.js +200 -172
- 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/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 +8 -6
- package/src/build/custom/index.ts +2 -2
- package/src/build/custom/testJob.ts +9 -7
- package/src/build/docker.ts +35 -28
- package/src/build/index.ts +2 -2
- package/src/build/node/buildJob.ts +15 -11
- package/src/build/node/cache.ts +10 -10
- package/src/build/node/index.ts +6 -4
- package/src/build/node/meteor.ts +14 -15
- 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/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[];
|
|
@@ -47,7 +47,7 @@ var RUNNER_BUILD_VARIABLES = {
|
|
|
47
47
|
};
|
|
48
48
|
var createCustomBuildJobs = function (context) {
|
|
49
49
|
var _a, _b, _c;
|
|
50
|
-
var buildConfig = context.
|
|
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,8 +59,8 @@ 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
|
}
|
|
@@ -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,7 +1,7 @@
|
|
|
1
|
-
import type { Context } from "../types";
|
|
2
|
-
import type { CatladderJob } from "../types/jobs";
|
|
3
1
|
import type { BuildConfigDocker } from ".";
|
|
4
|
-
|
|
2
|
+
import type { ComponentContext } from "../types";
|
|
3
|
+
import type { CatladderJob } from "../types/jobs";
|
|
4
|
+
export declare const getDockerImageVariables: (context: ComponentContext) => {
|
|
5
5
|
DOCKER_IMAGE_TAG: string;
|
|
6
6
|
DOCKER_REGISTRY: string;
|
|
7
7
|
DOCKER_IMAGE: import("../bash/BashExpression").StringOrBashExpression;
|
|
@@ -16,12 +16,8 @@ export declare const getDockerImageVariables: (context: Context) => {
|
|
|
16
16
|
/**
|
|
17
17
|
* Weather the context requires a docker build
|
|
18
18
|
*/
|
|
19
|
-
export declare const requiresDockerBuild: (
|
|
20
|
-
|
|
21
|
-
deploy
|
|
22
|
-
}
|
|
23
|
-
}: Context) => boolean;
|
|
24
|
-
export declare const getDockerBuildVariables: (context: Context) => {
|
|
19
|
+
export declare const requiresDockerBuild: (context: ComponentContext) => boolean;
|
|
20
|
+
export declare const getDockerBuildVariables: (context: ComponentContext) => {
|
|
25
21
|
DOCKER_IMAGE_TAG: string;
|
|
26
22
|
DOCKER_REGISTRY: string;
|
|
27
23
|
DOCKER_IMAGE: import("../bash/BashExpression").StringOrBashExpression;
|
|
@@ -61,13 +57,13 @@ export declare const getDockerBuildVariables: (context: Context) => {
|
|
|
61
57
|
DOCKERFILE_ADDITIONS_END: string | undefined;
|
|
62
58
|
};
|
|
63
59
|
export declare const DOCKER_BUILD_JOB_NAME = "\uD83D\uDD28 docker";
|
|
64
|
-
export declare const getDockerJobBaseProps: (
|
|
60
|
+
export declare const getDockerJobBaseProps: () => Pick<CatladderJob, "image" | "services" | "variables" | "runnerVariables">;
|
|
65
61
|
export type DockerBuildJobDefinition = Partial<CatladderJob>;
|
|
66
|
-
export declare const createDockerBuildJobBase: (context:
|
|
62
|
+
export declare const createDockerBuildJobBase: (context: ComponentContext, {
|
|
67
63
|
script,
|
|
68
64
|
...def
|
|
69
65
|
}: Partial<CatladderJob>) => CatladderJob;
|
|
70
|
-
export declare const gitlabDockerLogin: (context:
|
|
71
|
-
export declare const getDockerBuildScriptWithBuiltInDockerFile: (context:
|
|
72
|
-
export declare const getDockerBuildDefaultScript: (context:
|
|
73
|
-
export declare const hasDockerfile: (context:
|
|
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
|
@@ -58,21 +58,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
58
58
|
value: true
|
|
59
59
|
});
|
|
60
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;
|
|
61
|
-
var lodash_1 = require("lodash");
|
|
62
|
-
var deploy_1 = require("../deploy");
|
|
63
|
-
var runner_1 = require("../runner");
|
|
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
|
|
@@ -117,14 +120,14 @@ var getDockerAdditions = function (build) {
|
|
|
117
120
|
};
|
|
118
121
|
};
|
|
119
122
|
var getDockerBuildVariables = function (context) {
|
|
120
|
-
return __assign(__assign(__assign({}, getDockerAdditions(context.
|
|
121
|
-
APP_DIR: context.
|
|
123
|
+
return __assign(__assign(__assign({}, getDockerAdditions(context.build.config)), {
|
|
124
|
+
APP_DIR: context.build.dir,
|
|
122
125
|
DOCKER_DIR: "."
|
|
123
126
|
}), (0, exports.getDockerImageVariables)(context));
|
|
124
127
|
};
|
|
125
128
|
exports.getDockerBuildVariables = getDockerBuildVariables;
|
|
126
129
|
exports.DOCKER_BUILD_JOB_NAME = "๐จ docker";
|
|
127
|
-
var getDockerJobBaseProps = function (
|
|
130
|
+
var getDockerJobBaseProps = function () {
|
|
128
131
|
return {
|
|
129
132
|
image: (0, runner_1.getRunnerImage)("docker-build"),
|
|
130
133
|
services: [{
|
|
@@ -144,7 +147,7 @@ var createDockerBuildJobBase = function (context, _a) {
|
|
|
144
147
|
name: exports.DOCKER_BUILD_JOB_NAME,
|
|
145
148
|
envMode: "jobPerEnv",
|
|
146
149
|
stage: "build"
|
|
147
|
-
}, (0, exports.getDockerJobBaseProps)(
|
|
150
|
+
}, (0, exports.getDockerJobBaseProps)()), {
|
|
148
151
|
script: script || []
|
|
149
152
|
}), {
|
|
150
153
|
variables: (0, exports.getDockerBuildVariables)(context),
|
|
@@ -153,7 +156,7 @@ var createDockerBuildJobBase = function (context, _a) {
|
|
|
153
156
|
};
|
|
154
157
|
exports.createDockerBuildJobBase = createDockerBuildJobBase;
|
|
155
158
|
var gitlabDockerLogin = function (context) {
|
|
156
|
-
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"];
|
|
157
160
|
};
|
|
158
161
|
exports.gitlabDockerLogin = gitlabDockerLogin;
|
|
159
162
|
var BUILT_IN_ENSURE_DOCKERFILE_SCRIPTS = {
|
|
@@ -174,6 +177,6 @@ var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
|
|
|
174
177
|
};
|
|
175
178
|
exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
|
|
176
179
|
var hasDockerfile = function (context) {
|
|
177
|
-
return (0, fs_1.existsSync)(path_1.default.join(context.
|
|
180
|
+
return (0, fs_1.existsSync)(path_1.default.join(context.build.dir, "Dockerfile"));
|
|
178
181
|
};
|
|
179
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);
|
|
@@ -72,11 +72,11 @@ var createNodeBuildJobs = function (context) {
|
|
|
72
72
|
} : undefined,
|
|
73
73
|
dockerBuild: {
|
|
74
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, "pull")), false),
|
|
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,7 +65,7 @@ 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: {
|
|
@@ -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[];
|
|
@@ -58,41 +58,41 @@ var createNodeTestJobs = function (context) {
|
|
|
58
58
|
if (context.trigger === "taggedRelease") {
|
|
59
59
|
return [];
|
|
60
60
|
}
|
|
61
|
-
var buildConfig = context.
|
|
61
|
+
var buildConfig = context.build.config;
|
|
62
62
|
var defaultImage = (0, runner_1.getRunnerImage)("jobs-default");
|
|
63
63
|
var base = {
|
|
64
64
|
variables: __assign(__assign({
|
|
65
|
-
APP_PATH: context.
|
|
65
|
+
APP_PATH: context.build.dir
|
|
66
66
|
}, context.environment.jobOnlyVars.build.envVars), (_a = buildConfig.extraVars) !== null && _a !== void 0 ? _a : {}),
|
|
67
67
|
runnerVariables: constants_1.NODE_RUNNER_BUILD_VARIABLES,
|
|
68
68
|
stage: "test",
|
|
69
69
|
needs: [],
|
|
70
70
|
envMode: "none"
|
|
71
71
|
};
|
|
72
|
-
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
72
|
+
var yarnInstall = (0, yarn_1.getYarnInstall)(context.build);
|
|
73
73
|
var auditJob = buildConfig.audit !== false ? __assign(__assign(__assign({
|
|
74
74
|
name: "๐ก audit"
|
|
75
75
|
}, base), {
|
|
76
76
|
image: (_c = (_b = buildConfig.audit) === null || _b === void 0 ? void 0 : _b.jobImage) !== null && _c !== void 0 ? _c : defaultImage,
|
|
77
77
|
cache: undefined,
|
|
78
|
-
script: __spreadArray(["cd ".concat(context.
|
|
78
|
+
script: __spreadArray(["cd ".concat(context.build.dir)], __read((_e = (0, utils_1.ensureArray)((_d = buildConfig.audit) === null || _d === void 0 ? void 0 : _d.command)) !== null && _e !== void 0 ? _e : [((_f = context.build.packageManagerInfo) === null || _f === void 0 ? void 0 : _f.isClassic) ? "yarn audit" : "yarn npm audit --environment production" // yarn 2
|
|
79
79
|
]), false),
|
|
80
80
|
allow_failure: true
|
|
81
|
-
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.
|
|
81
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_g = buildConfig.audit) === null || _g === void 0 ? void 0 : _g.artifactsReports, (_h = buildConfig.audit) === null || _h === void 0 ? void 0 : _h.artifacts)) : null;
|
|
82
82
|
var lintJob = buildConfig.lint !== false ? __assign(__assign(__assign({
|
|
83
83
|
name: "๐ฎ lint"
|
|
84
84
|
}, base), {
|
|
85
85
|
image: (_k = (_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.jobImage) !== null && _k !== void 0 ? _k : defaultImage,
|
|
86
|
-
cache: (0, cache_1.getNodeCache)(context),
|
|
87
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.
|
|
88
|
-
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.
|
|
86
|
+
cache: (0, cache_1.getNodeCache)(context.build),
|
|
87
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.build)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_m = (0, utils_1.ensureArray)((_l = buildConfig.lint) === null || _l === void 0 ? void 0 : _l.command)) !== null && _m !== void 0 ? _m : ["yarn lint"]), false)
|
|
88
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_o = buildConfig.lint) === null || _o === void 0 ? void 0 : _o.artifactsReports, (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.artifacts)) : null;
|
|
89
89
|
var testJob = buildConfig.test !== false ? __assign(__assign(__assign({
|
|
90
90
|
name: "๐งช test"
|
|
91
91
|
}, base), {
|
|
92
92
|
image: (_r = (_q = buildConfig.test) === null || _q === void 0 ? void 0 : _q.jobImage) !== null && _r !== void 0 ? _r : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
|
|
93
|
-
cache: (0, cache_1.getNodeCache)(context),
|
|
94
|
-
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.
|
|
95
|
-
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.
|
|
93
|
+
cache: (0, cache_1.getNodeCache)(context.build),
|
|
94
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context.build)), false), ["cd ".concat(context.build.dir)], false), __read(yarnInstall), false), __read((_t = (0, utils_1.ensureArray)((_s = buildConfig.test) === null || _s === void 0 ? void 0 : _s.command)) !== null && _t !== void 0 ? _t : ["yarn test"]), false)
|
|
95
|
+
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.build.dir, (_u = buildConfig.test) === null || _u === void 0 ? void 0 : _u.artifactsReports, (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.artifacts)) : null;
|
|
96
96
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
97
97
|
};
|
|
98
98
|
exports.createNodeTestJobs = createNodeTestJobs;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BashExpression } from "../../bash/BashExpression";
|
|
2
|
-
import type {
|
|
3
|
-
export declare const ensureNodeVersion: (context:
|
|
4
|
-
export declare const getYarnInstall: (context:
|
|
2
|
+
import type { BuildContext } from "../../types";
|
|
3
|
+
export declare const ensureNodeVersion: (context: BuildContext) => string[];
|
|
4
|
+
export declare const getYarnInstall: (context: BuildContext, options?: {
|
|
5
5
|
noCustomPostInstall: boolean;
|
|
6
6
|
}) => string[];
|
|
7
|
-
export declare const getDockerAppCopyAndBuildScript: (context:
|
|
7
|
+
export declare const getDockerAppCopyAndBuildScript: (context: BuildContext) => BashExpression;
|
package/dist/build/node/yarn.js
CHANGED
|
@@ -54,7 +54,7 @@ var ensureNodeVersion = function (context) {
|
|
|
54
54
|
exports.ensureNodeVersion = ensureNodeVersion;
|
|
55
55
|
var getYarnInstall = function (context, options) {
|
|
56
56
|
var _a;
|
|
57
|
-
var postInstall = "postInstall" in context.
|
|
57
|
+
var postInstall = "postInstall" in context.config ? context.config.postInstall : null;
|
|
58
58
|
return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), __read((0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(context)])), false), __read(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall) ? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((_a = (0, utils_1.ensureArray)(postInstall)) !== null && _a !== void 0 ? _a : []) : []), false);
|
|
59
59
|
};
|
|
60
60
|
exports.getYarnInstall = getYarnInstall;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ComponentContext } from "../..";
|
|
2
2
|
import type { CatladderJob } from "../../types/jobs";
|
|
3
|
-
export declare const createRailsBuildJobs: (context:
|
|
3
|
+
export declare const createRailsBuildJobs: (context: ComponentContext) => CatladderJob[];
|