@catladder/pipeline 1.0.3 → 1.0.4
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/package.json +1 -1
- package/src/build/docker.ts +7 -3
- package/src/deploy/kubernetes/deployJob.ts +1 -0
- package/dist/build/base/constants.d.ts +0 -7
- package/dist/build/base/constants.js +0 -11
- package/dist/build/base/createBuildJob.d.ts +0 -5
- package/dist/build/base/createBuildJob.js +0 -99
- package/dist/build/docker.d.ts +0 -5
- package/dist/build/docker.js +0 -95
- package/dist/build/index.d.ts +0 -12
- package/dist/build/index.js +0 -63
- package/dist/build/node/buildJob.d.ts +0 -3
- package/dist/build/node/buildJob.js +0 -97
- package/dist/build/node/cache.d.ts +0 -4
- package/dist/build/node/cache.js +0 -67
- package/dist/build/node/constants.d.ts +0 -6
- package/dist/build/node/constants.js +0 -10
- package/dist/build/node/index.d.ts +0 -5
- package/dist/build/node/index.js +0 -63
- package/dist/build/node/meteor.d.ts +0 -3
- package/dist/build/node/meteor.js +0 -103
- package/dist/build/node/testJob.d.ts +0 -3
- package/dist/build/node/testJob.js +0 -112
- package/dist/build/node/yarn.d.ts +0 -2
- package/dist/build/node/yarn.js +0 -12
- package/dist/build/tests/storybook.test.d.ts +0 -1
- package/dist/build/tests/storybook.test.js +0 -221
- package/dist/build/types.d.ts +0 -63
- package/dist/build/types.js +0 -16
- package/dist/catladder-gitlab.d.ts +0 -1
- package/dist/catladder-gitlab.js +0 -44
- package/dist/config/configruedEnvs.d.ts +0 -4
- package/dist/config/configruedEnvs.js +0 -86
- package/dist/config/configruedEnvs.test.d.ts +0 -1
- package/dist/config/configruedEnvs.test.js +0 -103
- package/dist/config/index.d.ts +0 -2
- package/dist/config/index.js +0 -24
- package/dist/config/readConfig.d.ts +0 -2
- package/dist/config/readConfig.js +0 -47
- package/dist/constants.d.ts +0 -2
- package/dist/constants.js +0 -6
- package/dist/context/index.d.ts +0 -5
- package/dist/context/index.js +0 -211
- package/dist/defaults/index.d.ts +0 -2
- package/dist/defaults/index.js +0 -8
- package/dist/deploy/base.d.ts +0 -9
- package/dist/deploy/base.js +0 -94
- package/dist/deploy/index.d.ts +0 -11
- package/dist/deploy/index.js +0 -34
- package/dist/deploy/kubernetes/cloudsql.d.ts +0 -6
- package/dist/deploy/kubernetes/cloudsql.js +0 -16
- package/dist/deploy/kubernetes/deployJob.d.ts +0 -3
- package/dist/deploy/kubernetes/deployJob.js +0 -148
- package/dist/deploy/kubernetes/index.d.ts +0 -1
- package/dist/deploy/kubernetes/index.js +0 -22
- package/dist/deploy/kubernetes/mongodb.d.ts +0 -15
- package/dist/deploy/kubernetes/mongodb.js +0 -23
- package/dist/deploy/types.d.ts +0 -92
- package/dist/deploy/types.js +0 -16
- package/dist/index.d.ts +0 -8
- package/dist/index.js +0 -36
- package/dist/pipeline/createChildPipeline.d.ts +0 -9
- package/dist/pipeline/createChildPipeline.js +0 -266
- package/dist/pipeline/createChildPipeline.test.d.ts +0 -1
- package/dist/pipeline/createChildPipeline.test.js +0 -199
- package/dist/pipeline/createJobs.d.ts +0 -3
- package/dist/pipeline/createJobs.js +0 -331
- package/dist/pipeline/index.d.ts +0 -2
- package/dist/pipeline/index.js +0 -24
- package/dist/pipeline/yarnInfo.d.ts +0 -2
- package/dist/pipeline/yarnInfo.js +0 -296
- package/dist/rules/index.d.ts +0 -3
- package/dist/rules/index.js +0 -27
- package/dist/runner/index.d.ts +0 -3
- package/dist/runner/index.js +0 -12
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/config.d.ts +0 -73
- package/dist/types/config.js +0 -80
- package/dist/types/context.d.ts +0 -36
- package/dist/types/context.js +0 -3
- package/dist/types/gitlab-types.d.ts +0 -86
- package/dist/types/gitlab-types.js +0 -5
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.js +0 -26
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -18
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
|
|
5
|
-
var _1 = require(".");
|
|
6
|
-
|
|
7
|
-
describe("getAllEnvsByTrigger", function () {
|
|
8
|
-
var SIMPLE_CONFIG = {
|
|
9
|
-
appName: "my-app",
|
|
10
|
-
customerName: "pan",
|
|
11
|
-
components: {
|
|
12
|
-
app1: {
|
|
13
|
-
dir: "dir1",
|
|
14
|
-
build: {
|
|
15
|
-
type: "node"
|
|
16
|
-
},
|
|
17
|
-
deploy: {
|
|
18
|
-
type: "kubernetes"
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
app2: {
|
|
22
|
-
dir: "dir2",
|
|
23
|
-
build: {
|
|
24
|
-
type: "node"
|
|
25
|
-
},
|
|
26
|
-
deploy: {
|
|
27
|
-
type: "kubernetes"
|
|
28
|
-
},
|
|
29
|
-
env: {
|
|
30
|
-
dev2: {
|
|
31
|
-
type: "dev"
|
|
32
|
-
},
|
|
33
|
-
review2: {
|
|
34
|
-
type: "review"
|
|
35
|
-
},
|
|
36
|
-
stage2: {
|
|
37
|
-
type: "stage"
|
|
38
|
-
},
|
|
39
|
-
prod2: {
|
|
40
|
-
type: "prod"
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
app3: {
|
|
45
|
-
dir: "dir2",
|
|
46
|
-
build: {
|
|
47
|
-
type: "node"
|
|
48
|
-
},
|
|
49
|
-
deploy: {
|
|
50
|
-
type: "kubernetes"
|
|
51
|
-
},
|
|
52
|
-
env: {
|
|
53
|
-
dev: false,
|
|
54
|
-
review: false,
|
|
55
|
-
stage: false,
|
|
56
|
-
prod: false
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
describe("mainBranch", function () {
|
|
62
|
-
it("always includes dev if not disabled", function () {
|
|
63
|
-
var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app1", "mainBranch");
|
|
64
|
-
expect(envs).toEqual(["dev"]);
|
|
65
|
-
});
|
|
66
|
-
it("returns additional dev environments", function () {
|
|
67
|
-
var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app2", "mainBranch");
|
|
68
|
-
expect(envs).toEqual(["dev", "dev2"]);
|
|
69
|
-
});
|
|
70
|
-
it("does not include disabled envs", function () {
|
|
71
|
-
var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app3", "mainBranch");
|
|
72
|
-
expect(envs).toEqual([]);
|
|
73
|
-
});
|
|
74
|
-
});
|
|
75
|
-
describe("mr", function () {
|
|
76
|
-
it("always includes review if not disabled", function () {
|
|
77
|
-
var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app1", "mr");
|
|
78
|
-
expect(envs).toEqual(["review"]);
|
|
79
|
-
});
|
|
80
|
-
it("returns additional dev environments", function () {
|
|
81
|
-
var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app2", "mr");
|
|
82
|
-
expect(envs).toEqual(["review", "review2"]);
|
|
83
|
-
});
|
|
84
|
-
it("does not include disabled envs", function () {
|
|
85
|
-
var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app3", "mr");
|
|
86
|
-
expect(envs).toEqual([]);
|
|
87
|
-
});
|
|
88
|
-
});
|
|
89
|
-
describe("taggedRelease", function () {
|
|
90
|
-
it("always includes review if not disabled", function () {
|
|
91
|
-
var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app1", "taggedRelease");
|
|
92
|
-
expect(envs).toEqual(["stage", "prod"]);
|
|
93
|
-
});
|
|
94
|
-
it("returns additional dev environments", function () {
|
|
95
|
-
var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app2", "taggedRelease");
|
|
96
|
-
expect(envs).toEqual(["stage", "prod", "stage2", "prod2"]);
|
|
97
|
-
});
|
|
98
|
-
it("does not include disabled envs", function () {
|
|
99
|
-
var envs = (0, _1.getAllEnvsByTrigger)(SIMPLE_CONFIG, "app3", "taggedRelease");
|
|
100
|
-
expect(envs).toEqual([]);
|
|
101
|
-
});
|
|
102
|
-
});
|
|
103
|
-
});
|
package/dist/config/index.d.ts
DELETED
package/dist/config/index.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
Object.defineProperty(o, k2, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function () {
|
|
8
|
-
return m[k];
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
} : function (o, m, k, k2) {
|
|
12
|
-
if (k2 === undefined) k2 = k;
|
|
13
|
-
o[k2] = m[k];
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
17
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
exports.__esModule = true;
|
|
21
|
-
|
|
22
|
-
__exportStar(require("./configruedEnvs"), exports);
|
|
23
|
-
|
|
24
|
-
__exportStar(require("./readConfig"), exports);
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.readConfigSync = void 0;
|
|
5
|
-
|
|
6
|
-
var fs_1 = require("fs");
|
|
7
|
-
|
|
8
|
-
var ts_node_1 = require("ts-node");
|
|
9
|
-
|
|
10
|
-
var js_yaml_1 = require("js-yaml"); // allows us to load ts files
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var fullPath = function (directory, ext) {
|
|
14
|
-
return directory + "/catladder." + ext;
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
var readConfigSync = function (directory) {
|
|
18
|
-
if (directory === void 0) {
|
|
19
|
-
directory = process.cwd();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
(0, ts_node_1.register)({
|
|
23
|
-
cwd: directory,
|
|
24
|
-
transpileOnly: true,
|
|
25
|
-
compilerOptions: {
|
|
26
|
-
module: "commonjs"
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
var found = ["ts", "js", "yml", "yaml"].find(function (extension) {
|
|
30
|
-
return (0, fs_1.existsSync)(fullPath(directory, extension));
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
if (found) {
|
|
34
|
-
if (found === "ts" || found === "js") {
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
36
|
-
return require(fullPath(directory, found))["default"];
|
|
37
|
-
} else {
|
|
38
|
-
return (0, js_yaml_1.load)((0, fs_1.readFileSync)(fullPath(directory, found), {
|
|
39
|
-
encoding: "utf-8"
|
|
40
|
-
}));
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return null;
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
exports.readConfigSync = readConfigSync;
|
package/dist/constants.d.ts
DELETED
package/dist/constants.js
DELETED
package/dist/context/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { Config } from "../types/config";
|
|
2
|
-
import { CommitInfo, Context, Environment, YarnInfo } from "../types/context";
|
|
3
|
-
export declare const getSecretVarName: (env: string, componentName: string, key: string) => string;
|
|
4
|
-
export declare const getEnvironment: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, skipReferences?: boolean) => Environment;
|
|
5
|
-
export declare const createContext: (config: Config, componentName: string, env: string, commitInfo?: CommitInfo | undefined, yarnInfo?: YarnInfo | undefined) => Context;
|
package/dist/context/index.js
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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 __read = this && this.__read || function (o, n) {
|
|
18
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
19
|
-
if (!m) return o;
|
|
20
|
-
var i = m.call(o),
|
|
21
|
-
r,
|
|
22
|
-
ar = [],
|
|
23
|
-
e;
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
27
|
-
} catch (error) {
|
|
28
|
-
e = {
|
|
29
|
-
error: error
|
|
30
|
-
};
|
|
31
|
-
} finally {
|
|
32
|
-
try {
|
|
33
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
34
|
-
} finally {
|
|
35
|
-
if (e) throw e.error;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return ar;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
var __importDefault = this && this.__importDefault || function (mod) {
|
|
43
|
-
return mod && mod.__esModule ? mod : {
|
|
44
|
-
"default": mod
|
|
45
|
-
};
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
exports.__esModule = true;
|
|
49
|
-
exports.createContext = exports.getEnvironment = exports.getSecretVarName = void 0;
|
|
50
|
-
|
|
51
|
-
var lodash_1 = require("lodash");
|
|
52
|
-
|
|
53
|
-
var slugify_1 = __importDefault(require("slugify"));
|
|
54
|
-
|
|
55
|
-
var build_1 = require("../build");
|
|
56
|
-
|
|
57
|
-
var deploy_1 = require("../deploy");
|
|
58
|
-
|
|
59
|
-
var config_1 = require("../types/config");
|
|
60
|
-
|
|
61
|
-
var sanitizeForEnVar = function (s) {
|
|
62
|
-
return s.replace(/-/g, "_");
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
var getSecretVarName = function (env, componentName, key) {
|
|
66
|
-
return "CL_".concat(sanitizeForEnVar(env), "_").concat(sanitizeForEnVar(componentName), "_").concat(key);
|
|
67
|
-
}; // remove dash from component name
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
exports.getSecretVarName = getSecretVarName;
|
|
71
|
-
|
|
72
|
-
var getEnvironment = function (config, componentName, env, commitInfo, skipReferences // to prevent infinit loop
|
|
73
|
-
) {
|
|
74
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
75
|
-
|
|
76
|
-
if (skipReferences === void 0) {
|
|
77
|
-
skipReferences = false;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
var componentConfig = config.components[componentName];
|
|
81
|
-
|
|
82
|
-
if (!componentConfig) {
|
|
83
|
-
throw new Error("unknown component " + componentName);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
var defaultConfig = componentConfig;
|
|
87
|
-
var envConfig = (_b = (_a = componentConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
|
|
88
|
-
|
|
89
|
-
if (envConfig === false) {
|
|
90
|
-
throw new Error("env is disabled: " + env);
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
var mergedConfig = (0, lodash_1.merge)({}, defaultConfig, envConfig); // env type: if its set manually, use that, otherwise use the known env types
|
|
94
|
-
|
|
95
|
-
var basePredefinedVariables = {
|
|
96
|
-
ENV_SHORT: env,
|
|
97
|
-
APP_DIR: componentConfig.dir
|
|
98
|
-
};
|
|
99
|
-
var envType = (_c = envConfig === null || envConfig === void 0 ? void 0 : envConfig.type) !== null && _c !== void 0 ? _c : (0, config_1.isKnowEnvType)(env) ? env : null;
|
|
100
|
-
|
|
101
|
-
if (!envType) {
|
|
102
|
-
throw new Error("Missing type in environment " + env + " in component " + componentName);
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
var environmentName = envType === "review" && commitInfo ? "".concat(env, "/").concat(commitInfo.refName, "/").concat(componentName) : "".concat(env, "/").concat(componentName);
|
|
106
|
-
var environmentSlug = envType === "review" && commitInfo ? "".concat(env, "-").concat(commitInfo.refSlug, "-").concat(componentName) : "".concat(env, "-").concat(componentName);
|
|
107
|
-
var predefinedVariables;
|
|
108
|
-
var hostname;
|
|
109
|
-
var url;
|
|
110
|
-
|
|
111
|
-
if (envType === "local") {
|
|
112
|
-
var devLocalConfig = mergedConfig;
|
|
113
|
-
var port = (_d = devLocalConfig.port) !== null && _d !== void 0 ? _d : 3000;
|
|
114
|
-
hostname = "localhost:" + port;
|
|
115
|
-
url = "http://" + hostname;
|
|
116
|
-
predefinedVariables = {
|
|
117
|
-
ROOT_URL: url,
|
|
118
|
-
PORT: port.toString()
|
|
119
|
-
};
|
|
120
|
-
} else {
|
|
121
|
-
var KUBE_NAMESPACE = "".concat(config.customerName, "-").concat(config.appName, "-").concat(env);
|
|
122
|
-
var RELEASE_NAME = "".concat(config.customerName, "-").concat(config.appName, "-").concat(environmentSlug);
|
|
123
|
-
var componentSlug = (0, slugify_1["default"])(componentName);
|
|
124
|
-
var envInUrl = envType === "review" && commitInfo ? "".concat(commitInfo.refSlug, ".").concat(env) : env;
|
|
125
|
-
var HOST_CANONICAL = "".concat(config.appName, "-").concat(componentSlug, ".").concat(envInUrl, ".").concat(config.customerName, ".panter.cloud");
|
|
126
|
-
hostname = (_e = mergedConfig === null || mergedConfig === void 0 ? void 0 : mergedConfig.hostname) !== null && _e !== void 0 ? _e : HOST_CANONICAL;
|
|
127
|
-
var url_1 = "https://".concat(hostname);
|
|
128
|
-
var KUBE_APP_NAME = envType === "review" && commitInfo ? "".concat(componentName, "-").concat(commitInfo.refSlug) : componentName;
|
|
129
|
-
predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
|
|
130
|
-
HOST_CANONICAL: HOST_CANONICAL,
|
|
131
|
-
ROOT_URL: url_1,
|
|
132
|
-
KUBE_NAMESPACE: KUBE_NAMESPACE,
|
|
133
|
-
KUBE_APP_NAME: KUBE_APP_NAME,
|
|
134
|
-
RELEASE_NAME: RELEASE_NAME
|
|
135
|
-
});
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
var publicEnvVars = (_g = (_f = mergedConfig.vars) === null || _f === void 0 ? void 0 : _f.public) !== null && _g !== void 0 ? _g : {};
|
|
139
|
-
var secretEnvVarKeys = (_j = (_h = mergedConfig.vars) === null || _h === void 0 ? void 0 : _h.secret) !== null && _j !== void 0 ? _j : [];
|
|
140
|
-
var secretEnvVars = Object.fromEntries(secretEnvVarKeys.map(function (key) {
|
|
141
|
-
return [key, "$".concat((0, exports.getSecretVarName)(env, componentName, key))];
|
|
142
|
-
}));
|
|
143
|
-
var referencedRaw = (_l = (_k = mergedConfig.vars) === null || _k === void 0 ? void 0 : _k.fromComponents) !== null && _l !== void 0 ? _l : {};
|
|
144
|
-
var referenced = skipReferences ? {} : Object.entries(referencedRaw).reduce(function (acc, _a) {
|
|
145
|
-
var _b = __read(_a, 2),
|
|
146
|
-
otherApp = _b[0],
|
|
147
|
-
mapping = _b[1];
|
|
148
|
-
|
|
149
|
-
var envVars = (0, exports.getEnvironment)(config, otherApp, env, commitInfo, true // prevent infinit loop
|
|
150
|
-
).envVars;
|
|
151
|
-
return __assign(__assign({}, acc), Object.fromEntries(Object.entries(mapping).map(function (_a) {
|
|
152
|
-
var _b = __read(_a, 2),
|
|
153
|
-
ourKey = _b[0],
|
|
154
|
-
otherKey = _b[1];
|
|
155
|
-
|
|
156
|
-
return [ourKey, envVars[otherKey]];
|
|
157
|
-
})));
|
|
158
|
-
}, {});
|
|
159
|
-
|
|
160
|
-
var envVars = __assign(__assign(__assign(__assign({}, predefinedVariables), secretEnvVars), referenced), publicEnvVars);
|
|
161
|
-
|
|
162
|
-
return {
|
|
163
|
-
envType: envType,
|
|
164
|
-
hostname: hostname,
|
|
165
|
-
fullName: environmentName,
|
|
166
|
-
slug: environmentSlug,
|
|
167
|
-
shortName: env,
|
|
168
|
-
url: predefinedVariables.ROOT_URL,
|
|
169
|
-
envVars: envVars,
|
|
170
|
-
secretEnvVarKeys: secretEnvVarKeys
|
|
171
|
-
};
|
|
172
|
-
};
|
|
173
|
-
|
|
174
|
-
exports.getEnvironment = getEnvironment;
|
|
175
|
-
|
|
176
|
-
var createContext = function (config, componentName, env, commitInfo, yarnInfo) {
|
|
177
|
-
var _a, _b;
|
|
178
|
-
|
|
179
|
-
if (!/^[a-z0-9-]+$/.test(componentName)) {
|
|
180
|
-
throw new Error("componentName may only contain lower case letters, numbers and -");
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
var rawConfig = config.components[componentName];
|
|
184
|
-
|
|
185
|
-
if (!rawConfig) {
|
|
186
|
-
throw new Error("unknown component " + componentName);
|
|
187
|
-
} // envs can override the config
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
var envConfig = (_b = (_a = rawConfig.env) === null || _a === void 0 ? void 0 : _a[env]) !== null && _b !== void 0 ? _b : {};
|
|
191
|
-
var componentConfigWithoutDefaults = (0, lodash_1.merge)({}, rawConfig, envConfig); // fill in defaults of build and deploy
|
|
192
|
-
|
|
193
|
-
var defaults = componentConfigWithoutDefaults.deploy ? {
|
|
194
|
-
build: build_1.BUILD_TYPES[componentConfigWithoutDefaults.build.type].defaults(),
|
|
195
|
-
deploy: deploy_1.DEPLOY_TYPES[componentConfigWithoutDefaults.deploy.type].defaults()
|
|
196
|
-
} : {
|
|
197
|
-
build: {},
|
|
198
|
-
deploy: {}
|
|
199
|
-
};
|
|
200
|
-
var componentConfig = (0, lodash_1.merge)({}, defaults, componentConfigWithoutDefaults);
|
|
201
|
-
return {
|
|
202
|
-
fullConfig: config,
|
|
203
|
-
componentConfig: componentConfig,
|
|
204
|
-
componentName: componentName,
|
|
205
|
-
environment: (0, exports.getEnvironment)(config, componentName, env, commitInfo),
|
|
206
|
-
commitInfo: commitInfo,
|
|
207
|
-
yarnInfo: yarnInfo
|
|
208
|
-
};
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
exports.createContext = createContext;
|
package/dist/defaults/index.d.ts
DELETED
package/dist/defaults/index.js
DELETED
package/dist/deploy/base.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { GitlabJob, Context, GitlabJobDef } from "../types";
|
|
2
|
-
export declare const DEPLOY_JOB_NAME = "\uD83D\uDE80 Deploy";
|
|
3
|
-
export declare const STOP_JOB_NAME = "\uD83D\uDED1 Stop \u26A0\uFE0F";
|
|
4
|
-
declare type JobWithoutScript = Omit<GitlabJob, "job"> & {
|
|
5
|
-
job: Omit<GitlabJobDef, "script">;
|
|
6
|
-
};
|
|
7
|
-
export declare const getBaseDeploymentJob: (context: Context) => JobWithoutScript;
|
|
8
|
-
export declare const getBaseDeploymentStopJob: (context: Context) => JobWithoutScript;
|
|
9
|
-
export {};
|
package/dist/deploy/base.js
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
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
|
-
exports.__esModule = true;
|
|
18
|
-
exports.getBaseDeploymentStopJob = exports.getBaseDeploymentJob = exports.STOP_JOB_NAME = exports.DEPLOY_JOB_NAME = void 0;
|
|
19
|
-
exports.DEPLOY_JOB_NAME = "🚀 Deploy";
|
|
20
|
-
exports.STOP_JOB_NAME = "🛑 Stop ⚠️";
|
|
21
|
-
var DEPLOY_RUNNER_VARIABLES = {
|
|
22
|
-
KUBERNETES_CPU_REQUEST: "0.5",
|
|
23
|
-
KUBERNETES_CPU_LIMIT: "1",
|
|
24
|
-
KUBERNETES_MEMORY_REQUEST: "200Mi",
|
|
25
|
-
KUBERNETES_MEMORY_LIMIT: "500Mi"
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
var getBaseDeploymentJob = function (context) {
|
|
29
|
-
var environment = {
|
|
30
|
-
name: context.environment.fullName,
|
|
31
|
-
url: context.environment.url
|
|
32
|
-
};
|
|
33
|
-
var autoStop = context.environment.envType === "review" ? "2 weeks" : context.environment.envType === "dev" ? "3 weeks" : undefined;
|
|
34
|
-
return {
|
|
35
|
-
name: exports.DEPLOY_JOB_NAME,
|
|
36
|
-
envMode: "stagePerEnv",
|
|
37
|
-
// we don't want to deploy when there is a broken test
|
|
38
|
-
needsStages: [{
|
|
39
|
-
stage: "build",
|
|
40
|
-
artifacts: false
|
|
41
|
-
}, {
|
|
42
|
-
stage: "test",
|
|
43
|
-
artifacts: false
|
|
44
|
-
}],
|
|
45
|
-
job: {
|
|
46
|
-
rules: [context.environment.envType === "prod" ? {
|
|
47
|
-
when: "manual"
|
|
48
|
-
} : {
|
|
49
|
-
when: "on_success"
|
|
50
|
-
}],
|
|
51
|
-
stage: "deploy",
|
|
52
|
-
dependencies: [],
|
|
53
|
-
variables: __assign({}, DEPLOY_RUNNER_VARIABLES),
|
|
54
|
-
environment: __assign(__assign({}, environment), {
|
|
55
|
-
on_stop: exports.STOP_JOB_NAME,
|
|
56
|
-
auto_stop_in: autoStop
|
|
57
|
-
})
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
exports.getBaseDeploymentJob = getBaseDeploymentJob;
|
|
63
|
-
|
|
64
|
-
var getBaseDeploymentStopJob = function (context) {
|
|
65
|
-
var environment = {
|
|
66
|
-
name: context.environment.fullName,
|
|
67
|
-
url: context.environment.url
|
|
68
|
-
};
|
|
69
|
-
return {
|
|
70
|
-
name: exports.STOP_JOB_NAME,
|
|
71
|
-
envMode: "stagePerEnv",
|
|
72
|
-
job: {
|
|
73
|
-
needs: [exports.DEPLOY_JOB_NAME],
|
|
74
|
-
rules: [{
|
|
75
|
-
"if": "$CI_COMMIT_BRANCH =~ /^[0-9]+\\.([0-9]+|x)\\.x$/",
|
|
76
|
-
when: "on_success",
|
|
77
|
-
allow_failure: true
|
|
78
|
-
}, {
|
|
79
|
-
when: "manual",
|
|
80
|
-
allow_failure: true
|
|
81
|
-
}],
|
|
82
|
-
variables: __assign(__assign({}, DEPLOY_RUNNER_VARIABLES), {
|
|
83
|
-
GIT_STRATEGY: "none"
|
|
84
|
-
}),
|
|
85
|
-
stage: "stop",
|
|
86
|
-
dependencies: [],
|
|
87
|
-
environment: __assign(__assign({}, environment), {
|
|
88
|
-
action: "stop"
|
|
89
|
-
})
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
exports.getBaseDeploymentStopJob = getBaseDeploymentStopJob;
|
package/dist/deploy/index.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { GitlabJobs } from "../types/gitlab-types";
|
|
2
|
-
import { Context } from "../types/context";
|
|
3
|
-
import { DeployConfig } from "./types";
|
|
4
|
-
export declare type DeployTypes = { [type in DeployConfig["type"]]: {
|
|
5
|
-
jobs: (context: Context) => GitlabJobs;
|
|
6
|
-
defaults: () => Partial<Extract<DeployConfig, {
|
|
7
|
-
type: type;
|
|
8
|
-
}>>;
|
|
9
|
-
} };
|
|
10
|
-
export * from "./types";
|
|
11
|
-
export declare const DEPLOY_TYPES: DeployTypes;
|
package/dist/deploy/index.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
|
|
4
|
-
if (k2 === undefined) k2 = k;
|
|
5
|
-
Object.defineProperty(o, k2, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function () {
|
|
8
|
-
return m[k];
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
} : function (o, m, k, k2) {
|
|
12
|
-
if (k2 === undefined) k2 = k;
|
|
13
|
-
o[k2] = m[k];
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
var __exportStar = this && this.__exportStar || function (m, exports) {
|
|
17
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
exports.__esModule = true;
|
|
21
|
-
exports.DEPLOY_TYPES = void 0;
|
|
22
|
-
|
|
23
|
-
var kubernetes_1 = require("./kubernetes");
|
|
24
|
-
|
|
25
|
-
__exportStar(require("./types"), exports);
|
|
26
|
-
|
|
27
|
-
exports.DEPLOY_TYPES = {
|
|
28
|
-
kubernetes: {
|
|
29
|
-
jobs: kubernetes_1.createKubernetesDeployJobs,
|
|
30
|
-
defaults: function () {
|
|
31
|
-
return {};
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
exports.__esModule = true;
|
|
4
|
-
exports.createCloudsqlBaseConfig = void 0;
|
|
5
|
-
|
|
6
|
-
var __1 = require("../..");
|
|
7
|
-
|
|
8
|
-
var createCloudsqlBaseConfig = function (context) {
|
|
9
|
-
return {
|
|
10
|
-
cloudsql: {
|
|
11
|
-
proxyCredentials: "$".concat((0, __1.getSecretVarName)(context.environment.shortName, context.componentName, "cloudsqlProxyCredentials"))
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
exports.createCloudsqlBaseConfig = createCloudsqlBaseConfig;
|