@catladder/pipeline 0.0.0-node16-ddfae617 → 0.0.0-rolling-update-3bca086c
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/docker.d.ts +14 -3
- package/dist/build/docker.js +18 -8
- package/dist/build/node/testJob.js +3 -0
- package/dist/constants.js +1 -1
- package/dist/context/index.js +8 -3
- package/dist/deploy/base.d.ts +2 -0
- package/dist/deploy/base.js +37 -4
- package/dist/deploy/kubernetes/deployJob.js +8 -5
- package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +4 -10
- package/dist/deploy/types.d.ts +62 -11
- package/dist/pipeline/createChildPipeline.js +3 -3
- package/dist/pipeline/createJobs.js +18 -8
- package/dist/pipeline/gitlab/makeGitlabJob.d.ts +1 -0
- package/dist/pipeline/gitlab/makeGitlabJob.js +2 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/gitlab-types.d.ts +1 -1
- package/dist/types/jobs.d.ts +7 -2
- package/dist/types/jobs.js +1 -1
- package/package.json +2 -2
- package/src/build/docker.ts +19 -12
- package/src/build/node/testJob.ts +2 -0
- package/src/context/index.ts +10 -3
- package/src/deploy/base.ts +38 -2
- package/src/deploy/kubernetes/deployJob.ts +14 -5
- package/src/deploy/types.ts +60 -11
- package/src/pipeline/createChildPipeline.ts +2 -2
- package/src/pipeline/createJobs.ts +24 -13
- package/src/pipeline/gitlab/makeGitlabJob.ts +1 -0
- package/src/types/gitlab-types.ts +1 -1
- package/src/types/jobs.ts +8 -1
package/dist/build/docker.d.ts
CHANGED
|
@@ -1,7 +1,21 @@
|
|
|
1
1
|
import { Context } from "../types";
|
|
2
2
|
import { CatladderJob } from "../types/jobs";
|
|
3
|
+
export declare const getDockerImageVariables: (context: Context) => {
|
|
4
|
+
DOCKER_REGISTRY: string;
|
|
5
|
+
DOCKER_REGISTRY_IMAGE_PATH: string;
|
|
6
|
+
DOCKER_CACHE_IMAGE: string;
|
|
7
|
+
DOCKER_IMAGE_NAME: string;
|
|
8
|
+
DOCKER_IMAGE: string;
|
|
9
|
+
DOCKER_IMAGE_TAG: string;
|
|
10
|
+
};
|
|
3
11
|
export declare const requiresDockerBuild: (context: Context) => boolean;
|
|
4
12
|
export declare const getDockerBuildVariables: (context: Context) => {
|
|
13
|
+
DOCKER_REGISTRY: string;
|
|
14
|
+
DOCKER_REGISTRY_IMAGE_PATH: string;
|
|
15
|
+
DOCKER_CACHE_IMAGE: string;
|
|
16
|
+
DOCKER_IMAGE_NAME: string;
|
|
17
|
+
DOCKER_IMAGE: string;
|
|
18
|
+
DOCKER_IMAGE_TAG: string;
|
|
5
19
|
DOCKER_BUILDKIT: string;
|
|
6
20
|
DOCKERFILE_ADDITIONS: string | undefined;
|
|
7
21
|
DOCKERFILE_ADDITIONS_END: string | undefined;
|
|
@@ -9,10 +23,7 @@ export declare const getDockerBuildVariables: (context: Context) => {
|
|
|
9
23
|
DOCKER_HOST: string;
|
|
10
24
|
DOCKER_TLS_CERTDIR: string;
|
|
11
25
|
DOCKER_DIR: string;
|
|
12
|
-
IMAGE_TAG: string;
|
|
13
26
|
DOCKER_DRIVER: string;
|
|
14
|
-
IMAGE_NAME: string;
|
|
15
|
-
CACHE_IMAGE: string;
|
|
16
27
|
KUBERNETES_CPU_REQUEST: string;
|
|
17
28
|
KUBERNETES_CPU_LIMIT: string;
|
|
18
29
|
KUBERNETES_MEMORY_REQUEST: string;
|
package/dist/build/docker.js
CHANGED
|
@@ -61,7 +61,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
exports.__esModule = true;
|
|
64
|
-
exports.createDockerBuildJobDefault = exports.createDockerBuildJobBase = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = void 0;
|
|
64
|
+
exports.createDockerBuildJobDefault = exports.createDockerBuildJobBase = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
|
|
65
65
|
|
|
66
66
|
var lodash_1 = require("lodash");
|
|
67
67
|
|
|
@@ -76,6 +76,19 @@ var DOCKER_RUNNER_BUILD_VARIABLES = {
|
|
|
76
76
|
KUBERNETES_MEMORY_LIMIT: "2Gi"
|
|
77
77
|
};
|
|
78
78
|
|
|
79
|
+
var getDockerImageVariables = function (context) {
|
|
80
|
+
return {
|
|
81
|
+
DOCKER_REGISTRY: "$CI_REGISTRY",
|
|
82
|
+
DOCKER_REGISTRY_IMAGE_PATH: "$CI_REGISTRY_IMAGE",
|
|
83
|
+
DOCKER_CACHE_IMAGE: "$DOCKER_REGISTRY_IMAGE_PATH/caches/" + context.componentName,
|
|
84
|
+
DOCKER_IMAGE_NAME: context.environment.shortName + "/" + context.componentName,
|
|
85
|
+
DOCKER_IMAGE: "$DOCKER_REGISTRY_IMAGE_PATH/$DOCKER_IMAGE_NAME",
|
|
86
|
+
DOCKER_IMAGE_TAG: "$CI_COMMIT_SHA"
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
exports.getDockerImageVariables = getDockerImageVariables;
|
|
91
|
+
|
|
79
92
|
var requiresDockerBuild = function (context) {
|
|
80
93
|
var deployConfig = context.componentConfig.deploy;
|
|
81
94
|
|
|
@@ -95,7 +108,7 @@ exports.requiresDockerBuild = requiresDockerBuild;
|
|
|
95
108
|
var getDockerBuildVariables = function (context) {
|
|
96
109
|
var _a, _b, _c, _d;
|
|
97
110
|
|
|
98
|
-
return __assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
|
|
111
|
+
return __assign(__assign(__assign({}, DOCKER_RUNNER_BUILD_VARIABLES), {
|
|
99
112
|
DOCKER_BUILDKIT: "1",
|
|
100
113
|
DOCKERFILE_ADDITIONS: (_b = (_a = context.componentConfig.build.docker) === null || _a === void 0 ? void 0 : _a.additionsBegin) === null || _b === void 0 ? void 0 : _b.join("\n"),
|
|
101
114
|
DOCKERFILE_ADDITIONS_END: (_d = (_c = context.componentConfig.build.docker) === null || _c === void 0 ? void 0 : _c.additionsEnd) === null || _d === void 0 ? void 0 : _d.join("\n"),
|
|
@@ -103,11 +116,8 @@ var getDockerBuildVariables = function (context) {
|
|
|
103
116
|
DOCKER_HOST: "tcp://0.0.0.0:2375",
|
|
104
117
|
DOCKER_TLS_CERTDIR: "",
|
|
105
118
|
DOCKER_DIR: ".",
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
IMAGE_NAME: "$CI_REGISTRY_IMAGE/" + context.environment.shortName + "/" + context.componentName,
|
|
109
|
-
CACHE_IMAGE: "$CI_REGISTRY_IMAGE/caches/" + context.componentName
|
|
110
|
-
});
|
|
119
|
+
DOCKER_DRIVER: "overlay2"
|
|
120
|
+
}), (0, exports.getDockerImageVariables)(context));
|
|
111
121
|
};
|
|
112
122
|
|
|
113
123
|
exports.getDockerBuildVariables = getDockerBuildVariables;
|
|
@@ -139,7 +149,7 @@ var createDockerBuildJobDefault = function (context, _a) {
|
|
|
139
149
|
def = __rest(_a, ["script"]);
|
|
140
150
|
|
|
141
151
|
return (0, exports.createDockerBuildJobBase)(context, __assign({
|
|
142
|
-
script: __spreadArray(__spreadArray([], __read(script || []), false), ["docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY", "docker build --network host --cache-from $
|
|
152
|
+
script: __spreadArray(__spreadArray([], __read(script || []), false), ["docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY", "docker build --network host --cache-from $DOCKER_CACHE_IMAGE --tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1", "docker push $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_CACHE_IMAGE", "docker push $DOCKER_CACHE_IMAGE"], false)
|
|
143
153
|
}, def));
|
|
144
154
|
};
|
|
145
155
|
|
|
@@ -52,6 +52,8 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
52
52
|
exports.__esModule = true;
|
|
53
53
|
exports.createNodeTestJobs = void 0;
|
|
54
54
|
|
|
55
|
+
var runner_1 = require("../../runner");
|
|
56
|
+
|
|
55
57
|
var utils_1 = require("../../utils");
|
|
56
58
|
|
|
57
59
|
var cache_1 = require("./cache");
|
|
@@ -95,6 +97,7 @@ var createNodeTestJobs = function (context) {
|
|
|
95
97
|
var testJob = buildConfig.test !== false ? __assign(__assign({
|
|
96
98
|
name: "🧪 test"
|
|
97
99
|
}, base), {
|
|
100
|
+
image: (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
|
|
98
101
|
cache: (0, cache_1.getNodeCache)(context),
|
|
99
102
|
script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(yarnInstall), false), __read((_j = (0, utils_1.ensureArray)((_h = buildConfig.test) === null || _h === void 0 ? void 0 : _h.command)) !== null && _j !== void 0 ? _j : ["yarn test"]), false)
|
|
100
103
|
}) : null;
|
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 = "
|
|
5
|
+
exports.PIPELINE_IMAGE_TAG = "rolling-update-3bca086c" || "";
|
|
6
6
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || "";
|
package/dist/context/index.js
CHANGED
|
@@ -73,6 +73,12 @@ var getSecretVarName = function (env, componentName, key) {
|
|
|
73
73
|
|
|
74
74
|
exports.getSecretVarName = getSecretVarName;
|
|
75
75
|
|
|
76
|
+
var addIndexVar = function (vars) {
|
|
77
|
+
return __assign(__assign({}, vars), {
|
|
78
|
+
_ALL_ENV_VAR_KEYS: JSON.stringify(Object.keys(vars))
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
76
82
|
var getSecretVarNameForContext = function (context, key) {
|
|
77
83
|
return (0, exports.getSecretVarName)(context.environment.shortName, context.componentName, key);
|
|
78
84
|
};
|
|
@@ -143,6 +149,7 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
143
149
|
var KUBE_NAMESPACE = (0, deploy_1.getKubernetesNamespace)(config, env);
|
|
144
150
|
predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
|
|
145
151
|
HOST_CANONICAL: HOST_CANONICAL,
|
|
152
|
+
HOST: host,
|
|
146
153
|
ROOT_URL: url_1,
|
|
147
154
|
KUBE_NAMESPACE: KUBE_NAMESPACE,
|
|
148
155
|
KUBE_APP_NAME: KUBE_APP_NAME,
|
|
@@ -165,9 +172,7 @@ var getEnvironment = function (config, componentName, env, commitInfo, alreadyVi
|
|
|
165
172
|
|
|
166
173
|
return [key, (0, lodash_1.isObject)(value) ? JSON.stringify(value) : "".concat(value)];
|
|
167
174
|
}));
|
|
168
|
-
|
|
169
|
-
var envVarsRaw = __assign(__assign(__assign({}, predefinedVariables), secretEnvVars), publicEnvVarsRawSanitized);
|
|
170
|
-
|
|
175
|
+
var envVarsRaw = addIndexVar(__assign(__assign(__assign({}, predefinedVariables), secretEnvVars), publicEnvVarsRawSanitized));
|
|
171
176
|
var envVars = (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (componentName, variableName, alreadyVisited) {
|
|
172
177
|
var envVars = (0, exports.getEnvironment)(config, componentName, env, commitInfo, alreadyVisited).envVars;
|
|
173
178
|
return envVars[variableName];
|
package/dist/deploy/base.d.ts
CHANGED
|
@@ -2,7 +2,9 @@ import { Context } from "../types";
|
|
|
2
2
|
import { CatladderJob } from "../types/jobs";
|
|
3
3
|
export declare const DEPLOY_JOB_NAME = "\uD83D\uDE80 Deploy";
|
|
4
4
|
export declare const STOP_JOB_NAME = "\uD83D\uDED1 Stop \u26A0\uFE0F";
|
|
5
|
+
export declare const ROLLBACK_JOB_NAME = "\u21A9\uFE0F Rollback \u26A0\uFE0F";
|
|
5
6
|
declare type JobWithoutScript = Omit<CatladderJob, "script">;
|
|
6
7
|
export declare const getBaseDeploymentJob: (context: Context) => JobWithoutScript;
|
|
7
8
|
export declare const getBaseDeploymentStopJob: (context: Context) => JobWithoutScript;
|
|
9
|
+
export declare const getBaseRollbackJob: (context: Context) => JobWithoutScript;
|
|
8
10
|
export {};
|
package/dist/deploy/base.js
CHANGED
|
@@ -15,7 +15,7 @@ var __assign = this && this.__assign || function () {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
exports.__esModule = true;
|
|
18
|
-
exports.getBaseDeploymentStopJob = exports.getBaseDeploymentJob = exports.STOP_JOB_NAME = exports.DEPLOY_JOB_NAME = void 0;
|
|
18
|
+
exports.getBaseRollbackJob = exports.getBaseDeploymentStopJob = exports.getBaseDeploymentJob = exports.ROLLBACK_JOB_NAME = exports.STOP_JOB_NAME = exports.DEPLOY_JOB_NAME = void 0;
|
|
19
19
|
|
|
20
20
|
var docker_1 = require("../build/docker");
|
|
21
21
|
|
|
@@ -23,6 +23,7 @@ var utils_1 = require("./utils");
|
|
|
23
23
|
|
|
24
24
|
exports.DEPLOY_JOB_NAME = "🚀 Deploy";
|
|
25
25
|
exports.STOP_JOB_NAME = "🛑 Stop ⚠️";
|
|
26
|
+
exports.ROLLBACK_JOB_NAME = "↩️ Rollback ⚠️";
|
|
26
27
|
var DEPLOY_RUNNER_VARIABLES = {
|
|
27
28
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
28
29
|
KUBERNETES_CPU_LIMIT: "1",
|
|
@@ -31,7 +32,7 @@ var DEPLOY_RUNNER_VARIABLES = {
|
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
var getBaseDeploymentJob = function (context) {
|
|
34
|
-
var _a;
|
|
35
|
+
var _a, _b, _c;
|
|
35
36
|
|
|
36
37
|
var environment = {
|
|
37
38
|
name: context.environment.fullName,
|
|
@@ -52,6 +53,13 @@ var getBaseDeploymentJob = function (context) {
|
|
|
52
53
|
return {
|
|
53
54
|
name: exports.DEPLOY_JOB_NAME,
|
|
54
55
|
envMode: "stagePerEnv",
|
|
56
|
+
needsOtherComponent: context.componentConfig.deploy ? (_c = (_b = context.componentConfig.deploy.waitFor) === null || _b === void 0 ? void 0 : _b.map(function (c) {
|
|
57
|
+
return {
|
|
58
|
+
componentName: c,
|
|
59
|
+
job: exports.DEPLOY_JOB_NAME,
|
|
60
|
+
artifacts: false
|
|
61
|
+
};
|
|
62
|
+
})) !== null && _c !== void 0 ? _c : undefined : undefined,
|
|
55
63
|
// we don't want to deploy when there is a broken test
|
|
56
64
|
needsStages: [{
|
|
57
65
|
stage: "build",
|
|
@@ -67,7 +75,7 @@ var getBaseDeploymentJob = function (context) {
|
|
|
67
75
|
}],
|
|
68
76
|
allow_failure: whenDeploy === "manual" ? true : false,
|
|
69
77
|
stage: "deploy",
|
|
70
|
-
variables: __assign(__assign({}, DEPLOY_RUNNER_VARIABLES), context.environment.envVars),
|
|
78
|
+
variables: __assign(__assign(__assign({}, DEPLOY_RUNNER_VARIABLES), context.environment.envVars), hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {}),
|
|
71
79
|
environment: __assign(__assign({}, environment), isStoppable ? {
|
|
72
80
|
on_stop: exports.STOP_JOB_NAME,
|
|
73
81
|
auto_stop_in: autoStop
|
|
@@ -104,4 +112,29 @@ var getBaseDeploymentStopJob = function (context) {
|
|
|
104
112
|
};
|
|
105
113
|
};
|
|
106
114
|
|
|
107
|
-
exports.getBaseDeploymentStopJob = getBaseDeploymentStopJob;
|
|
115
|
+
exports.getBaseDeploymentStopJob = getBaseDeploymentStopJob;
|
|
116
|
+
|
|
117
|
+
var getBaseRollbackJob = function (context) {
|
|
118
|
+
var environment = {
|
|
119
|
+
name: context.environment.fullName,
|
|
120
|
+
url: context.environment.url
|
|
121
|
+
};
|
|
122
|
+
return {
|
|
123
|
+
name: exports.ROLLBACK_JOB_NAME,
|
|
124
|
+
envMode: "stagePerEnv",
|
|
125
|
+
needs: [exports.DEPLOY_JOB_NAME],
|
|
126
|
+
rules: [{
|
|
127
|
+
when: "manual",
|
|
128
|
+
allow_failure: true
|
|
129
|
+
}],
|
|
130
|
+
variables: __assign(__assign({}, DEPLOY_RUNNER_VARIABLES), {
|
|
131
|
+
GIT_STRATEGY: "none"
|
|
132
|
+
}),
|
|
133
|
+
stage: "rollback",
|
|
134
|
+
environment: __assign(__assign({}, environment), {
|
|
135
|
+
action: "access"
|
|
136
|
+
})
|
|
137
|
+
};
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
exports.getBaseRollbackJob = getBaseRollbackJob;
|
|
@@ -145,7 +145,7 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
145
145
|
image: (0, runner_1.getRunnerImage)("kubernetes"),
|
|
146
146
|
variables: __assign(__assign({}, context.environment.envVars), {
|
|
147
147
|
HELM_EXPERIMENTAL_OCI: "1",
|
|
148
|
-
|
|
148
|
+
KUBE_DOCKER_IMAGE_PULL_SECRET: "gitlab-registry-".concat(context.componentName),
|
|
149
149
|
KUBE_VALUES: (0, js_yaml_1.dump)(kubeValues, {
|
|
150
150
|
lineWidth: -1,
|
|
151
151
|
quotingType: "'",
|
|
@@ -154,14 +154,12 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
154
154
|
HELM_GITLAB_CHART_NAME: "the-panter-chart",
|
|
155
155
|
HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_p = deployConfig.additionalHelmArgs) !== null && _p !== void 0 ? _p : []), false).join(" "),
|
|
156
156
|
COMPONENT_NAME: context.componentName,
|
|
157
|
-
BUILD_ID: (_q = context.commitInfo) === null || _q === void 0 ? void 0 : _q.buildId
|
|
158
|
-
// TODO: unify with docker build stage
|
|
159
|
-
IMAGE_NAME: context.environment.shortName + "/" + context.componentName,
|
|
160
|
-
IMAGE_TAG: "$CI_COMMIT_SHA"
|
|
157
|
+
BUILD_ID: (_q = context.commitInfo) === null || _q === void 0 ? void 0 : _q.buildId
|
|
161
158
|
})
|
|
162
159
|
};
|
|
163
160
|
var baseDeploymentJob = (0, base_1.getBaseDeploymentJob)(context);
|
|
164
161
|
var baseStopJob = (0, base_1.getBaseDeploymentStopJob)(context);
|
|
162
|
+
var baseRollbackJob = (0, base_1.getBaseRollbackJob)(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, {
|
|
@@ -174,6 +172,11 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
174
172
|
environment: {
|
|
175
173
|
kubernetes: kubernetesEnvironment
|
|
176
174
|
}
|
|
175
|
+
}), (0, lodash_1.merge)({}, baseRollbackJob, shared, {
|
|
176
|
+
script: __spreadArray(__spreadArray([], __read(connectContext), false), ["kubernetesRollback"], false),
|
|
177
|
+
environment: {
|
|
178
|
+
kubernetes: kubernetesEnvironment
|
|
179
|
+
}
|
|
177
180
|
})];
|
|
178
181
|
};
|
|
179
182
|
|
|
@@ -27,18 +27,11 @@ export declare const processSecretsAsFiles: <T extends {
|
|
|
27
27
|
redirects?: ({
|
|
28
28
|
host: string;
|
|
29
29
|
} & Record<string, unknown>)[] | undefined;
|
|
30
|
+
hostAliases?: string[] | undefined;
|
|
30
31
|
replicas?: number | undefined;
|
|
31
32
|
autoscale?: import("../types").KubernetesAutoscale | undefined;
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
cpu?: string | undefined;
|
|
35
|
-
memory?: string | undefined;
|
|
36
|
-
} | undefined;
|
|
37
|
-
requests?: {
|
|
38
|
-
cpu?: string | undefined;
|
|
39
|
-
memory?: string | undefined;
|
|
40
|
-
} | undefined;
|
|
41
|
-
} | undefined;
|
|
33
|
+
updateStrategy?: import("../types").KubernetesUpdateStrategy | undefined;
|
|
34
|
+
resources?: import("../types").KubernetesResourcesDef | undefined;
|
|
42
35
|
healthRoute?: string | undefined;
|
|
43
36
|
startupProbe?: {
|
|
44
37
|
httpGet?: {
|
|
@@ -82,6 +75,7 @@ export declare const processSecretsAsFiles: <T extends {
|
|
|
82
75
|
successThreshold?: number | undefined;
|
|
83
76
|
} | undefined;
|
|
84
77
|
} | undefined;
|
|
78
|
+
worker?: import("../types").KubernetesWorkerDef | undefined;
|
|
85
79
|
} & Record<string, unknown>) | undefined;
|
|
86
80
|
secretsAsFile?: string[] | undefined;
|
|
87
81
|
} & Record<string, unknown>>(values: T) => T;
|
package/dist/deploy/types.d.ts
CHANGED
|
@@ -5,6 +5,12 @@ export declare type DeployConfigBase = {
|
|
|
5
5
|
* - all other envs: auto
|
|
6
6
|
*/
|
|
7
7
|
when?: "manual" | "auto";
|
|
8
|
+
/**
|
|
9
|
+
* EXPERIMENTAL
|
|
10
|
+
* wait for other components to deploy first, before doing this deployment
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
waitFor?: string[];
|
|
8
14
|
};
|
|
9
15
|
declare type AllowUnknownProps<T extends Record<string, unknown>> = T & Record<string, unknown>;
|
|
10
16
|
export declare type DeployConfigKubernetesClusterGCloud = {
|
|
@@ -54,6 +60,16 @@ export declare type KubernetesAutoscale = {
|
|
|
54
60
|
|
|
55
61
|
metrics: KubernetesAutoscaleMetric[];
|
|
56
62
|
};
|
|
63
|
+
export declare type KubernetesResourcesDef = {
|
|
64
|
+
limits?: {
|
|
65
|
+
cpu?: string;
|
|
66
|
+
memory?: string;
|
|
67
|
+
};
|
|
68
|
+
requests?: {
|
|
69
|
+
cpu?: string;
|
|
70
|
+
memory?: string;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
57
73
|
declare type KubernetesHealthDef = {
|
|
58
74
|
httpGet?: {
|
|
59
75
|
path?: string;
|
|
@@ -68,6 +84,33 @@ declare type KubernetesHealthDef = {
|
|
|
68
84
|
successThreshold?: number;
|
|
69
85
|
};
|
|
70
86
|
};
|
|
87
|
+
export declare type KubernetesUpdateStrategy = {
|
|
88
|
+
rollingUpdate: {
|
|
89
|
+
/**
|
|
90
|
+
* how many pods can be created additionally to the target number
|
|
91
|
+
* can be absolute number or percentage.
|
|
92
|
+
* defaults to 1 (kube default is 25%)
|
|
93
|
+
*/
|
|
94
|
+
maxSurge: number | string;
|
|
95
|
+
/**
|
|
96
|
+
* how many pods are allowed to be unavailable
|
|
97
|
+
* can be absolute number or percentage
|
|
98
|
+
* defaults to 0 (kube default is 25%)
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
maxUnavailable: number | string;
|
|
102
|
+
};
|
|
103
|
+
type: "RollingUpdate";
|
|
104
|
+
};
|
|
105
|
+
export declare type KubernetesWorkerDef = {
|
|
106
|
+
enabled: boolean;
|
|
107
|
+
/**
|
|
108
|
+
* which command to run. defaults to `yarn start`
|
|
109
|
+
*/
|
|
110
|
+
|
|
111
|
+
command?: string;
|
|
112
|
+
resources?: KubernetesResourcesDef;
|
|
113
|
+
};
|
|
71
114
|
export declare type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
72
115
|
/**
|
|
73
116
|
* enable cloudsql db. Currently you have to manually set it up
|
|
@@ -126,6 +169,11 @@ export declare type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
|
126
169
|
redirects?: AllowUnknownProps<{
|
|
127
170
|
host: string;
|
|
128
171
|
}>[];
|
|
172
|
+
/**
|
|
173
|
+
* Host aliases
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
hostAliases?: string[];
|
|
129
177
|
/**
|
|
130
178
|
* how many pods will be started
|
|
131
179
|
*/
|
|
@@ -136,24 +184,27 @@ export declare type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
|
136
184
|
*/
|
|
137
185
|
|
|
138
186
|
autoscale?: KubernetesAutoscale;
|
|
187
|
+
/**
|
|
188
|
+
* the update strategy, see https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#rolling-update-deployment
|
|
189
|
+
*/
|
|
190
|
+
|
|
191
|
+
updateStrategy?: KubernetesUpdateStrategy;
|
|
139
192
|
/**
|
|
140
193
|
* kubernetes resources
|
|
141
194
|
*/
|
|
142
195
|
|
|
143
|
-
resources?:
|
|
144
|
-
limits?: {
|
|
145
|
-
cpu?: string;
|
|
146
|
-
memory?: string;
|
|
147
|
-
};
|
|
148
|
-
requests?: {
|
|
149
|
-
cpu?: string;
|
|
150
|
-
memory?: string;
|
|
151
|
-
};
|
|
152
|
-
};
|
|
196
|
+
resources?: KubernetesResourcesDef;
|
|
153
197
|
healthRoute?: string;
|
|
154
198
|
startupProbe?: KubernetesHealthDef;
|
|
155
199
|
readinessProbe?: KubernetesHealthDef;
|
|
156
200
|
livenessProbe?: KubernetesHealthDef;
|
|
201
|
+
/**
|
|
202
|
+
* specify a worker. A worker is a separate deployment that runs continously in the background.
|
|
203
|
+
* The worker pod can use the same entry point as the app or a different one (specify command).
|
|
204
|
+
* It has the same environment variables as the application and an additional IS_WORKER="true" variable
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
worker?: KubernetesWorkerDef;
|
|
157
208
|
}>;
|
|
158
209
|
/**
|
|
159
210
|
* Mount secrets as files in the filesystem.
|
|
@@ -181,7 +232,7 @@ export declare type DeployConfigKubernetes = {
|
|
|
181
232
|
|
|
182
233
|
values?: DeployConfigKubernetesValues;
|
|
183
234
|
} & DeployConfigBase;
|
|
184
|
-
declare type DeployConfigCustom = {
|
|
235
|
+
export declare type DeployConfigCustom = {
|
|
185
236
|
type: "custom";
|
|
186
237
|
requiresDocker: boolean;
|
|
187
238
|
script: string[];
|
|
@@ -199,9 +199,9 @@ var rules_1 = require("../rules");
|
|
|
199
199
|
|
|
200
200
|
var runner_1 = require("../runner");
|
|
201
201
|
|
|
202
|
-
var
|
|
202
|
+
var jobs_1 = require("../types/jobs");
|
|
203
203
|
|
|
204
|
-
var
|
|
204
|
+
var createJobs_1 = require("./createJobs");
|
|
205
205
|
|
|
206
206
|
var createChildPipeline = function (type, trigger, config) {
|
|
207
207
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -243,7 +243,7 @@ var createChildPipeline = function (type, trigger, config) {
|
|
|
243
243
|
case 1:
|
|
244
244
|
jobs = _a.sent();
|
|
245
245
|
allEnvs = (0, config_1.getAllEnvsInAllComponents)(config);
|
|
246
|
-
stages =
|
|
246
|
+
stages = jobs_1.BASE_STAGES.reduce(function (acc, baseStage) {
|
|
247
247
|
return __spreadArray(__spreadArray(__spreadArray([], __read(acc), false), [baseStage], false), __read(allEnvs.map(function (e) {
|
|
248
248
|
return "".concat(baseStage, " ").concat(e);
|
|
249
249
|
})), false);
|
|
@@ -277,18 +277,28 @@ var getFullReferencedJobName = function (referencedJobName, componentName, env,
|
|
|
277
277
|
|
|
278
278
|
|
|
279
279
|
var replaceReferences = function (job, componentName, env, allRawJobs) {
|
|
280
|
-
var _a, _b;
|
|
280
|
+
var _a, _b, _c;
|
|
281
281
|
|
|
282
282
|
var stage = job.envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
|
|
283
|
+
var needsFromNeeds = (_a = job.needs) === null || _a === void 0 ? void 0 : _a.map(function (n) {
|
|
284
|
+
return (0, lodash_1.isObject)(n) ? {
|
|
285
|
+
job: getFullReferencedJobName(n.job, componentName, env, allRawJobs),
|
|
286
|
+
artifacts: n.artifacts
|
|
287
|
+
} : getFullReferencedJobName(n, componentName, env, allRawJobs);
|
|
288
|
+
});
|
|
289
|
+
var needsFromOtherComponents = (_b = job.needsOtherComponent) === null || _b === void 0 ? void 0 : _b.map(function (other) {
|
|
290
|
+
return {
|
|
291
|
+
artifacts: other.artifacts,
|
|
292
|
+
job: getFullReferencedJobName(other.job, other.componentName, env, allRawJobs)
|
|
293
|
+
};
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
var needs = __spreadArray(__spreadArray([], __read(needsFromNeeds !== null && needsFromNeeds !== void 0 ? needsFromNeeds : []), false), __read(needsFromOtherComponents !== null && needsFromOtherComponents !== void 0 ? needsFromOtherComponents : []), false);
|
|
297
|
+
|
|
283
298
|
return __assign(__assign({}, job), {
|
|
284
299
|
stage: stage,
|
|
285
|
-
needs:
|
|
286
|
-
|
|
287
|
-
job: getFullReferencedJobName(n.job, componentName, env, allRawJobs),
|
|
288
|
-
artifacts: n.artifacts
|
|
289
|
-
} : getFullReferencedJobName(n, componentName, env, allRawJobs);
|
|
290
|
-
}),
|
|
291
|
-
environment: ((_b = job.environment) === null || _b === void 0 ? void 0 : _b.on_stop) ? __assign(__assign({}, job.environment), {
|
|
300
|
+
needs: needs,
|
|
301
|
+
environment: ((_c = job.environment) === null || _c === void 0 ? void 0 : _c.on_stop) ? __assign(__assign({}, job.environment), {
|
|
292
302
|
on_stop: getFullReferencedJobName(job.environment.on_stop, componentName, env, allRawJobs)
|
|
293
303
|
}) : job.environment
|
|
294
304
|
});
|
|
@@ -33,8 +33,9 @@ var defaults_1 = require("../../defaults");
|
|
|
33
33
|
var makeGitlabJob = function (_a) {
|
|
34
34
|
var envMode = _a.envMode,
|
|
35
35
|
needsStages = _a.needsStages,
|
|
36
|
+
needsOtherComponent = _a.needsOtherComponent,
|
|
36
37
|
name = _a.name,
|
|
37
|
-
rest = __rest(_a, ["envMode", "needsStages", "name"]);
|
|
38
|
+
rest = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name"]);
|
|
38
39
|
|
|
39
40
|
return __assign(__assign({}, rest), {
|
|
40
41
|
retry: defaults_1.BASE_RETRY,
|