@catladder/pipeline 1.11.0 โ 1.14.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/createBuildJob.d.ts +4 -2
- package/dist/build/base/createBuildJob.js +13 -18
- package/dist/build/docker.d.ts +28 -4
- package/dist/build/docker.js +56 -25
- package/dist/build/index.d.ts +2 -2
- package/dist/build/node/buildJob.d.ts +2 -2
- package/dist/build/node/buildJob.js +26 -13
- package/dist/build/node/cache.d.ts +3 -1
- package/dist/build/node/cache.js +33 -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 +4 -23
- package/dist/build/node/testJob.d.ts +2 -2
- package/dist/build/node/testJob.js +20 -29
- package/dist/build/node/yarn.d.ts +4 -0
- package/dist/build/node/yarn.js +10 -3
- package/dist/build/tests/storybook.test.js +10 -23
- package/dist/build/types.d.ts +6 -0
- package/dist/catladder-gitlab.js +33 -2
- package/dist/constants.js +1 -1
- package/dist/context/index.d.ts +2 -2
- package/dist/context/index.js +2 -2
- package/dist/deploy/base.d.ts +3 -4
- package/dist/deploy/base.js +27 -33
- package/dist/deploy/index.d.ts +2 -2
- package/dist/deploy/kubernetes/deployJob.d.ts +2 -2
- package/dist/deploy/kubernetes/deployJob.js +32 -38
- package/dist/pipeline/createChildPipeline.d.ts +2 -11
- package/dist/pipeline/createChildPipeline.js +24 -18
- package/dist/pipeline/createChildPipeline.test.js +3 -14
- package/dist/pipeline/createJobs.d.ts +2 -2
- package/dist/pipeline/createJobs.js +29 -23
- package/dist/pipeline/gitlab/makeGitlabJob.d.ts +8 -0
- package/dist/pipeline/gitlab/makeGitlabJob.js +45 -0
- package/dist/pipeline/packageManager.d.ts +2 -0
- package/dist/pipeline/{yarnInfo.js โ packageManager.js} +24 -12
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/context.d.ts +15 -11
- package/dist/types/gitlab-types.d.ts +10 -22
- package/dist/types/gitlab-types.js +1 -3
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.js +3 -1
- package/dist/types/jobs.d.ts +75 -0
- package/dist/types/jobs.js +5 -0
- package/dist/types/pipeline.d.ts +4 -0
- package/dist/types/pipeline.js +3 -0
- package/package.json +1 -1
- package/src/build/base/createBuildJob.ts +29 -31
- package/src/build/docker.ts +60 -40
- package/src/build/index.ts +3 -2
- package/src/build/node/buildJob.ts +35 -25
- package/src/build/node/cache.ts +30 -5
- package/src/build/node/index.ts +4 -4
- package/src/build/node/meteor.ts +10 -18
- package/src/build/node/testJob.ts +31 -40
- package/src/build/node/yarn.ts +20 -3
- package/src/build/tests/storybook.test.ts +4 -2
- package/src/build/types.ts +6 -0
- package/src/catladder-gitlab.ts +9 -5
- package/src/context/index.ts +8 -4
- package/src/deploy/base.ts +40 -45
- package/src/deploy/index.ts +2 -2
- package/src/deploy/kubernetes/deployJob.ts +43 -48
- package/src/pipeline/createChildPipeline.test.ts +2 -1
- package/src/pipeline/createChildPipeline.ts +23 -21
- package/src/pipeline/createJobs.ts +50 -41
- package/src/pipeline/gitlab/makeGitlabJob.ts +16 -0
- package/src/pipeline/packageManager.ts +99 -0
- package/src/types/context.ts +14 -7
- package/src/types/gitlab-types.ts +10 -30
- package/src/types/index.ts +1 -0
- package/src/types/jobs.ts +88 -0
- package/src/types/pipeline.ts +11 -0
- package/dist/pipeline/yarnInfo.d.ts +0 -2
- package/src/pipeline/yarnInfo.ts +0 -73
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { Context
|
|
1
|
+
import { Context } from "../..";
|
|
2
|
+
import { CatladderJob } from "../../types/jobs";
|
|
2
3
|
export declare const createBuildJob: (context: Context, {
|
|
3
4
|
script,
|
|
5
|
+
variables,
|
|
4
6
|
...def
|
|
5
|
-
}: Partial<
|
|
7
|
+
}: Partial<CatladderJob>) => CatladderJob;
|
|
@@ -67,8 +67,6 @@ var lodash_1 = require("lodash");
|
|
|
67
67
|
|
|
68
68
|
var __1 = require("../..");
|
|
69
69
|
|
|
70
|
-
var defaults_1 = require("../../defaults");
|
|
71
|
-
|
|
72
70
|
var utils_1 = require("../../utils");
|
|
73
71
|
|
|
74
72
|
var constants_1 = require("./constants");
|
|
@@ -79,25 +77,22 @@ var createBuildJob = function (context, _a) {
|
|
|
79
77
|
var _b, _c;
|
|
80
78
|
|
|
81
79
|
var script = _a.script,
|
|
82
|
-
|
|
80
|
+
variables = _a.variables,
|
|
81
|
+
def = __rest(_a, ["script", "variables"]);
|
|
83
82
|
|
|
84
|
-
return {
|
|
83
|
+
return (0, lodash_1.merge)({
|
|
85
84
|
name: constants_1.APP_BUILD_JOB_NAME,
|
|
86
85
|
envMode: "jobPerEnv",
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
paths: [context.componentConfig.dir + "/__build_info.json"]
|
|
98
|
-
}
|
|
99
|
-
}, def)
|
|
100
|
-
};
|
|
86
|
+
stage: "build",
|
|
87
|
+
image: (0, __1.getRunnerImage)("jobs-default"),
|
|
88
|
+
needs: [],
|
|
89
|
+
cache: [],
|
|
90
|
+
variables: __assign(__assign(__assign(__assign({}, constants_1.RUNNER_BUILD_RESOURCE_VARIABLES), variables !== null && variables !== void 0 ? variables : {}), context.environment.envVars), (_b = context.componentConfig.build.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
91
|
+
script: __spreadArray(__spreadArray(__spreadArray([], __read((0, getBuildInfo_1.getBuildInfo)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read((_c = (0, utils_1.ensureArray)(script)) !== null && _c !== void 0 ? _c : []), false),
|
|
92
|
+
artifacts: {
|
|
93
|
+
paths: [context.componentConfig.dir + "/__build_info.json"]
|
|
94
|
+
}
|
|
95
|
+
}, def);
|
|
101
96
|
};
|
|
102
97
|
|
|
103
98
|
exports.createBuildJob = createBuildJob;
|
package/dist/build/docker.d.ts
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "../types";
|
|
2
|
+
import { CatladderJob } from "../types/jobs";
|
|
3
|
+
export declare const getDockerBuildVariables: (context: Context) => {
|
|
4
|
+
DOCKER_BUILDKIT: string;
|
|
5
|
+
DOCKERFILE_ADDITIONS: string | undefined;
|
|
6
|
+
DOCKERFILE_ADDITIONS_END: string | undefined;
|
|
7
|
+
APP_DIR: string;
|
|
8
|
+
DOCKER_HOST: string;
|
|
9
|
+
DOCKER_TLS_CERTDIR: string;
|
|
10
|
+
DOCKER_DIR: string;
|
|
11
|
+
IMAGE_TAG: string;
|
|
12
|
+
DOCKER_DRIVER: string;
|
|
13
|
+
IMAGE_NAME: string;
|
|
14
|
+
CACHE_IMAGE: string;
|
|
15
|
+
KUBERNETES_CPU_REQUEST: string;
|
|
16
|
+
KUBERNETES_CPU_LIMIT: string;
|
|
17
|
+
KUBERNETES_MEMORY_REQUEST: string;
|
|
18
|
+
KUBERNETES_MEMORY_LIMIT: string;
|
|
19
|
+
};
|
|
2
20
|
export declare const DOCKER_BUILD_JOB_NAME = "\uD83D\uDD28 docker";
|
|
3
|
-
export declare const
|
|
4
|
-
script
|
|
5
|
-
|
|
21
|
+
export declare const createDockerBuildJobBase: (context: Context, {
|
|
22
|
+
script,
|
|
23
|
+
variables,
|
|
24
|
+
...def
|
|
25
|
+
}: Partial<CatladderJob>) => CatladderJob;
|
|
26
|
+
export declare const createDockerBuildJobDefault: (context: Context, {
|
|
27
|
+
script,
|
|
28
|
+
...def
|
|
29
|
+
}: Partial<CatladderJob>) => CatladderJob;
|
package/dist/build/docker.js
CHANGED
|
@@ -14,6 +14,17 @@ var __assign = this && this.__assign || function () {
|
|
|
14
14
|
return __assign.apply(this, arguments);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
var __rest = this && this.__rest || function (s, e) {
|
|
18
|
+
var t = {};
|
|
19
|
+
|
|
20
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
21
|
+
|
|
22
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
23
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
24
|
+
}
|
|
25
|
+
return t;
|
|
26
|
+
};
|
|
27
|
+
|
|
17
28
|
var __read = this && this.__read || function (o, n) {
|
|
18
29
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19
30
|
if (!m) return o;
|
|
@@ -50,7 +61,9 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
50
61
|
};
|
|
51
62
|
|
|
52
63
|
exports.__esModule = true;
|
|
53
|
-
exports.
|
|
64
|
+
exports.createDockerBuildJobDefault = exports.createDockerBuildJobBase = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = void 0;
|
|
65
|
+
|
|
66
|
+
var lodash_1 = require("lodash");
|
|
54
67
|
|
|
55
68
|
var runner_1 = require("../runner");
|
|
56
69
|
|
|
@@ -60,38 +73,56 @@ var DOCKER_RUNNER_BUILD_VARIABLES = {
|
|
|
60
73
|
KUBERNETES_MEMORY_REQUEST: "1Gi",
|
|
61
74
|
KUBERNETES_MEMORY_LIMIT: "2Gi"
|
|
62
75
|
};
|
|
76
|
+
|
|
77
|
+
var getDockerBuildVariables = function (context) {
|
|
78
|
+
var _a, _b, _c, _d;
|
|
79
|
+
|
|
80
|
+
return __assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
|
|
81
|
+
DOCKER_BUILDKIT: "1",
|
|
82
|
+
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"),
|
|
83
|
+
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"),
|
|
84
|
+
APP_DIR: context.componentConfig.dir,
|
|
85
|
+
DOCKER_HOST: "tcp://0.0.0.0:2375",
|
|
86
|
+
DOCKER_TLS_CERTDIR: "",
|
|
87
|
+
DOCKER_DIR: ".",
|
|
88
|
+
IMAGE_TAG: "$CI_COMMIT_SHA",
|
|
89
|
+
DOCKER_DRIVER: "overlay2",
|
|
90
|
+
IMAGE_NAME: "$CI_REGISTRY_IMAGE/" + context.environment.shortName + "/" + context.componentName,
|
|
91
|
+
CACHE_IMAGE: "$CI_REGISTRY_IMAGE/caches/" + context.componentName
|
|
92
|
+
});
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
exports.getDockerBuildVariables = getDockerBuildVariables;
|
|
63
96
|
exports.DOCKER_BUILD_JOB_NAME = "๐จ docker";
|
|
64
97
|
|
|
65
|
-
var
|
|
66
|
-
var
|
|
98
|
+
var createDockerBuildJobBase = function (context, _a) {
|
|
99
|
+
var script = _a.script,
|
|
100
|
+
variables = _a.variables,
|
|
101
|
+
def = __rest(_a, ["script", "variables"]);
|
|
67
102
|
|
|
68
|
-
|
|
69
|
-
|
|
103
|
+
return (0, lodash_1.merge)({
|
|
104
|
+
name: exports.DOCKER_BUILD_JOB_NAME,
|
|
105
|
+
envMode: "jobPerEnv",
|
|
70
106
|
stage: "build",
|
|
71
107
|
image: (0, runner_1.getRunnerImage)("docker-build"),
|
|
72
|
-
interruptible: true,
|
|
73
108
|
services: [{
|
|
74
109
|
name: "docker:20-dind",
|
|
75
110
|
command: ["--tls=false"]
|
|
76
111
|
}],
|
|
77
|
-
variables: __assign(__assign({},
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
};
|
|
92
|
-
return __assign(__assign({}, base), {
|
|
93
|
-
script: __spreadArray(__spreadArray([], __read(script), false), ["docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY", "docker build --network host --cache-from $CACHE_IMAGE --tag $IMAGE_NAME:$IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1", "docker push $IMAGE_NAME:$IMAGE_TAG", "docker tag $IMAGE_NAME:$IMAGE_TAG $CACHE_IMAGE", "docker push $CACHE_IMAGE"], false)
|
|
94
|
-
});
|
|
112
|
+
variables: __assign(__assign({}, (0, exports.getDockerBuildVariables)(context)), variables !== null && variables !== void 0 ? variables : {}),
|
|
113
|
+
script: script || []
|
|
114
|
+
}, def);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
exports.createDockerBuildJobBase = createDockerBuildJobBase;
|
|
118
|
+
|
|
119
|
+
var createDockerBuildJobDefault = function (context, _a) {
|
|
120
|
+
var script = _a.script,
|
|
121
|
+
def = __rest(_a, ["script"]);
|
|
122
|
+
|
|
123
|
+
return (0, exports.createDockerBuildJobBase)(context, __assign({
|
|
124
|
+
script: __spreadArray(__spreadArray([], __read(script || []), false), ["docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY", "docker build --network host --cache-from $CACHE_IMAGE --tag $IMAGE_NAME:$IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1", "docker push $IMAGE_NAME:$IMAGE_TAG", "docker tag $IMAGE_NAME:$IMAGE_TAG $CACHE_IMAGE", "docker push $CACHE_IMAGE"], false)
|
|
125
|
+
}, def));
|
|
95
126
|
};
|
|
96
127
|
|
|
97
|
-
exports.
|
|
128
|
+
exports.createDockerBuildJobDefault = createDockerBuildJobDefault;
|
package/dist/build/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Context } from "../types/context";
|
|
2
|
-
import {
|
|
2
|
+
import { CatladderJob } from "../types/jobs";
|
|
3
3
|
import { BuildConfig } from "./types";
|
|
4
4
|
export * from "./types";
|
|
5
5
|
export * from "./node";
|
|
6
6
|
export declare type BuildTypes = { [type in BuildConfig["type"]]: {
|
|
7
|
-
jobs: (context: Context) =>
|
|
7
|
+
jobs: (context: Context) => CatladderJob[];
|
|
8
8
|
defaults: () => Partial<Extract<BuildConfig, {
|
|
9
9
|
type: type;
|
|
10
10
|
}>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Context } from "../../types/context";
|
|
2
|
-
import {
|
|
3
|
-
export declare const createNodeBuildJobs: (context: Context) =>
|
|
2
|
+
import { CatladderJob } from "../../types/jobs";
|
|
3
|
+
export declare const createNodeBuildJobs: (context: Context) => CatladderJob[];
|
|
@@ -60,6 +60,8 @@ var createBuildJob_1 = require("../base/createBuildJob");
|
|
|
60
60
|
|
|
61
61
|
var docker_1 = require("../docker");
|
|
62
62
|
|
|
63
|
+
var path_1 = require("path");
|
|
64
|
+
|
|
63
65
|
var types_1 = require("../types");
|
|
64
66
|
|
|
65
67
|
var cache_1 = require("./cache");
|
|
@@ -69,7 +71,7 @@ var constants_2 = require("./constants");
|
|
|
69
71
|
var yarn_1 = require("./yarn");
|
|
70
72
|
|
|
71
73
|
var createNodeBuildJobs = function (context) {
|
|
72
|
-
var _a, _b;
|
|
74
|
+
var _a, _b, _c, _d, _e;
|
|
73
75
|
|
|
74
76
|
var buildConfig = context.componentConfig.build;
|
|
75
77
|
|
|
@@ -79,22 +81,33 @@ var createNodeBuildJobs = function (context) {
|
|
|
79
81
|
|
|
80
82
|
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
81
83
|
var appBuildJob = buildConfig.buildCommand !== null ? (0, createBuildJob_1.createBuildJob)(context, {
|
|
82
|
-
variables: __assign(
|
|
84
|
+
variables: __assign({}, constants_2.NODE_RUNNER_BUILD_VARIABLES),
|
|
83
85
|
cache: __spreadArray(__spreadArray([], __read((0, cache_1.getNodeCache)(context)), false), __read((0, cache_1.getNextCache)(context)), false),
|
|
84
|
-
script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read((
|
|
86
|
+
script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read((_a = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _a !== void 0 ? _a : []), false),
|
|
85
87
|
artifacts: {
|
|
86
|
-
paths: [context.componentConfig.dir
|
|
88
|
+
paths: __spreadArray([(0, path_1.join)(context.componentConfig.dir, "__build_info.json"), (0, path_1.join)(context.componentConfig.dir, "dist"), (0, path_1.join)(context.componentConfig.dir, ".next")], __read((_c = (_b = buildConfig.artifactsPaths) === null || _b === void 0 ? void 0 : _b.map(function (path) {
|
|
89
|
+
return (0, path_1.join)(context.componentConfig.dir, path);
|
|
90
|
+
})) !== null && _c !== void 0 ? _c : []), false)
|
|
87
91
|
}
|
|
88
92
|
}) : null;
|
|
89
|
-
return __spreadArray(__spreadArray([], __read(appBuildJob ? [appBuildJob] : []), false), [{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
93
|
+
return __spreadArray(__spreadArray([], __read(appBuildJob ? [appBuildJob] : []), false), [(0, docker_1.createDockerBuildJobDefault)(context, {
|
|
94
|
+
script: [buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "ensureNginxDockerfile" : "ensureNodeDockerfile"],
|
|
95
|
+
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
|
|
96
|
+
variables: {
|
|
97
|
+
// only required for non static
|
|
98
|
+
YARN_INSTALL: (0, yarn_1.getYarnInstallCommand)(context, {
|
|
99
|
+
prodOnly: true
|
|
100
|
+
}),
|
|
101
|
+
YARN_INSTALL_WITHOUT_SCRIPTS: (0, yarn_1.getYarnInstallCommand)(context, {
|
|
102
|
+
prodOnly: true,
|
|
103
|
+
noScripts: true
|
|
104
|
+
}),
|
|
105
|
+
DOCKER_COPY_WORKSPACE_FILES: (_e = (_d = context.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.pathsToCopyInDocker.map(function (dir) {
|
|
106
|
+
return "COPY --chown=node:node ".concat(dir, " /app/").concat(dir);
|
|
107
|
+
})) === null || _e === void 0 ? void 0 : _e.join("\n")
|
|
108
|
+
},
|
|
109
|
+
needs: appBuildJob ? [constants_1.APP_BUILD_JOB_NAME] : []
|
|
110
|
+
})], false);
|
|
98
111
|
};
|
|
99
112
|
|
|
100
113
|
exports.createNodeBuildJobs = createNodeBuildJobs;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Context } from "../../types/context";
|
|
2
2
|
import { GitlabJobCache } from "../../types/gitlab-types";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const getYarnCache: (context: Context, policy?: string) => GitlabJobCache[];
|
|
4
|
+
export declare const getNodeModulesCache: (context: Context, policy?: string) => GitlabJobCache[];
|
|
5
|
+
export declare const getNodeCache: (context: Context, policy?: string) => GitlabJobCache[];
|
|
4
6
|
export declare const getNextCache: (context: Context) => GitlabJobCache[];
|
package/dist/build/node/cache.js
CHANGED
|
@@ -36,24 +36,52 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
exports.__esModule = true;
|
|
39
|
-
exports.getNextCache = exports.getNodeCache = void 0;
|
|
39
|
+
exports.getNextCache = exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void 0;
|
|
40
40
|
|
|
41
41
|
var path_1 = require("path");
|
|
42
42
|
|
|
43
|
-
var
|
|
43
|
+
var getYarnCache = function (context, policy) {
|
|
44
|
+
if (policy === void 0) {
|
|
45
|
+
policy = "pull-push";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return [{
|
|
49
|
+
key: "yarn",
|
|
50
|
+
policy: policy,
|
|
51
|
+
paths: [".yarn"]
|
|
52
|
+
}];
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
exports.getYarnCache = getYarnCache;
|
|
56
|
+
|
|
57
|
+
var getNodeModulesCache = function (context, policy) {
|
|
44
58
|
var _a, _b, _c;
|
|
45
59
|
|
|
46
|
-
|
|
60
|
+
if (policy === void 0) {
|
|
61
|
+
policy = "pull-push";
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
var componentIsInWorkspace = (_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace;
|
|
47
65
|
return [{
|
|
48
66
|
// if component is in a shared workspace, use workspace cache. use individual cache else
|
|
49
67
|
key: componentIsInWorkspace ? "node-modules-workspace" : context.componentConfig.dir + "-node-modules",
|
|
50
|
-
policy:
|
|
51
|
-
paths: __spreadArray([
|
|
68
|
+
policy: policy,
|
|
69
|
+
paths: __spreadArray([], __read(componentIsInWorkspace ? __spreadArray(["node_modules"], __read((_c = (_b = context.packageManagerInfo) === null || _b === void 0 ? void 0 : _b.workspaces.map(function (w) {
|
|
52
70
|
return (0, path_1.join)(w.location, "node_modules");
|
|
53
71
|
})) !== null && _c !== void 0 ? _c : []), false) : [(0, path_1.join)(context.componentConfig.dir, "node_modules")]), false)
|
|
54
72
|
}];
|
|
55
73
|
};
|
|
56
74
|
|
|
75
|
+
exports.getNodeModulesCache = getNodeModulesCache;
|
|
76
|
+
|
|
77
|
+
var getNodeCache = function (context, policy) {
|
|
78
|
+
if (policy === void 0) {
|
|
79
|
+
policy = "pull-push";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
return __spreadArray(__spreadArray([], __read((0, exports.getYarnCache)(context, policy)), false), __read((0, exports.getNodeModulesCache)(context, policy)), false);
|
|
83
|
+
};
|
|
84
|
+
|
|
57
85
|
exports.getNodeCache = getNodeCache;
|
|
58
86
|
|
|
59
87
|
var getNextCache = function (context) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Context } from "../../types/context";
|
|
2
|
-
import
|
|
3
|
-
export declare const createNodeJobs: (context: Context) =>
|
|
4
|
-
export declare const createStorybookJobs: (context: Context) =>
|
|
5
|
-
export declare const createMeteorJobs: (context: Context) =>
|
|
2
|
+
import { CatladderJob } from "../../types/jobs";
|
|
3
|
+
export declare const createNodeJobs: (context: Context) => CatladderJob[];
|
|
4
|
+
export declare const createStorybookJobs: (context: Context) => CatladderJob[];
|
|
5
|
+
export declare const createMeteorJobs: (context: Context) => CatladderJob[];
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Context } from "../../types/context";
|
|
2
|
-
import
|
|
3
|
-
export declare const createMeteorBuildJobs: (context: Context) =>
|
|
2
|
+
import { CatladderJob } from "../../types/jobs";
|
|
3
|
+
export declare const createMeteorBuildJobs: (context: Context) => CatladderJob[];
|
|
@@ -1,19 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var __assign = this && this.__assign || function () {
|
|
4
|
-
__assign = Object.assign || function (t) {
|
|
5
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
-
s = arguments[i];
|
|
7
|
-
|
|
8
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
return __assign.apply(this, arguments);
|
|
15
|
-
};
|
|
16
|
-
|
|
17
3
|
var __read = this && this.__read || function (o, n) {
|
|
18
4
|
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19
5
|
if (!m) return o;
|
|
@@ -92,15 +78,10 @@ var createMeteorBuildJobs = function (context) {
|
|
|
92
78
|
paths: [context.componentConfig.dir + "/__build_info.json", context.componentConfig.dir + "/dist"]
|
|
93
79
|
}
|
|
94
80
|
}) : null;
|
|
95
|
-
return __spreadArray(__spreadArray([], __read(appBuildJob ? [appBuildJob] : []), false), [{
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
script: ["ensureMeteorDockerfile"]
|
|
100
|
-
})), {
|
|
101
|
-
needs: appBuildJob ? [constants_1.APP_BUILD_JOB_NAME] : []
|
|
102
|
-
})
|
|
103
|
-
}], false);
|
|
81
|
+
return __spreadArray(__spreadArray([], __read(appBuildJob ? [appBuildJob] : []), false), [(0, docker_1.createDockerBuildJobDefault)(context, {
|
|
82
|
+
script: ["ensureMeteorDockerfile"],
|
|
83
|
+
needs: appBuildJob ? [constants_1.APP_BUILD_JOB_NAME] : []
|
|
84
|
+
})], false);
|
|
104
85
|
};
|
|
105
86
|
|
|
106
87
|
exports.createMeteorBuildJobs = createMeteorBuildJobs;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Context } from "../../types/context";
|
|
2
|
-
import {
|
|
3
|
-
export declare const createNodeTestJobs: (context: Context) =>
|
|
2
|
+
import { CatladderJob } from "../../types/jobs";
|
|
3
|
+
export declare const createNodeTestJobs: (context: Context) => CatladderJob[];
|
|
@@ -52,8 +52,6 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
52
52
|
exports.__esModule = true;
|
|
53
53
|
exports.createNodeTestJobs = void 0;
|
|
54
54
|
|
|
55
|
-
var defaults_1 = require("../../defaults");
|
|
56
|
-
|
|
57
55
|
var utils_1 = require("../../utils");
|
|
58
56
|
|
|
59
57
|
var cache_1 = require("./cache");
|
|
@@ -76,36 +74,29 @@ var createNodeTestJobs = function (context) {
|
|
|
76
74
|
APP_PATH: context.componentConfig.dir
|
|
77
75
|
}, constants_1.NODE_RUNNER_BUILD_VARIABLES), (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {}),
|
|
78
76
|
stage: "test",
|
|
79
|
-
interruptible: true,
|
|
80
77
|
needs: [],
|
|
81
|
-
|
|
78
|
+
envMode: "none"
|
|
82
79
|
};
|
|
83
80
|
var yarnInstall = (0, yarn_1.getYarnInstall)(context);
|
|
84
|
-
var auditJob = buildConfig.audit !== false ? {
|
|
85
|
-
name: "๐ก audit"
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
envMode: "none",
|
|
104
|
-
job: __assign(__assign({}, base), {
|
|
105
|
-
cache: (0, cache_1.getNodeCache)(context),
|
|
106
|
-
script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(yarnInstall), false), __read((_h = (0, utils_1.ensureArray)((_g = buildConfig.test) === null || _g === void 0 ? void 0 : _g.command)) !== null && _h !== void 0 ? _h : ["yarn test"]), false)
|
|
107
|
-
})
|
|
108
|
-
} : null;
|
|
81
|
+
var auditJob = buildConfig.audit !== false ? __assign(__assign({
|
|
82
|
+
name: "๐ก audit"
|
|
83
|
+
}, base), {
|
|
84
|
+
cache: undefined,
|
|
85
|
+
script: __spreadArray(["cd ".concat(context.componentConfig.dir)], __read((_d = (0, utils_1.ensureArray)((_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.command)) !== null && _d !== void 0 ? _d : ["yarn audit"]), false),
|
|
86
|
+
allow_failure: true
|
|
87
|
+
}) : null;
|
|
88
|
+
var lintJob = buildConfig.lint !== false ? __assign(__assign({
|
|
89
|
+
name: "๐ฎ lint"
|
|
90
|
+
}, base), {
|
|
91
|
+
cache: (0, cache_1.getNodeCache)(context),
|
|
92
|
+
script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(yarnInstall), false), __read((_f = (0, utils_1.ensureArray)((_e = buildConfig.lint) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : ["yarn lint"]), false)
|
|
93
|
+
}) : null;
|
|
94
|
+
var testJob = buildConfig.test !== false ? __assign(__assign({
|
|
95
|
+
name: "๐งช test"
|
|
96
|
+
}, base), {
|
|
97
|
+
cache: (0, cache_1.getNodeCache)(context),
|
|
98
|
+
script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(yarnInstall), false), __read((_h = (0, utils_1.ensureArray)((_g = buildConfig.test) === null || _g === void 0 ? void 0 : _g.command)) !== null && _h !== void 0 ? _h : ["yarn test"]), false)
|
|
99
|
+
}) : null;
|
|
109
100
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
110
101
|
};
|
|
111
102
|
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { Context } from "../../types";
|
|
2
|
+
export declare const getYarnInstallCommand: (context: Context, options?: {
|
|
3
|
+
prodOnly?: boolean | undefined;
|
|
4
|
+
noScripts?: boolean | undefined;
|
|
5
|
+
} | undefined) => string;
|
|
2
6
|
export declare const getYarnInstall: (context: Context) => string[];
|
package/dist/build/node/yarn.js
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.getYarnInstall = void 0;
|
|
4
|
+
exports.getYarnInstall = exports.getYarnInstallCommand = void 0;
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var getYarnInstallCommand = function (context, options) {
|
|
7
7
|
var _a;
|
|
8
8
|
|
|
9
|
-
return
|
|
9
|
+
return ((_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.isClassic) ? "yarn install --frozen-lockfile ".concat((options === null || options === void 0 ? void 0 : options.prodOnly) ? "--production" : "", " ").concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "--ignore-scripts" : "") : (options === null || options === void 0 ? void 0 : options.prodOnly) ? "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "", "yarn plugin import workspace-tools && yarn workspaces focus --production") // needs yarn plugin import workspace-tools
|
|
10
|
+
: "".concat((options === null || options === void 0 ? void 0 : options.noScripts) ? "YARN_ENABLE_SCRIPTS=false " : "", "yarn install --immutable");
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
exports.getYarnInstallCommand = getYarnInstallCommand;
|
|
14
|
+
|
|
15
|
+
var getYarnInstall = function (context) {
|
|
16
|
+
return ["if [ -f ./.nvmrc ]; then source /root/.nvm/nvm.sh && nvm install <<< .nvmrc; fi", (0, exports.getYarnInstallCommand)(context)];
|
|
10
17
|
};
|
|
11
18
|
|
|
12
19
|
exports.getYarnInstall = getYarnInstall;
|
|
@@ -141,17 +141,6 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
143
|
|
|
144
|
-
var __rest = this && this.__rest || function (s, e) {
|
|
145
|
-
var t = {};
|
|
146
|
-
|
|
147
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
148
|
-
|
|
149
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
150
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]];
|
|
151
|
-
}
|
|
152
|
-
return t;
|
|
153
|
-
};
|
|
154
|
-
|
|
155
144
|
exports.__esModule = true;
|
|
156
145
|
|
|
157
146
|
var __1 = require("../../");
|
|
@@ -181,17 +170,16 @@ describe("storybook build", function () {
|
|
|
181
170
|
};
|
|
182
171
|
it("creates a pipeline for storybook that does not contain test stages", function () {
|
|
183
172
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
184
|
-
var
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
switch (_b.label) {
|
|
173
|
+
var jobs;
|
|
174
|
+
return __generator(this, function (_a) {
|
|
175
|
+
switch (_a.label) {
|
|
188
176
|
case 0:
|
|
189
177
|
return [4
|
|
190
178
|
/*yield*/
|
|
191
|
-
, (0, __1.createChildPipeline)("mainBranch", config)];
|
|
179
|
+
, (0, __1.createChildPipeline)("gitlab", "mainBranch", config)];
|
|
192
180
|
|
|
193
181
|
case 1:
|
|
194
|
-
|
|
182
|
+
jobs = _a.sent().jobs;
|
|
195
183
|
expect(Object.keys(jobs)).toEqual(["dev my-app app-build", "dev my-app docker-build", "dev my-app deploy-to-kubernetes", "dev my-app kubernetes-stop"]);
|
|
196
184
|
return [2
|
|
197
185
|
/*return*/
|
|
@@ -202,17 +190,16 @@ describe("storybook build", function () {
|
|
|
202
190
|
});
|
|
203
191
|
it("runs build and renames folder", function () {
|
|
204
192
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
205
|
-
var
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
switch (_b.label) {
|
|
193
|
+
var jobs, buildJob;
|
|
194
|
+
return __generator(this, function (_a) {
|
|
195
|
+
switch (_a.label) {
|
|
209
196
|
case 0:
|
|
210
197
|
return [4
|
|
211
198
|
/*yield*/
|
|
212
|
-
, (0, __1.createChildPipeline)("mainBranch", config)];
|
|
199
|
+
, (0, __1.createChildPipeline)("gitlab", "mainBranch", config)];
|
|
213
200
|
|
|
214
201
|
case 1:
|
|
215
|
-
|
|
202
|
+
jobs = _a.sent().jobs;
|
|
216
203
|
buildJob = jobs["dev my-app app-build"];
|
|
217
204
|
expect(buildJob.script).toContain("yarn storybook");
|
|
218
205
|
expect(buildJob.script).toContain("mv ./storybook-out /dist");
|
package/dist/build/types.d.ts
CHANGED
|
@@ -42,6 +42,12 @@ export declare type BuildConfigBase = {
|
|
|
42
42
|
audit?: false | {
|
|
43
43
|
command?: string | string[];
|
|
44
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* additional paths for artifacts,
|
|
47
|
+
* by default "dist" and ".next" are allways included
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
artifactsPaths?: [];
|
|
45
51
|
};
|
|
46
52
|
export declare type BuildConfigNodeBase = BuildConfigBase;
|
|
47
53
|
export declare type BuildConfigNode = {
|