@catladder/pipeline 0.0.0-next-e2e4f00a → 0.0.0-next-de346530
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/build/base/createAppBuildJob.js +3 -3
- package/dist/build/custom/testJob.js +12 -12
- package/dist/build/node/buildJob.js +1 -1
- package/dist/build/node/cache.d.ts +2 -4
- package/dist/build/node/cache.js +3 -24
- package/dist/build/node/testJob.js +11 -11
- package/dist/build/rails/build.js +1 -1
- package/dist/build/rails/test.js +8 -8
- package/dist/build/types.d.ts +0 -10
- package/dist/bundles/catladder-gitlab/index.js +74 -174
- package/dist/constants.js +1 -1
- package/dist/context/__tests__/resolveReferences.test.js +0 -22
- package/dist/context/createComponentContext.js +0 -1
- package/dist/context/getEnvironment.js +1 -2
- package/dist/context/getEnvironmentVariables.d.ts +2 -5
- package/dist/context/getEnvironmentVariables.js +17 -24
- package/dist/context/resolveReferences.d.ts +1 -4
- package/dist/context/resolveReferences.js +2 -16
- package/dist/deploy/base/deploy.js +3 -3
- package/dist/deploy/cloudRun/index.js +2 -2
- package/dist/deploy/kubernetes/cloudSql/index.js +3 -14
- package/dist/deploy/kubernetes/deployJob.js +1 -3
- package/dist/deploy/kubernetes/index.js +2 -2
- package/dist/deploy/kubernetes/kubeValues.d.ts +1 -2
- package/dist/deploy/kubernetes/kubeValues.js +2 -3
- package/dist/deploy/types/base.d.ts +0 -6
- package/dist/deploy/types/kubernetes.d.ts +1 -34
- package/dist/pipeline/gitlab/createGitlabJobs.js +3 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +0 -8
- package/dist/types/context.d.ts +0 -8
- package/dist/types/jobs.d.ts +0 -8
- package/examples/__snapshots__/cloud-run-memory-limit.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-meteor-with-worker.test.ts.snap +36 -52
- package/examples/__snapshots__/cloud-run-nextjs.test.ts.snap +1402 -0
- package/examples/__snapshots__/cloud-run-no-cpu-throttling.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-no-service.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-non-public.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-post-stop-job.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-service-custom-vpc.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-service-gen2.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-service-increase-timout.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-service-with-volumes.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-storybook.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-with-ngnix.test.ts.snap +36 -68
- package/examples/__snapshots__/cloud-run-with-sql-reuse-db.test.ts.snap +72 -136
- package/examples/__snapshots__/cloud-run-with-sql.test.ts.snap +48 -84
- package/examples/__snapshots__/cloud-run-with-worker.test.ts.snap +36 -68
- package/examples/__snapshots__/custom-build-job-with-tests.test.ts.snap +36 -52
- package/examples/__snapshots__/custom-build-job.test.ts.snap +36 -52
- package/examples/__snapshots__/custom-deploy.test.ts.snap +24 -48
- package/examples/__snapshots__/custom-envs.test.ts.snap +18 -48
- package/examples/__snapshots__/custom-sbom-java.test.ts.snap +36 -52
- package/examples/__snapshots__/git-submodule.test.ts.snap +36 -68
- package/examples/__snapshots__/kubernetes-application-customization.test.ts.snap +60 -112
- package/examples/__snapshots__/kubernetes-with-cloud-sql.test.ts.snap +60 -112
- package/examples/__snapshots__/kubernetes-with-jobs.test.ts.snap +120 -224
- package/examples/__snapshots__/kubernetes-with-mongodb.test.ts.snap +60 -112
- package/examples/__snapshots__/local-dot-env.test.ts.snap +36 -68
- package/examples/__snapshots__/meteor-kubernetes.test.ts.snap +60 -96
- package/examples/__snapshots__/multiline-var.test.ts.snap +96 -180
- package/examples/__snapshots__/native-app.test.ts.snap +72 -132
- package/examples/__snapshots__/node-build-with-custom-image.test.ts.snap +36 -68
- package/examples/__snapshots__/node-build-with-docker-additions.test.ts.snap +36 -68
- package/examples/__snapshots__/rails-k8s-with-worker-dockerfile.test.ts.snap +48 -80
- package/examples/__snapshots__/rails-k8s-with-worker.test.ts.snap +48 -80
- package/examples/__snapshots__/wait-for-other-deploy.test.ts.snap +48 -96
- package/examples/__snapshots__/{workspace-api-www-custom-cache.test.ts.snap → workspace-api-www-turbo-cache.test.ts.snap} +81 -153
- package/examples/__snapshots__/workspace-api-www.test.ts.snap +76 -136
- package/examples/{workspace-api-www-custom-cache.test.ts → cloud-run-nextjs.test.ts} +2 -2
- package/examples/cloud-run-nextjs.ts +29 -0
- package/examples/native-app.ts +10 -6
- package/examples/rails-k8s-with-worker.ts +5 -1
- package/examples/{kubernetes-with-cloud-sql-legacy.test.ts → workspace-api-www-turbo-cache.test.ts} +2 -2
- package/examples/{workspace-api-www-custom-cache.ts → workspace-api-www-turbo-cache.ts} +4 -1
- package/examples/workspace-api-www.ts +3 -0
- package/package.json +1 -1
- package/src/build/base/createAppBuildJob.ts +0 -1
- package/src/build/custom/testJob.ts +0 -1
- package/src/build/node/buildJob.ts +2 -2
- package/src/build/node/cache.ts +0 -29
- package/src/build/node/testJob.ts +0 -1
- package/src/build/rails/build.ts +0 -1
- package/src/build/rails/test.ts +0 -1
- package/src/build/types.ts +0 -13
- package/src/context/__tests__/resolveReferences.test.ts +1 -27
- package/src/context/createComponentContext.ts +0 -1
- package/src/context/getEnvironment.ts +1 -1
- package/src/context/getEnvironmentVariables.ts +13 -34
- package/src/context/resolveReferences.ts +0 -13
- package/src/deploy/base/deploy.ts +1 -1
- package/src/deploy/cloudRun/index.ts +2 -2
- package/src/deploy/kubernetes/cloudSql/index.ts +1 -15
- package/src/deploy/kubernetes/deployJob.ts +0 -2
- package/src/deploy/kubernetes/index.ts +2 -2
- package/src/deploy/kubernetes/kubeValues.ts +5 -8
- package/src/deploy/types/base.ts +0 -6
- package/src/deploy/types/kubernetes.ts +1 -36
- package/src/pipeline/gitlab/createGitlabJobs.ts +1 -4
- package/src/types/config.ts +0 -8
- package/src/types/context.ts +1 -8
- package/src/types/jobs.ts +0 -8
- package/dist/deploy/kubernetes/processSecretsAsFiles.d.ts +0 -85
- package/dist/deploy/kubernetes/processSecretsAsFiles.js +0 -33
- package/examples/__snapshots__/kubernetes-with-cloud-sql-legacy.test.ts.snap +0 -1791
- package/examples/kubernetes-with-cloud-sql-legacy.ts +0 -35
- package/src/deploy/kubernetes/processSecretsAsFiles.ts +0 -35
|
@@ -148,8 +148,7 @@ var getEnvironment = function (ctx) {
|
|
|
148
148
|
fullName: envContext.fullName,
|
|
149
149
|
slugPrefix: envContext.environmentSlugPrefix,
|
|
150
150
|
reviewSlug: envContext.reviewSlug,
|
|
151
|
-
slug: envContext.environmentSlug
|
|
152
|
-
shortName: env
|
|
151
|
+
slug: envContext.environmentSlug
|
|
153
152
|
}, variables)];
|
|
154
153
|
}
|
|
155
154
|
});
|
|
@@ -13,12 +13,9 @@ declare const getBasePredefinedVariables: (ctx: EnvironmentContext) => {
|
|
|
13
13
|
};
|
|
14
14
|
type BasePredefinedVariables = ReturnType<typeof getBasePredefinedVariables>;
|
|
15
15
|
export type PredefinedVariables = BasePredefinedVariables & {
|
|
16
|
-
|
|
17
|
-
* undefined in rails, Rails before 6.1 (mis)uses the `HOST` environment variable to specify the IP to bind to
|
|
18
|
-
*/
|
|
19
|
-
HOST?: StringOrBashExpression;
|
|
16
|
+
HOSTNAME?: StringOrBashExpression;
|
|
20
17
|
ROOT_URL: StringOrBashExpression;
|
|
21
|
-
|
|
18
|
+
HOSTNAME_INTERNAL: StringOrBashExpression;
|
|
22
19
|
ROOT_URL_INTERNAL: StringOrBashExpression;
|
|
23
20
|
};
|
|
24
21
|
export declare const getEnvironmentVariables: (ctx: CreateComponentContextContext, alreadyVisited?: Record<string, Record<string, boolean>>) => Promise<EnvironmentVariables>;
|
|
@@ -160,7 +160,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
160
160
|
value: true
|
|
161
161
|
});
|
|
162
162
|
exports.getSecretVarNameForContext = exports.getSecretVarName = exports.getEnvironmentVariables = void 0;
|
|
163
|
-
var lodash_1 = require("lodash");
|
|
164
163
|
var deploy_1 = require("../deploy");
|
|
165
164
|
var BashExpression_1 = require("../bash/BashExpression");
|
|
166
165
|
var types_1 = require("../build/types");
|
|
@@ -182,14 +181,14 @@ var getEnvironmentVariables = function (ctx_1) {
|
|
|
182
181
|
args_1[_i - 1] = arguments[_i];
|
|
183
182
|
}
|
|
184
183
|
return __awaiter(void 0, __spreadArray([ctx_1], __read(args_1), false), void 0, function (ctx, alreadyVisited) {
|
|
185
|
-
var environmentContext, config, env, componentName, envConfigRaw, deployConfigRaw, buildConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars,
|
|
184
|
+
var environmentContext, config, env, componentName, envConfigRaw, deployConfigRaw, buildConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars, HOSTNAME_INTERNAL, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, publicEnvVarsRawSanitized, envVarsRaw, envVars;
|
|
186
185
|
var _a, _b;
|
|
187
|
-
var _c, _d, _e, _f, _g, _h, _j
|
|
186
|
+
var _c, _d, _e, _f, _g, _h, _j;
|
|
188
187
|
if (alreadyVisited === void 0) {
|
|
189
188
|
alreadyVisited = {};
|
|
190
189
|
}
|
|
191
|
-
return __generator(this, function (
|
|
192
|
-
switch (
|
|
190
|
+
return __generator(this, function (_k) {
|
|
191
|
+
switch (_k.label) {
|
|
193
192
|
case 0:
|
|
194
193
|
environmentContext = (0, getEnvironmentContext_1.getEnvironmentContext)(ctx);
|
|
195
194
|
config = ctx.config, env = ctx.env, componentName = ctx.componentName;
|
|
@@ -200,38 +199,32 @@ var getEnvironmentVariables = function (ctx_1) {
|
|
|
200
199
|
port = (_c = devLocalConfig.port) !== null && _c !== void 0 ? _c : 3000;
|
|
201
200
|
host = "localhost:" + port.toString();
|
|
202
201
|
url = "http://" + host;
|
|
203
|
-
predefinedVariables = __assign(__assign(
|
|
202
|
+
predefinedVariables = __assign(__assign({}, basePredefinedVariables), {
|
|
204
203
|
ENV_SHORT: "local",
|
|
205
|
-
ROOT_URL: url
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}), {
|
|
209
|
-
HOST_INTERNAL: host,
|
|
204
|
+
ROOT_URL: url,
|
|
205
|
+
HOSTNAME: host,
|
|
206
|
+
HOSTNAME_INTERNAL: host,
|
|
210
207
|
ROOT_URL_INTERNAL: "http://" + host,
|
|
211
208
|
PORT: port.toString()
|
|
212
209
|
});
|
|
213
210
|
} else {
|
|
214
211
|
additionalEnvVars = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext) : {};
|
|
215
|
-
|
|
216
|
-
host = (_e = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _e !== void 0 ? _e :
|
|
212
|
+
HOSTNAME_INTERNAL = (_d = additionalEnvVars.HOSTNAME_INTERNAL) !== null && _d !== void 0 ? _d : "unknown-host.example.com";
|
|
213
|
+
host = (_e = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _e !== void 0 ? _e : HOSTNAME_INTERNAL;
|
|
217
214
|
url = (0, BashExpression_1.joinBashExpressions)(["https://", host]);
|
|
218
215
|
predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), (0, types_1.isStandaloneBuildConfig)(buildConfigRaw) && buildConfigRaw.type === "rails" ? {} : {
|
|
219
|
-
|
|
216
|
+
HOSTNAME: host
|
|
220
217
|
}), {
|
|
221
218
|
ROOT_URL: url,
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
HOST_CANONICAL: HOST_INTERNAL,
|
|
225
|
-
ROOT_URL_INTERNAL: (0, BashExpression_1.joinBashExpressions)(["https://", HOST_INTERNAL])
|
|
219
|
+
HOSTNAME_INTERNAL: HOSTNAME_INTERNAL,
|
|
220
|
+
ROOT_URL_INTERNAL: (0, BashExpression_1.joinBashExpressions)(["https://", HOSTNAME_INTERNAL])
|
|
226
221
|
}), additionalEnvVars);
|
|
227
222
|
}
|
|
228
223
|
publicEnvVarsRaw = (_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.public) !== null && _g !== void 0 ? _g : {};
|
|
229
224
|
additionalSecretKeys = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].additionalSecretKeys(environmentContext) : [];
|
|
230
225
|
secretEnvVarKeys = __spreadArray(__spreadArray([], __read((0, envVars_1.stringListToSecreteEnvVarList)((_j = (_h = envConfigRaw.vars) === null || _h === void 0 ? void 0 : _h.secret) !== null && _j !== void 0 ? _j : [])), false), __read(additionalSecretKeys), false);
|
|
231
226
|
secretEnvVars = (0, envVars_1.makeSecretEnvVarMapping)(env, componentName, secretEnvVarKeys);
|
|
232
|
-
|
|
233
|
-
publicEnvVarsRawWithLegacyFromComponents = (0, lodash_1.merge)({}, (0, resolveReferences_1.translateLegacyFromComponents)(legacyFromComponents), publicEnvVarsRaw);
|
|
234
|
-
publicEnvVarsRawSanitized = (0, envVars_1.stringifyValues)(publicEnvVarsRawWithLegacyFromComponents);
|
|
227
|
+
publicEnvVarsRawSanitized = (0, envVars_1.stringifyValues)(publicEnvVarsRaw);
|
|
235
228
|
envVarsRaw = addIndexVar(__assign(__assign(__assign({}, predefinedVariables), secretEnvVars), publicEnvVarsRawSanitized));
|
|
236
229
|
return [4 /*yield*/, (0, resolveReferences_1.resolveReferences)(envVarsRaw, function (otherComponentName, alreadyVisited) {
|
|
237
230
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
@@ -250,7 +243,7 @@ var getEnvironmentVariables = function (ctx_1) {
|
|
|
250
243
|
});
|
|
251
244
|
}, alreadyVisited)];
|
|
252
245
|
case 1:
|
|
253
|
-
envVars =
|
|
246
|
+
envVars = _k.sent();
|
|
254
247
|
_a = {
|
|
255
248
|
envVars: envVars,
|
|
256
249
|
secretEnvVarKeys: secretEnvVarKeys
|
|
@@ -258,10 +251,10 @@ var getEnvironmentVariables = function (ctx_1) {
|
|
|
258
251
|
_b = {};
|
|
259
252
|
return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, buildConfigRaw && (0, types_1.isStandaloneBuildConfig)(buildConfigRaw) && buildConfigRaw.jobVars || null)];
|
|
260
253
|
case 2:
|
|
261
|
-
_b.build =
|
|
254
|
+
_b.build = _k.sent();
|
|
262
255
|
return [4 /*yield*/, (0, transformJobOnlyVars_1.transformJobOnlyVars)(env, componentName, deployConfigRaw && deployConfigRaw.jobVars || null)];
|
|
263
256
|
case 3:
|
|
264
|
-
return [2 /*return*/, (_a.jobOnlyVars = (_b.deploy =
|
|
257
|
+
return [2 /*return*/, (_a.jobOnlyVars = (_b.deploy = _k.sent(), _b), _a.host = host, _a.url = url, _a)];
|
|
265
258
|
}
|
|
266
259
|
});
|
|
267
260
|
});
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import type { BashExpression } from "../bash/BashExpression";
|
|
2
2
|
import type { UnspecifiedEnvVars } from "..";
|
|
3
|
-
export declare const resolveReferences: (vars: Record<string, string | BashExpression | undefined | null>, getOtherVariables?: (componentName: string, alreadyVisited: Record<string, Record<string, boolean>>) => Promise<UnspecifiedEnvVars>, alreadyVisitedBase?: Record<string, Record<string, boolean>>) => Promise<Record<string, BashExpression>>;
|
|
4
|
-
export declare const translateLegacyFromComponents: (fromComponents: Record<string, Record<string, string>>) => {
|
|
5
|
-
[k: string]: string;
|
|
6
|
-
};
|
|
3
|
+
export declare const resolveReferences: (vars: Record<string, string | BashExpression | undefined | null>, getOtherVariables?: (componentName: string, alreadyVisited: Record<string, Record<string, boolean>>) => Promise<UnspecifiedEnvVars>, alreadyVisitedBase?: Record<string, Record<string, boolean>>) => Promise<Record<string, BashExpression>>;
|
|
@@ -154,7 +154,7 @@ var __importDefault = this && this.__importDefault || function (mod) {
|
|
|
154
154
|
Object.defineProperty(exports, "__esModule", {
|
|
155
155
|
value: true
|
|
156
156
|
});
|
|
157
|
-
exports.
|
|
157
|
+
exports.resolveReferences = void 0;
|
|
158
158
|
var lodash_1 = require("lodash");
|
|
159
159
|
var replaceAsync_1 = __importDefault(require("../bash/replaceAsync"));
|
|
160
160
|
// regex to resolve references in catladder variables
|
|
@@ -269,18 +269,4 @@ var resolveReferences = function (vars_1, getOtherVariables_1) {
|
|
|
269
269
|
});
|
|
270
270
|
});
|
|
271
271
|
};
|
|
272
|
-
exports.resolveReferences = resolveReferences;
|
|
273
|
-
var translateLegacyFromComponents = function (fromComponents) {
|
|
274
|
-
return Object.fromEntries(Object.entries(fromComponents).flatMap(function (_a) {
|
|
275
|
-
var _b = __read(_a, 2),
|
|
276
|
-
componentName = _b[0],
|
|
277
|
-
variables = _b[1];
|
|
278
|
-
return Object.entries(variables).map(function (_a) {
|
|
279
|
-
var _b = __read(_a, 2),
|
|
280
|
-
ourName = _b[0],
|
|
281
|
-
otherName = _b[1];
|
|
282
|
-
return [ourName, "${" + componentName + ":" + otherName + "}"];
|
|
283
|
-
});
|
|
284
|
-
}));
|
|
285
|
-
};
|
|
286
|
-
exports.translateLegacyFromComponents = translateLegacyFromComponents;
|
|
272
|
+
exports.resolveReferences = resolveReferences;
|
|
@@ -54,7 +54,7 @@ var stop_1 = require("./stop");
|
|
|
54
54
|
var variables_1 = require("./variables");
|
|
55
55
|
exports.DEPLOY_JOB_NAME = "🚀 Deploy";
|
|
56
56
|
var createDeployJob = function (context, jobDefinition) {
|
|
57
|
-
var _a, _b, _c, _d, _e, _f
|
|
57
|
+
var _a, _b, _c, _d, _e, _f;
|
|
58
58
|
var hasDocker = (0, docker_1.requiresDockerBuild)(context);
|
|
59
59
|
var isStoppable = (0, utils_1.contextIsStoppable)(context);
|
|
60
60
|
var autoStop = context.environment.envType === "review" ? "1 week" : context.environment.envType === "dev" ? "4 weeks" : undefined;
|
|
@@ -109,8 +109,8 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
109
109
|
when: whenDeploy === "auto" ? "on_success" : "manual",
|
|
110
110
|
allow_failure: whenDeploy === "manual" ? true : false,
|
|
111
111
|
stage: "deploy",
|
|
112
|
-
variables: __assign(__assign(__assign(__assign(
|
|
113
|
-
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), (
|
|
112
|
+
variables: __assign(__assign(__assign(__assign({}, context.environment.envVars), hasDocker ? (0, docker_1.getDockerImageVariables)(context) : {}), context.environment.jobOnlyVars.deploy.envVars), jobDefinition.variables),
|
|
113
|
+
runnerVariables: __assign(__assign(__assign({}, variables_1.DEPLOY_RUNNER_VARIABLES), (_e = jobDefinition.runnerVariables) !== null && _e !== void 0 ? _e : {}), deployConfig ? (_f = deployConfig.runnerVariables) !== null && _f !== void 0 ? _f : {} : {}),
|
|
114
114
|
environment: isStoppable ? {
|
|
115
115
|
on_stop: stop_1.STOP_JOB_NAME,
|
|
116
116
|
auto_stop_in: autoStop
|
|
@@ -111,7 +111,7 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
|
|
|
111
111
|
env = ctx.env,
|
|
112
112
|
componentName = ctx.componentName,
|
|
113
113
|
deployConfigRaw = ctx.deployConfigRaw;
|
|
114
|
-
var
|
|
114
|
+
var HOSTNAME_INTERNAL = (0, BashExpression_1.joinBashExpressions)([fullName, (0, BashExpression_1.getBashVariable)((0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX))], "-").toLowerCase();
|
|
115
115
|
var jobTriggers = deployConfigRaw && deployConfigRaw.jobs ? Object.fromEntries(Object.entries(deployConfigRaw.jobs).map(function (_a) {
|
|
116
116
|
var _b = __read(_a, 2),
|
|
117
117
|
name = _b[0],
|
|
@@ -119,7 +119,7 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
|
|
|
119
119
|
return ["CLOUD_RUN_JOB_TRIGGER_URL_" + (0, gitlab_1.sanitizeForBashVariable)(name), "https://".concat(deployConfigRaw.region, "-run.googleapis.com/apis/run.googleapis.com/v1/namespaces/").concat(deployConfigRaw.projectId, "/jobs/").concat((0, jobName_1.getCloudRunJobName)(fullName, name), ":run")];
|
|
120
120
|
})) : {};
|
|
121
121
|
return __assign(__assign(__assign({
|
|
122
|
-
|
|
122
|
+
HOSTNAME_INTERNAL: HOSTNAME_INTERNAL
|
|
123
123
|
}, getCloudSqlVariables(ctx)), jobTriggers), {
|
|
124
124
|
DEPLOY_CLOUD_RUN_PROJECT_ID: deployConfigRaw ? deployConfigRaw.projectId : undefined,
|
|
125
125
|
DEPLOY_CLOUD_RUN_REGION: deployConfigRaw ? deployConfigRaw.region : undefined
|
|
@@ -17,7 +17,7 @@ var hasKubernetesCloudSQL = function (context) {
|
|
|
17
17
|
};
|
|
18
18
|
exports.hasKubernetesCloudSQL = hasKubernetesCloudSQL;
|
|
19
19
|
var createKubernetesCloudsqlBaseValues = function (context) {
|
|
20
|
-
var _a, _b, _c
|
|
20
|
+
var _a, _b, _c;
|
|
21
21
|
var deployConfig = (_a = context.deploy) === null || _a === void 0 ? void 0 : _a.config;
|
|
22
22
|
if (!(0, types_1.isOfDeployType)(deployConfig, "kubernetes")) {
|
|
23
23
|
throw new Error("cannot get cloud sql config");
|
|
@@ -27,22 +27,11 @@ var createKubernetesCloudsqlBaseValues = function (context) {
|
|
|
27
27
|
throw new Error("cannot get cloud sql config");
|
|
28
28
|
}
|
|
29
29
|
var proxyCredentials = "$".concat((0, context_1.getSecretVarNameForContext)(context, "cloudsqlProxyCredentials"));
|
|
30
|
-
if (
|
|
31
|
-
var instanceConnectionName = "".concat((_c = config.projectId) !== null && _c !== void 0 ? _c : "skynet-164509", ":").concat((_d = config.region) !== null && _d !== void 0 ? _d : "europe-west6", ":").concat((_e = config.instanceId) !== null && _e !== void 0 ? _e : context.environment.envVars.KUBE_NAMESPACE);
|
|
32
|
-
return {
|
|
33
|
-
cloudsql: {
|
|
34
|
-
enabled: config.enabled,
|
|
35
|
-
dbUser: "postgres",
|
|
36
|
-
instanceConnectionName: instanceConnectionName,
|
|
37
|
-
proxyCredentials: proxyCredentials,
|
|
38
|
-
fullDbName: (_f = context.environment.envVars.KUBE_APP_NAME) !== null && _f !== void 0 ? _f : ""
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
} else if (config.type === "unmanaged") {
|
|
30
|
+
if (config.type === "unmanaged") {
|
|
42
31
|
return {
|
|
43
32
|
cloudsql: {
|
|
44
33
|
enabled: config.enabled,
|
|
45
|
-
dbUser: (
|
|
34
|
+
dbUser: (_c = config.dbUser) !== null && _c !== void 0 ? _c : "postgres",
|
|
46
35
|
instanceConnectionName: config.instanceConnectionName,
|
|
47
36
|
proxyCredentials: proxyCredentials,
|
|
48
37
|
fullDbName: (0, utils_1.getFullDbName)(config, context.fullConfig, context.environment.slugPrefix, context.name)
|
|
@@ -77,9 +77,7 @@ var createKubernetesDeployJobs = function (context) {
|
|
|
77
77
|
KUBE_DOCKER_IMAGE_PULL_SECRET: "gitlab-registry-".concat(context.name),
|
|
78
78
|
HELM_GITLAB_CHART_NAME: (_b = deployConfig.chartName) !== null && _b !== void 0 ? _b : "/helm-charts/the-panter-chart",
|
|
79
79
|
HELM_ARGS: __spreadArray(__spreadArray([], __read(deployConfig.debug ? ["--debug"] : []), false), __read((_c = deployConfig.additionalHelmArgs) !== null && _c !== void 0 ? _c : []), false).join(" "),
|
|
80
|
-
COMPONENT_NAME: context.name
|
|
81
|
-
/** @deprecated */
|
|
82
|
-
BUILD_ID: context.environment.envVars.BUILD_INFO_BUILD_ID
|
|
80
|
+
COMPONENT_NAME: context.name
|
|
83
81
|
})
|
|
84
82
|
});
|
|
85
83
|
var clusterName = "kube-".concat(context.environment.fullName);
|
|
@@ -86,12 +86,12 @@ exports.KUBERNETES_DEPLOY_TYPE = {
|
|
|
86
86
|
var domainCanonical = deployConfigRaw && ((_b = deployConfigRaw.cluster) === null || _b === void 0 ? void 0 : _b.domainCanonical) ||
|
|
87
87
|
// for convenience, we allow clusters to define a canonical domain, because a cluster has a fixed ip and you will usually have a domain pointing to that cluster
|
|
88
88
|
fullConfig.domainCanonical || "panter.cloud";
|
|
89
|
-
var
|
|
89
|
+
var HOSTNAME_INTERNAL = (0, BashExpression_1.joinBashExpressions)(__spreadArray(__spreadArray([componentSlug], __read(envType === "review" && reviewSlug ? [reviewSlug] : []), false), [env, fullConfig.appName, fullConfig.customerName, domainCanonical], false), "."); // default for kubernetes and rest
|
|
90
90
|
return {
|
|
91
91
|
KUBE_NAMESPACE: KUBE_NAMESPACE,
|
|
92
92
|
KUBE_APP_NAME: KUBE_APP_NAME,
|
|
93
93
|
KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX,
|
|
94
|
-
|
|
94
|
+
HOSTNAME_INTERNAL: HOSTNAME_INTERNAL
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
};
|
|
@@ -62,7 +62,7 @@ export declare const createKubeValues: (context: ComponentContext) => never[] |
|
|
|
62
62
|
} | undefined;
|
|
63
63
|
}> | undefined;
|
|
64
64
|
} & {
|
|
65
|
-
cloudsql?: import("../types").
|
|
65
|
+
cloudsql?: import("../types").DeployConfigKubernetesValuesCloudSQLUnmanaged | undefined;
|
|
66
66
|
mongodb?: import("../types").DeployConfigMongodb | undefined;
|
|
67
67
|
mailhog?: {
|
|
68
68
|
enabled: boolean;
|
|
@@ -73,7 +73,6 @@ export declare const createKubeValues: (context: ComponentContext) => never[] |
|
|
|
73
73
|
mapServiceUrlToEnv?: {
|
|
74
74
|
[envVar: string]: string;
|
|
75
75
|
} | undefined;
|
|
76
|
-
secretsAsFile?: string[] | undefined;
|
|
77
76
|
jobs: {
|
|
78
77
|
[k: string]: false | import("../types/base").AllowUnknownProps<{
|
|
79
78
|
command: string;
|
|
@@ -50,7 +50,6 @@ var types_1 = require("../types");
|
|
|
50
50
|
var cloudSql_1 = require("./cloudSql");
|
|
51
51
|
var kubeEnv_1 = require("./kubeEnv");
|
|
52
52
|
var mongodb_1 = require("./mongodb");
|
|
53
|
-
var processSecretsAsFiles_1 = require("./processSecretsAsFiles");
|
|
54
53
|
var createAppConfig = function (context, application) {
|
|
55
54
|
if (application === false) {
|
|
56
55
|
return {
|
|
@@ -114,10 +113,10 @@ var createKubeValues = function (context) {
|
|
|
114
113
|
env: env,
|
|
115
114
|
application: createAppConfig(context, application)
|
|
116
115
|
}, (0, cloudSql_1.hasKubernetesCloudSQL)(context) ? (0, cloudSql_1.createKubernetesCloudsqlBaseValues)(context) : {}, ((_c = (_b = deployConfig.values) === null || _b === void 0 ? void 0 : _b.mongodb) === null || _c === void 0 ? void 0 : _c.enabled) ? (0, mongodb_1.createMongodbBaseConfig)(context) : {});
|
|
117
|
-
var kubeValues = (0,
|
|
116
|
+
var kubeValues = (0, utils_1.mergeWithMergingArrays)(defaultKubeValues, __assign({
|
|
118
117
|
jobs: removeFalsy(jobs),
|
|
119
118
|
cronjobs: removeFalsy(cronjobs)
|
|
120
|
-
}, rest))
|
|
119
|
+
}, rest));
|
|
121
120
|
return kubeValues;
|
|
122
121
|
};
|
|
123
122
|
exports.createKubeValues = createKubeValues;
|
|
@@ -20,12 +20,6 @@ export type DeployConfigBase = {
|
|
|
20
20
|
* Can curently not reference other variables from other components
|
|
21
21
|
*/
|
|
22
22
|
jobVars?: EnvVars;
|
|
23
|
-
/**
|
|
24
|
-
* additional env vars for the deploy job
|
|
25
|
-
*
|
|
26
|
-
* @deprecated use deploy.jobVars for deploy job specific variables
|
|
27
|
-
*/
|
|
28
|
-
extraVars?: Record<string, string>;
|
|
29
23
|
/**
|
|
30
24
|
* additional vars only for the runner.
|
|
31
25
|
* Also if you use services: that require env vars, you need to set them here.
|
|
@@ -152,32 +152,6 @@ export type DeployConfigMongodbReplicaset = {
|
|
|
152
152
|
replicaCount?: number;
|
|
153
153
|
};
|
|
154
154
|
export type DeployConfigMongodb = DeployConfigMongodbBase & (DeployConfigMongodbStandalone | DeployConfigMongodbReplicaset);
|
|
155
|
-
/**
|
|
156
|
-
* @deprecated use config with instanceConnectionName
|
|
157
|
-
*/
|
|
158
|
-
type DeployConfigKubernetesValuesCloudSQLLegacy = {
|
|
159
|
-
enabled: boolean;
|
|
160
|
-
/**
|
|
161
|
-
* @deprecated use config with instanceConnectionName
|
|
162
|
-
*/
|
|
163
|
-
instanceId?: string;
|
|
164
|
-
/**
|
|
165
|
-
* @deprecated use config with instanceConnectionName
|
|
166
|
-
*/
|
|
167
|
-
projectId?: string;
|
|
168
|
-
/**
|
|
169
|
-
* @deprecated use config with instanceConnectionName
|
|
170
|
-
*/
|
|
171
|
-
region?: string;
|
|
172
|
-
/**
|
|
173
|
-
* @deprecated use type "unmanaged".
|
|
174
|
-
*
|
|
175
|
-
* Be aware that "unmanaged" is not fully backward compatible with "legacy".
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
*/
|
|
179
|
-
type?: "legacy";
|
|
180
|
-
};
|
|
181
155
|
export type DeployConfigKubernetesValuesCloudSQLUnmanaged = {
|
|
182
156
|
enabled: boolean;
|
|
183
157
|
instanceConnectionName: string;
|
|
@@ -204,7 +178,7 @@ export type DeployConfigKubernetesValuesCloudSQLUnmanaged = {
|
|
|
204
178
|
*/
|
|
205
179
|
dbBaseName?: string;
|
|
206
180
|
};
|
|
207
|
-
export type DeployConfigKubernetesValuesCloudSQL =
|
|
181
|
+
export type DeployConfigKubernetesValuesCloudSQL = DeployConfigKubernetesValuesCloudSQLUnmanaged;
|
|
208
182
|
export type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
209
183
|
/**
|
|
210
184
|
* enable cloudsql db. Currently you have to manually set it up
|
|
@@ -323,13 +297,6 @@ export type DeployConfigKubernetesValues = AllowUnknownProps<{
|
|
|
323
297
|
mapServiceUrlToEnv?: {
|
|
324
298
|
[envVar: string]: string;
|
|
325
299
|
};
|
|
326
|
-
/**
|
|
327
|
-
* Mount secrets as files in the filesystem.
|
|
328
|
-
* These secrets are still available as env vars, but will contain the path of the file instead
|
|
329
|
-
*
|
|
330
|
-
* @deprecated this will be removed in the future, because its very niche and not used
|
|
331
|
-
*/
|
|
332
|
-
secretsAsFile?: string[];
|
|
333
300
|
}>;
|
|
334
301
|
export type DeployConfigKubernetes = {
|
|
335
302
|
type: "kubernetes";
|
|
@@ -235,7 +235,6 @@ var makeGitlabJob = function (context, job, allJobs, baseRules) {
|
|
|
235
235
|
var environment = job.environment,
|
|
236
236
|
envMode = job.envMode,
|
|
237
237
|
needsStages = job.needsStages,
|
|
238
|
-
needsOtherComponent = job.needsOtherComponent,
|
|
239
238
|
name = job.name,
|
|
240
239
|
needs = job.needs,
|
|
241
240
|
jobTags = job.jobTags,
|
|
@@ -243,7 +242,7 @@ var makeGitlabJob = function (context, job, allJobs, baseRules) {
|
|
|
243
242
|
variables = job.variables,
|
|
244
243
|
runnerVariables = job.runnerVariables,
|
|
245
244
|
when = job.when,
|
|
246
|
-
rest = __rest(job, ["environment", "envMode", "needsStages", "
|
|
245
|
+
rest = __rest(job, ["environment", "envMode", "needsStages", "name", "needs", "jobTags", "script", "variables", "runnerVariables", "when"]);
|
|
247
246
|
var stage = envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(context.env) : job.stage;
|
|
248
247
|
var deduplicatedGitlabNeeds = getGitlabNeeds(context, job, allJobs);
|
|
249
248
|
var fullJobName = getFullJobName({
|
|
@@ -364,8 +363,7 @@ function deduplicateNeeds(needs) {
|
|
|
364
363
|
}
|
|
365
364
|
function getGitlabNeedsForComponentJob(context, _a, allJobs) {
|
|
366
365
|
var needsStages = _a.needsStages,
|
|
367
|
-
needs = _a.needs
|
|
368
|
-
needsOtherComponent = _a.needsOtherComponent;
|
|
366
|
+
needs = _a.needs;
|
|
369
367
|
var needsFromStages = needsStages === null || needsStages === void 0 ? void 0 : needsStages.flatMap(function (n) {
|
|
370
368
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
371
369
|
var componentName = context.name;
|
|
@@ -407,7 +405,7 @@ function getGitlabNeedsForComponentJob(context, _a, allJobs) {
|
|
|
407
405
|
});
|
|
408
406
|
}
|
|
409
407
|
});
|
|
410
|
-
var cleanedNeeds = __spreadArray(__spreadArray(
|
|
408
|
+
var cleanedNeeds = __spreadArray(__spreadArray([], __read(needsFromStages !== null && needsFromStages !== void 0 ? needsFromStages : []), false), __read(needs !== null && needs !== void 0 ? needs : []), false);
|
|
411
409
|
return cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
|
|
412
410
|
var _a;
|
|
413
411
|
return (0, lodash_1.isObject)(n) ? "workspaceName" in n ? {
|