@catladder/pipeline 1.12.0 → 1.13.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 +3 -2
- package/dist/build/base/createBuildJob.js +11 -17
- package/dist/build/docker.d.ts +3 -2
- package/dist/build/docker.js +24 -27
- package/dist/build/index.d.ts +2 -2
- package/dist/build/node/buildJob.d.ts +2 -2
- package/dist/build/node/index.d.ts +4 -4
- package/dist/build/node/meteor.d.ts +2 -2
- package/dist/build/node/testJob.d.ts +2 -2
- package/dist/build/node/testJob.js +20 -29
- package/dist/build/tests/storybook.test.js +10 -23
- package/dist/catladder-gitlab.js +33 -2
- package/dist/constants.js +1 -1
- 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 +24 -18
- package/dist/pipeline/gitlab/makeGitlabJob.d.ts +8 -0
- package/dist/pipeline/gitlab/makeGitlabJob.js +45 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- 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 +28 -32
- package/src/build/docker.ts +49 -51
- package/src/build/index.ts +3 -2
- package/src/build/node/buildJob.ts +3 -3
- package/src/build/node/index.ts +4 -4
- package/src/build/node/meteor.ts +5 -7
- package/src/build/node/testJob.ts +31 -40
- package/src/build/tests/storybook.test.ts +4 -2
- package/src/catladder-gitlab.ts +9 -5
- 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 +47 -38
- package/src/pipeline/gitlab/makeGitlabJob.ts +16 -0
- 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
|
@@ -1,6 +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,
|
|
4
5
|
variables,
|
|
5
6
|
...def
|
|
6
|
-
}: 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");
|
|
@@ -82,23 +80,19 @@ var createBuildJob = function (context, _a) {
|
|
|
82
80
|
variables = _a.variables,
|
|
83
81
|
def = __rest(_a, ["script", "variables"]);
|
|
84
82
|
|
|
85
|
-
return {
|
|
83
|
+
return (0, lodash_1.merge)({
|
|
86
84
|
name: constants_1.APP_BUILD_JOB_NAME,
|
|
87
85
|
envMode: "jobPerEnv",
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
paths: [context.componentConfig.dir + "/__build_info.json"]
|
|
99
|
-
}
|
|
100
|
-
}, def)
|
|
101
|
-
};
|
|
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);
|
|
102
96
|
};
|
|
103
97
|
|
|
104
98
|
exports.createBuildJob = createBuildJob;
|
package/dist/build/docker.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "../types";
|
|
2
|
+
import { CatladderJob } from "../types/jobs";
|
|
2
3
|
export declare const DOCKER_BUILD_JOB_NAME = "\uD83D\uDD28 docker";
|
|
3
4
|
export declare const createDockerBuildJob: (context: Context, {
|
|
4
5
|
script,
|
|
5
6
|
variables,
|
|
6
7
|
...def
|
|
7
|
-
}: Partial<
|
|
8
|
+
}: Partial<CatladderJob>) => CatladderJob;
|
package/dist/build/docker.js
CHANGED
|
@@ -63,10 +63,10 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
63
63
|
exports.__esModule = true;
|
|
64
64
|
exports.createDockerBuildJob = exports.DOCKER_BUILD_JOB_NAME = void 0;
|
|
65
65
|
|
|
66
|
-
var runner_1 = require("../runner");
|
|
67
|
-
|
|
68
66
|
var lodash_1 = require("lodash");
|
|
69
67
|
|
|
68
|
+
var runner_1 = require("../runner");
|
|
69
|
+
|
|
70
70
|
var DOCKER_RUNNER_BUILD_VARIABLES = {
|
|
71
71
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
72
72
|
KUBERNETES_CPU_LIMIT: "1",
|
|
@@ -82,33 +82,30 @@ var createDockerBuildJob = function (context, _a) {
|
|
|
82
82
|
variables = _a.variables,
|
|
83
83
|
def = __rest(_a, ["script", "variables"]);
|
|
84
84
|
|
|
85
|
-
return {
|
|
85
|
+
return (0, lodash_1.merge)({
|
|
86
86
|
name: exports.DOCKER_BUILD_JOB_NAME,
|
|
87
87
|
envMode: "jobPerEnv",
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
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)
|
|
110
|
-
}, def)
|
|
111
|
-
};
|
|
88
|
+
stage: "build",
|
|
89
|
+
image: (0, runner_1.getRunnerImage)("docker-build"),
|
|
90
|
+
services: [{
|
|
91
|
+
name: "docker:20-dind",
|
|
92
|
+
command: ["--tls=false"]
|
|
93
|
+
}],
|
|
94
|
+
variables: __assign(__assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
|
|
95
|
+
DOCKER_BUILDKIT: "1",
|
|
96
|
+
DOCKERFILE_ADDITIONS: (_c = (_b = context.componentConfig.build.docker) === null || _b === void 0 ? void 0 : _b.additionsBegin) === null || _c === void 0 ? void 0 : _c.join("\n"),
|
|
97
|
+
DOCKERFILE_ADDITIONS_END: (_e = (_d = context.componentConfig.build.docker) === null || _d === void 0 ? void 0 : _d.additionsEnd) === null || _e === void 0 ? void 0 : _e.join("\n"),
|
|
98
|
+
APP_DIR: context.componentConfig.dir,
|
|
99
|
+
DOCKER_HOST: "tcp://0.0.0.0:2375",
|
|
100
|
+
DOCKER_TLS_CERTDIR: "",
|
|
101
|
+
DOCKER_DIR: ".",
|
|
102
|
+
IMAGE_TAG: "$CI_COMMIT_SHA",
|
|
103
|
+
DOCKER_DRIVER: "overlay2",
|
|
104
|
+
IMAGE_NAME: "$CI_REGISTRY_IMAGE/" + context.environment.shortName + "/" + context.componentName,
|
|
105
|
+
CACHE_IMAGE: "$CI_REGISTRY_IMAGE/caches/" + context.componentName
|
|
106
|
+
}), variables !== null && variables !== void 0 ? variables : {}),
|
|
107
|
+
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)
|
|
108
|
+
}, def);
|
|
112
109
|
};
|
|
113
110
|
|
|
114
111
|
exports.createDockerBuildJob = createDockerBuildJob;
|
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[];
|
|
@@ -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,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
|
|
|
@@ -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/catladder-gitlab.js
CHANGED
|
@@ -1,9 +1,36 @@
|
|
|
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
|
+
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
|
+
|
|
3
28
|
exports.__esModule = true;
|
|
4
29
|
|
|
5
30
|
var fs_1 = require("fs");
|
|
6
31
|
|
|
32
|
+
var js_yaml_1 = require("js-yaml");
|
|
33
|
+
|
|
7
34
|
var config_1 = require("./config");
|
|
8
35
|
|
|
9
36
|
var constants_1 = require("./constants");
|
|
@@ -30,8 +57,12 @@ if (trigger) {
|
|
|
30
57
|
throw new Error("no catladder config found");
|
|
31
58
|
}
|
|
32
59
|
|
|
33
|
-
(0, pipeline_1.createChildPipeline)(trigger, config).then(function (
|
|
34
|
-
|
|
60
|
+
(0, pipeline_1.createChildPipeline)("gitlab", trigger, config).then(function (_a) {
|
|
61
|
+
var jobs = _a.jobs,
|
|
62
|
+
mainPipeline = __rest(_a, ["jobs"]); // need to spread out the jobs
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
(0, fs_1.writeFileSync)("__pipeline.yml", (0, js_yaml_1.dump)(__assign(__assign({}, jobs), mainPipeline)), {
|
|
35
66
|
encoding: "utf-8"
|
|
36
67
|
});
|
|
37
68
|
});
|
package/dist/constants.js
CHANGED
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
4
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
5
|
-
exports.PIPELINE_IMAGE_TAG = "v1-
|
|
5
|
+
exports.PIPELINE_IMAGE_TAG = "v1-13-0-186923b2" || "";
|
|
6
6
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "";
|
package/dist/deploy/base.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Context } from "../types";
|
|
2
|
+
import { CatladderJob } from "../types/jobs";
|
|
2
3
|
export declare const DEPLOY_JOB_NAME = "\uD83D\uDE80 Deploy";
|
|
3
4
|
export declare const STOP_JOB_NAME = "\uD83D\uDED1 Stop \u26A0\uFE0F";
|
|
4
|
-
declare type JobWithoutScript = Omit<
|
|
5
|
-
job: Omit<GitlabJobDef, "script">;
|
|
6
|
-
};
|
|
5
|
+
declare type JobWithoutScript = Omit<CatladderJob, "script">;
|
|
7
6
|
export declare const getBaseDeploymentJob: (context: Context) => JobWithoutScript;
|
|
8
7
|
export declare const getBaseDeploymentStopJob: (context: Context) => JobWithoutScript;
|
|
9
8
|
export {};
|
package/dist/deploy/base.js
CHANGED
|
@@ -49,20 +49,17 @@ var getBaseDeploymentJob = function (context) {
|
|
|
49
49
|
stage: "test",
|
|
50
50
|
artifacts: false
|
|
51
51
|
}],
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
auto_stop_in: autoStop
|
|
64
|
-
})
|
|
65
|
-
}
|
|
52
|
+
rules: [autoDeploy ? {
|
|
53
|
+
when: "on_success"
|
|
54
|
+
} : {
|
|
55
|
+
when: "manual"
|
|
56
|
+
}],
|
|
57
|
+
stage: "deploy",
|
|
58
|
+
variables: __assign({}, DEPLOY_RUNNER_VARIABLES),
|
|
59
|
+
environment: __assign(__assign({}, environment), {
|
|
60
|
+
on_stop: exports.STOP_JOB_NAME,
|
|
61
|
+
auto_stop_in: autoStop
|
|
62
|
+
})
|
|
66
63
|
};
|
|
67
64
|
};
|
|
68
65
|
|
|
@@ -76,25 +73,22 @@ var getBaseDeploymentStopJob = function (context) {
|
|
|
76
73
|
return {
|
|
77
74
|
name: exports.STOP_JOB_NAME,
|
|
78
75
|
envMode: "stagePerEnv",
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
action: "stop"
|
|
96
|
-
})
|
|
97
|
-
}
|
|
76
|
+
needs: [exports.DEPLOY_JOB_NAME],
|
|
77
|
+
rules: [{
|
|
78
|
+
"if": "$CI_COMMIT_BRANCH =~ /^[0-9]+\\.([0-9]+|x)\\.x$/",
|
|
79
|
+
when: "on_success",
|
|
80
|
+
allow_failure: true
|
|
81
|
+
}, {
|
|
82
|
+
when: "manual",
|
|
83
|
+
allow_failure: true
|
|
84
|
+
}],
|
|
85
|
+
variables: __assign(__assign({}, DEPLOY_RUNNER_VARIABLES), {
|
|
86
|
+
GIT_STRATEGY: "none"
|
|
87
|
+
}),
|
|
88
|
+
stage: "stop",
|
|
89
|
+
environment: __assign(__assign({}, environment), {
|
|
90
|
+
action: "stop"
|
|
91
|
+
})
|
|
98
92
|
};
|
|
99
93
|
};
|
|
100
94
|
|
package/dist/deploy/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { GitlabJobs } from "../types/gitlab-types";
|
|
2
1
|
import { Context } from "../types/context";
|
|
2
|
+
import { CatladderJob } from "../types/jobs";
|
|
3
3
|
import { DeployConfig } from "./types";
|
|
4
4
|
export * from "./kubernetes";
|
|
5
5
|
export * from "./types";
|
|
6
6
|
export * from "./utils";
|
|
7
7
|
export declare type DeployTypes = { [type in DeployConfig["type"]]: {
|
|
8
|
-
jobs: (context: Context) =>
|
|
8
|
+
jobs: (context: Context) => CatladderJob[];
|
|
9
9
|
defaults: () => Partial<Extract<DeployConfig, {
|
|
10
10
|
type: type;
|
|
11
11
|
}>>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { GitlabJobs } from "../../types/gitlab-types";
|
|
2
1
|
import { Context } from "../../types/context";
|
|
3
|
-
|
|
2
|
+
import { CatladderJob } from "../../types/jobs";
|
|
3
|
+
export declare const createKubernetesDeployJobs: (context: Context) => CatladderJob[];
|
|
@@ -52,23 +52,23 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
52
52
|
exports.__esModule = true;
|
|
53
53
|
exports.createKubernetesDeployJobs = void 0;
|
|
54
54
|
|
|
55
|
-
var
|
|
55
|
+
var js_yaml_1 = require("js-yaml");
|
|
56
56
|
|
|
57
|
-
var
|
|
57
|
+
var lodash_1 = require("lodash");
|
|
58
58
|
|
|
59
|
-
var
|
|
59
|
+
var __1 = require("../..");
|
|
60
60
|
|
|
61
|
-
var
|
|
61
|
+
var runner_1 = require("../../runner");
|
|
62
62
|
|
|
63
|
-
var
|
|
63
|
+
var utils_1 = require("../../utils");
|
|
64
64
|
|
|
65
|
-
var
|
|
65
|
+
var base_1 = require("../base");
|
|
66
66
|
|
|
67
|
-
var
|
|
67
|
+
var types_1 = require("../types");
|
|
68
68
|
|
|
69
|
-
var
|
|
69
|
+
var cloudsql_1 = require("./cloudsql");
|
|
70
70
|
|
|
71
|
-
var
|
|
71
|
+
var mongodb_1 = require("./mongodb");
|
|
72
72
|
|
|
73
73
|
var createKubernetesDeployJobs = function (context) {
|
|
74
74
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
@@ -140,43 +140,37 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
140
140
|
namespace: context.environment.envVars.KUBE_NAMESPACE
|
|
141
141
|
};
|
|
142
142
|
var shared = {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
})
|
|
161
|
-
}
|
|
143
|
+
image: (0, runner_1.getRunnerImage)("kubernetes"),
|
|
144
|
+
variables: __assign(__assign({}, context.environment.envVars), {
|
|
145
|
+
HELM_EXPERIMENTAL_OCI: "1",
|
|
146
|
+
IMAGE_PULL_SECRET: "gitlab-registry-".concat(context.componentName),
|
|
147
|
+
KUBE_VALUES: (0, js_yaml_1.dump)(kubeValues, {
|
|
148
|
+
lineWidth: -1,
|
|
149
|
+
quotingType: "'",
|
|
150
|
+
forceQuotes: true
|
|
151
|
+
}),
|
|
152
|
+
HELM_GITLAB_CHART_NAME: "the-panter-chart",
|
|
153
|
+
HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_p = deployConfig.additionalHelmArgs) !== null && _p !== void 0 ? _p : []), false).join(" "),
|
|
154
|
+
COMPONENT_NAME: context.componentName,
|
|
155
|
+
BUILD_ID: (_q = context.commitInfo) === null || _q === void 0 ? void 0 : _q.buildId,
|
|
156
|
+
// TODO: unify with docker build stage
|
|
157
|
+
IMAGE_NAME: context.environment.shortName + "/" + context.componentName,
|
|
158
|
+
IMAGE_TAG: "$CI_COMMIT_SHA"
|
|
159
|
+
})
|
|
162
160
|
};
|
|
163
161
|
var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
|
|
164
162
|
var baseStopJob = (0, base_1.getBaseDeploymentStopJob)(context);
|
|
165
163
|
var clusterName = "kube-".concat(context.environment.fullName);
|
|
166
164
|
var connectContext = ["kubectl config set-cluster \"".concat(clusterName, "\" --server=\"$").concat((0, __1.getSecretVarNameForContext)(context, "KUBE_URL"), "\" --certificate-authority <(echo $").concat((0, __1.getSecretVarNameForContext)(context, "KUBE_CA_PEM"), " | base64 -d) --embed-certs=true"), "kubectl config set-credentials \"".concat(clusterName, "\" --token=\"$").concat((0, __1.getSecretVarNameForContext)(context, "KUBE_TOKEN"), "\""), "kubectl config set-context \"".concat(clusterName, "\" --cluster=\"").concat(clusterName, "\" --user=\"").concat(clusterName, "\" --namespace=\"").concat(context.environment.envVars.KUBE_NAMESPACE, "\""), "kubectl config use-context \"".concat(clusterName, "\"")];
|
|
167
165
|
return [(0, lodash_1.merge)({}, baseDeploymentJob, shared, {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
kubernetes: kubernetesEnvironment
|
|
172
|
-
}
|
|
166
|
+
script: __spreadArray(__spreadArray([], __read(connectContext), false), ["kubernetesCreateSecret", "kubernetesDeploy", "echo deployment successful 😻"], false),
|
|
167
|
+
environment: {
|
|
168
|
+
kubernetes: kubernetesEnvironment
|
|
173
169
|
}
|
|
174
170
|
}), (0, lodash_1.merge)({}, baseStopJob, shared, {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
kubernetes: kubernetesEnvironment
|
|
179
|
-
}
|
|
171
|
+
script: __spreadArray(__spreadArray([], __read(connectContext), false), ["kubernetesDelete"], false),
|
|
172
|
+
environment: {
|
|
173
|
+
kubernetes: kubernetesEnvironment
|
|
180
174
|
}
|
|
181
175
|
})];
|
|
182
176
|
};
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
+
import { Pipeline } from "../types";
|
|
1
2
|
import { Config, PipelineTrigger } from "../types/config";
|
|
2
|
-
|
|
3
|
-
export declare const createChildPipeline: (trigger: PipelineTrigger, config: Config) => Promise<{
|
|
4
|
-
image: string;
|
|
5
|
-
variables: {
|
|
6
|
-
FF_USE_FASTZIP: string;
|
|
7
|
-
};
|
|
8
|
-
workflow: {
|
|
9
|
-
rules: import("../types/gitlab-types").GitlabRule[];
|
|
10
|
-
};
|
|
11
|
-
stages: string[];
|
|
12
|
-
} & Record<string, GitlabJobDef>>;
|
|
3
|
+
export declare const createChildPipeline: <T extends "gitlab">(type: T, trigger: PipelineTrigger, config: Config) => Promise<Pipeline<T>>;
|