@catladder/cli 0.0.0-refactor-needs-c896b98e → 0.0.0-refactor-args-30342529
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/apps/cli/commands/cloudSQL/commandRestoreDb.js +42 -26
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js.map +1 -1
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +9 -6
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
- package/dist/bundles/catenv/index.js +76 -48
- package/dist/bundles/cli/index.js +127 -80
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +17 -2
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +6 -2
|
@@ -159,7 +159,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
159
159
|
.command("cloud-sql-restore-db", "restore a db from one source to another target")
|
|
160
160
|
.action(function restoreDb() {
|
|
161
161
|
return __awaiter(this, void 0, void 0, function () {
|
|
162
|
-
var sourceInstance, sourceProxy, targetProxy, sourcePort, targetPort, sourceLocalPort, sourcePassword, sourceDbName, targetInstance, targetLocalPort, targetPassword, targetDbName, shouldContinue, targetPSQL, copyDBScript;
|
|
162
|
+
var sourceInstance, sourceProxy, targetProxy, sourcePort, targetPort, sourceLocalPort, sourceUsername, sourcePassword, sourceDbName, targetInstance, targetLocalPort, targetUsername, targetPassword, targetDbName, shouldContinue, targetPSQL, copyDBScript;
|
|
163
163
|
return __generator(this, function (_a) {
|
|
164
164
|
switch (_a.label) {
|
|
165
165
|
case 0: return [4 /*yield*/, this.prompt({
|
|
@@ -188,82 +188,98 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
188
188
|
_a.label = 5;
|
|
189
189
|
case 5: return [4 /*yield*/, this.prompt({
|
|
190
190
|
type: "input",
|
|
191
|
-
name: "
|
|
192
|
-
|
|
191
|
+
name: "sourceUsername",
|
|
192
|
+
"default": "postgres",
|
|
193
|
+
message: "Source Username? 🤔 "
|
|
193
194
|
})];
|
|
194
195
|
case 6:
|
|
196
|
+
sourceUsername = (_a.sent()).sourceUsername;
|
|
197
|
+
return [4 /*yield*/, this.prompt({
|
|
198
|
+
type: "input",
|
|
199
|
+
name: "sourcePassword",
|
|
200
|
+
message: "Source Password? 🤔 "
|
|
201
|
+
})];
|
|
202
|
+
case 7:
|
|
195
203
|
sourcePassword = (_a.sent()).sourcePassword;
|
|
196
204
|
return [4 /*yield*/, this.prompt({
|
|
197
205
|
type: "input",
|
|
198
206
|
name: "sourceDbName",
|
|
199
207
|
message: "Source DB name? 🤔 "
|
|
200
208
|
})];
|
|
201
|
-
case
|
|
209
|
+
case 8:
|
|
202
210
|
sourceDbName = (_a.sent()).sourceDbName;
|
|
203
211
|
return [4 /*yield*/, this.prompt({
|
|
204
212
|
type: "input",
|
|
205
213
|
name: "targetInstance",
|
|
206
214
|
message: "Targe INSTANCE (connection string or 'local')? 🤔 "
|
|
207
215
|
})];
|
|
208
|
-
case
|
|
216
|
+
case 9:
|
|
209
217
|
targetInstance = (_a.sent()).targetInstance;
|
|
210
|
-
if (!(targetInstance === "local")) return [3 /*break*/,
|
|
218
|
+
if (!(targetInstance === "local")) return [3 /*break*/, 11];
|
|
211
219
|
return [4 /*yield*/, this.prompt({
|
|
212
220
|
type: "number",
|
|
213
221
|
name: "targetLocalPort",
|
|
214
222
|
"default": 5432,
|
|
215
223
|
message: "Local Port for target? 🤔 "
|
|
216
224
|
})];
|
|
217
|
-
case
|
|
225
|
+
case 10:
|
|
218
226
|
targetLocalPort = (_a.sent()).targetLocalPort;
|
|
219
227
|
targetPort = targetLocalPort;
|
|
220
|
-
return [3 /*break*/,
|
|
221
|
-
case
|
|
228
|
+
return [3 /*break*/, 13];
|
|
229
|
+
case 11:
|
|
222
230
|
targetPort = 54499;
|
|
223
231
|
return [4 /*yield*/, createProxy(targetInstance, targetPort)];
|
|
224
|
-
case
|
|
232
|
+
case 12:
|
|
225
233
|
targetProxy = _a.sent();
|
|
226
|
-
_a.label =
|
|
227
|
-
case
|
|
234
|
+
_a.label = 13;
|
|
235
|
+
case 13: return [4 /*yield*/, this.prompt({
|
|
228
236
|
type: "input",
|
|
229
|
-
name: "
|
|
230
|
-
|
|
237
|
+
name: "targetUsername",
|
|
238
|
+
"default": "postgres",
|
|
239
|
+
message: "Target Username? 🤔 "
|
|
231
240
|
})];
|
|
232
|
-
case
|
|
241
|
+
case 14:
|
|
242
|
+
targetUsername = (_a.sent()).targetUsername;
|
|
243
|
+
return [4 /*yield*/, this.prompt({
|
|
244
|
+
type: "input",
|
|
245
|
+
name: "targetPassword",
|
|
246
|
+
message: "Target Password? 🤔 "
|
|
247
|
+
})];
|
|
248
|
+
case 15:
|
|
233
249
|
targetPassword = (_a.sent()).targetPassword;
|
|
234
250
|
return [4 /*yield*/, this.prompt({
|
|
235
251
|
type: "input",
|
|
236
252
|
name: "targetDbName",
|
|
237
253
|
message: "Target DB name? 🤔 "
|
|
238
254
|
})];
|
|
239
|
-
case
|
|
255
|
+
case 16:
|
|
240
256
|
targetDbName = (_a.sent()).targetDbName;
|
|
241
257
|
return [4 /*yield*/, this.prompt({
|
|
242
258
|
type: "confirm",
|
|
243
259
|
name: "shouldContinue",
|
|
244
260
|
message: "This will drop ".concat(targetInstance, "/").concat(targetDbName, " and replace it with ").concat(sourceInstance, "/").concat(sourceDbName, ". Continue? \uD83E\uDD14 ")
|
|
245
261
|
})];
|
|
246
|
-
case
|
|
262
|
+
case 17:
|
|
247
263
|
shouldContinue = (_a.sent()).shouldContinue;
|
|
248
264
|
if (!shouldContinue) {
|
|
249
265
|
return [2 /*return*/];
|
|
250
266
|
}
|
|
251
267
|
targetPSQL = function (command) {
|
|
252
|
-
return "PGPASSWORD=".concat(targetPassword, " psql -p ").concat(targetPort, " --host=localhost --user=
|
|
268
|
+
return "PGPASSWORD=".concat(targetPassword, " psql -p ").concat(targetPort, " --host=localhost --user=").concat(targetUsername, " -q ").concat(command);
|
|
253
269
|
};
|
|
254
|
-
copyDBScript = "\n set -e\n \n \n\n dumptmp=$(mktemp /tmp/dump.XXXXXX)\n\n echo \"Dumping file to $dumptmp\"\n pg_dump --dbname=postgres://
|
|
255
|
-
_a.label =
|
|
256
|
-
case
|
|
257
|
-
_a.trys.push([
|
|
270
|
+
copyDBScript = "\n set -e\n \n \n\n dumptmp=$(mktemp /tmp/dump.XXXXXX)\n\n echo \"Dumping file to $dumptmp\"\n pg_dump --dbname=postgres://".concat(sourceUsername, ":").concat(sourcePassword, "@localhost:").concat(sourcePort, "/").concat(sourceDbName, " --no-owner --no-privileges > $dumptmp\n echo \"dump done\"\n ").concat(targetPSQL("-c 'drop database \"".concat(targetDbName, "\" WITH (FORCE)' 1> /dev/null || true")), "\n ").concat(targetPSQL("-c 'create database \"".concat(targetDbName, "\"' 1> /dev/null")), "\n echo \"Restoring dump...\"\n ").concat(targetPSQL("\"".concat(targetDbName, "\" < $dumptmp 1> /dev/null")), "\n \n\n echo \"Clean up...\"\n set +e\n rm $dumptmp\n echo \"\n\uD83D\uDC31 Done!\"\n ");
|
|
271
|
+
_a.label = 18;
|
|
272
|
+
case 18:
|
|
273
|
+
_a.trys.push([18, , 20, 21]);
|
|
258
274
|
return [4 /*yield*/, (0, child_process_promise_1.spawn)(copyDBScript, [], { shell: "bash", stdio: "inherit" })];
|
|
259
|
-
case
|
|
275
|
+
case 19:
|
|
260
276
|
_a.sent();
|
|
261
|
-
return [3 /*break*/,
|
|
262
|
-
case
|
|
277
|
+
return [3 /*break*/, 21];
|
|
278
|
+
case 20:
|
|
263
279
|
sourceProxy === null || sourceProxy === void 0 ? void 0 : sourceProxy.stop();
|
|
264
280
|
targetProxy === null || targetProxy === void 0 ? void 0 : targetProxy.stop();
|
|
265
281
|
return [7 /*endfinally*/];
|
|
266
|
-
case
|
|
282
|
+
case 21: return [2 /*return*/];
|
|
267
283
|
}
|
|
268
284
|
});
|
|
269
285
|
});
|
|
@@ -1466,7 +1482,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
1466
1482
|
.action(function (_a) {
|
|
1467
1483
|
var envComponent = _a.envComponent;
|
|
1468
1484
|
return __awaiter(this, void 0, void 0, function () {
|
|
1469
|
-
var _b, env, componentName, context, proxyInfo, DB_PASSWORD, DB_NAME, instanceName, localPort, cloudsqlProxyCredentials;
|
|
1485
|
+
var _b, env, componentName, context, proxyInfo, DB_PASSWORD, DB_NAME, DB_USER, instanceName, localPort, cloudsqlProxyCredentials;
|
|
1470
1486
|
var _this = this;
|
|
1471
1487
|
return __generator(this, function (_c) {
|
|
1472
1488
|
switch (_c.label) {
|
|
@@ -1491,7 +1507,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
1491
1507
|
return [3 /*break*/, 6];
|
|
1492
1508
|
case 5: throw new Error("unsupported environment");
|
|
1493
1509
|
case 6:
|
|
1494
|
-
DB_PASSWORD = proxyInfo.DB_PASSWORD, DB_NAME = proxyInfo.DB_NAME, instanceName = proxyInfo.instanceName;
|
|
1510
|
+
DB_PASSWORD = proxyInfo.DB_PASSWORD, DB_NAME = proxyInfo.DB_NAME, DB_USER = proxyInfo.DB_USER, instanceName = proxyInfo.instanceName;
|
|
1495
1511
|
return [4 /*yield*/, this.prompt({
|
|
1496
1512
|
type: "number",
|
|
1497
1513
|
name: "localPort",
|
|
@@ -1503,7 +1519,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
1503
1519
|
this.log("");
|
|
1504
1520
|
this.log("postgres-PW: ".concat(DB_PASSWORD));
|
|
1505
1521
|
this.log("");
|
|
1506
|
-
this.log("POSTGRESQL_URL=postgresql://
|
|
1522
|
+
this.log("POSTGRESQL_URL=postgresql://".concat(DB_USER, ":").concat(DB_PASSWORD, "@localhost:").concat(localPort, "/").concat(DB_NAME, "?schema=public"));
|
|
1507
1523
|
this.log("");
|
|
1508
1524
|
return [4 /*yield*/, (0, getProjectConfig_1.getGitlabVar)(this, env, componentName, "cloudsqlProxyCredentials")];
|
|
1509
1525
|
case 8:
|
|
@@ -1570,13 +1586,14 @@ var getProxyInfoForKubernetes = function (context) { return __awaiter(void 0, vo
|
|
|
1570
1586
|
return [2 /*return*/, {
|
|
1571
1587
|
instanceName: instanceName,
|
|
1572
1588
|
DB_PASSWORD: DB_PASSWORD,
|
|
1573
|
-
DB_NAME: DB_NAME
|
|
1589
|
+
DB_NAME: DB_NAME,
|
|
1590
|
+
DB_USER: "postgres"
|
|
1574
1591
|
}];
|
|
1575
1592
|
}
|
|
1576
1593
|
});
|
|
1577
1594
|
}); };
|
|
1578
1595
|
var getProxyInfoForCloudRun = function (context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1579
|
-
var envVars, DB_PASSWORD, DB_NAME;
|
|
1596
|
+
var envVars, DB_PASSWORD, DB_USER, DB_NAME;
|
|
1580
1597
|
return __generator(this, function (_a) {
|
|
1581
1598
|
switch (_a.label) {
|
|
1582
1599
|
case 0:
|
|
@@ -1588,11 +1605,13 @@ var getProxyInfoForCloudRun = function (context) { return __awaiter(void 0, void
|
|
|
1588
1605
|
case 1:
|
|
1589
1606
|
envVars = _a.sent();
|
|
1590
1607
|
DB_PASSWORD = envVars === null || envVars === void 0 ? void 0 : envVars.DB_PASSWORD;
|
|
1608
|
+
DB_USER = envVars === null || envVars === void 0 ? void 0 : envVars.DB_USER;
|
|
1591
1609
|
DB_NAME = context.environment.envVars.DB_NAME;
|
|
1592
1610
|
return [2 /*return*/, {
|
|
1593
1611
|
instanceName: context.componentConfig.deploy.cloudSql.instanceConnectionName,
|
|
1594
1612
|
DB_PASSWORD: DB_PASSWORD,
|
|
1595
|
-
DB_NAME: DB_NAME
|
|
1613
|
+
DB_NAME: DB_NAME,
|
|
1614
|
+
DB_USER: DB_USER
|
|
1596
1615
|
}];
|
|
1597
1616
|
}
|
|
1598
1617
|
});
|
|
@@ -350421,9 +350440,15 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
350421
350440
|
}
|
|
350422
350441
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
350423
350442
|
};
|
|
350443
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
350444
|
+
return mod && mod.__esModule ? mod : {
|
|
350445
|
+
"default": mod
|
|
350446
|
+
};
|
|
350447
|
+
};
|
|
350424
350448
|
exports.__esModule = true;
|
|
350425
350449
|
exports.getNextCache = exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void 0;
|
|
350426
350450
|
var path_1 = __nccwpck_require__(71017);
|
|
350451
|
+
var slugify_1 = __importDefault(__nccwpck_require__(44035));
|
|
350427
350452
|
var getYarnCache = function (context, policy) {
|
|
350428
350453
|
var _a;
|
|
350429
350454
|
if (policy === void 0) {
|
|
@@ -350435,7 +350460,7 @@ var getYarnCache = function (context, policy) {
|
|
|
350435
350460
|
policy: policy,
|
|
350436
350461
|
paths: [".yarn"]
|
|
350437
350462
|
} : {
|
|
350438
|
-
key: context.componentConfig.dir + "-yarn",
|
|
350463
|
+
key: (0, slugify_1["default"])(context.componentConfig.dir) + "-yarn",
|
|
350439
350464
|
policy: policy,
|
|
350440
350465
|
paths: [(0, path_1.join)(context.componentConfig.dir, ".yarn")]
|
|
350441
350466
|
}];
|
|
@@ -350447,9 +350472,11 @@ var getNodeModulesCache = function (context, policy) {
|
|
|
350447
350472
|
policy = "pull-push";
|
|
350448
350473
|
}
|
|
350449
350474
|
var componentIsInWorkspace = (_a = context.packageManagerInfo) === null || _a === void 0 ? void 0 : _a.componentIsInWorkspace;
|
|
350475
|
+
// We intentionally do not use the contents of yarn.lock as a cache key, as yarn install should always guarantee that the files are updated, but it can still use part of the cache if not all packages are up-to-date.
|
|
350476
|
+
// It would slow down all pipelines whenever one adds a new dependency as it will need to download all node_modules again.
|
|
350450
350477
|
return [{
|
|
350451
350478
|
// if component is in a shared workspace, use workspace cache. use individual cache else
|
|
350452
|
-
key: componentIsInWorkspace ? "node-modules-workspace" : context.componentConfig.dir + "-node-modules",
|
|
350479
|
+
key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1["default"])(context.componentConfig.dir) + "-node-modules",
|
|
350453
350480
|
policy: policy,
|
|
350454
350481
|
paths: __spreadArray([], __read(componentIsInWorkspace ? __spreadArray(["node_modules"], __read((_c = (_b = context.packageManagerInfo) === null || _b === void 0 ? void 0 : _b.workspaces.map(function (w) {
|
|
350455
350482
|
return (0, path_1.join)(w.location, "node_modules");
|
|
@@ -350949,8 +350976,9 @@ var createRailsTestJobs = function (context) {
|
|
|
350949
350976
|
var bundlerCache = {
|
|
350950
350977
|
key: {
|
|
350951
350978
|
files: ["Gemfile.lock"],
|
|
350952
|
-
prefix: "$CI_JOB_IMAGE"
|
|
350979
|
+
prefix: "$CI_JOB_IMAGE" // a changed image might have different OS libraries which no longer work with the cached gems
|
|
350953
350980
|
},
|
|
350981
|
+
|
|
350954
350982
|
paths: [bundlerCacheDir]
|
|
350955
350983
|
};
|
|
350956
350984
|
var auditJob = buildConfig.audit !== false ? __assign(__assign({
|
|
@@ -351171,7 +351199,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
351171
351199
|
|
|
351172
351200
|
exports.__esModule = true;
|
|
351173
351201
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
351174
|
-
exports.PIPELINE_IMAGE_TAG = "refactor-
|
|
351202
|
+
exports.PIPELINE_IMAGE_TAG = "refactor-args-30342529" || 0;
|
|
351175
351203
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
351176
351204
|
|
|
351177
351205
|
/***/ }),
|
|
@@ -352228,7 +352256,7 @@ var getBaseDeploymentJob = function (context) {
|
|
|
352228
352256
|
return {
|
|
352229
352257
|
name: exports.DEPLOY_JOB_NAME,
|
|
352230
352258
|
envMode: "stagePerEnv",
|
|
352231
|
-
|
|
352259
|
+
needsOtherComponent: context.componentConfig.deploy ? (_c = (_b = context.componentConfig.deploy.waitFor) === null || _b === void 0 ? void 0 : _b.map(function (c) {
|
|
352232
352260
|
return {
|
|
352233
352261
|
componentName: c,
|
|
352234
352262
|
job: exports.DEPLOY_JOB_NAME,
|
|
@@ -352379,9 +352407,9 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
352379
352407
|
value = _b[1];
|
|
352380
352408
|
return "".concat(key, "=").concat(value);
|
|
352381
352409
|
}).join(",");
|
|
352382
|
-
var commonArgs = "--project
|
|
352410
|
+
var commonArgs = "--project=".concat(deployConfig.projectId, " --region=").concat(deployConfig.region);
|
|
352383
352411
|
var cloudRunArgs = deployConfig.cloudSql ? "--set-cloudsql-instances=".concat(deployConfig.cloudSql.instanceConnectionName) : "";
|
|
352384
|
-
var commonDeployArgs = "--image
|
|
352412
|
+
var commonDeployArgs = "--image=".concat(gcloudImageName, " ").concat(commonArgs, " ").concat(cloudRunArgs, " --labels=").concat(labelsString);
|
|
352385
352413
|
var serviceName = context.environment.fullName.toLowerCase();
|
|
352386
352414
|
var getFullJobName = function (name) {
|
|
352387
352415
|
return (0, jobName_1.getCloudRunJobName)(context.environment.fullName, name);
|
|
@@ -352574,7 +352602,7 @@ var jobName_1 = __nccwpck_require__(77311);
|
|
|
352574
352602
|
exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
|
|
352575
352603
|
exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
|
|
352576
352604
|
var getCloudSqlVariables = function (_a) {
|
|
352577
|
-
var _b, _c;
|
|
352605
|
+
var _b, _c, _d;
|
|
352578
352606
|
var deployConfigRaw = _a.deployConfigRaw,
|
|
352579
352607
|
environmentSlug = _a.environmentSlug,
|
|
352580
352608
|
env = _a.env,
|
|
@@ -352591,7 +352619,7 @@ var getCloudSqlVariables = function (_a) {
|
|
|
352591
352619
|
return {
|
|
352592
352620
|
CLOUD_SQL_INSTANCE_CONNECTION_NAME: deployConfigRaw.cloudSql.instanceConnectionName,
|
|
352593
352621
|
DB_NAME: DB_NAME,
|
|
352594
|
-
DB_USER: "postgres",
|
|
352622
|
+
DB_USER: (_d = deployConfigRaw.cloudSql.dbUser) !== null && _d !== void 0 ? _d : "postgres",
|
|
352595
352623
|
DB_PASSWORD: "$" + (0, context_1.getSecretVarName)(env, componentName, "DB_PASSWORD"),
|
|
352596
352624
|
DATABASE_URL: "postgresql://$DB_USER:$DB_PASSWORD@localhost/$DB_NAME?host=/cloudsql/$CLOUD_SQL_INSTANCE_CONNECTION_NAME".concat(additionalQueryParamsString),
|
|
352597
352625
|
DATABASE_JDBC_URL: "jdbc:postgresql:///$DB_NAME?cloudSqlInstance=$CLOUD_SQL_INSTANCE_CONNECTION_NAME&socketFactory=com.google.cloud.sql.postgres.SocketFactory&user=$DB_USER&password=$DB_PASSWORD".concat(additionalQueryParamsString)
|
|
@@ -353257,6 +353285,16 @@ exports.createKubeEnv = createKubeEnv;
|
|
|
353257
353285
|
"use strict";
|
|
353258
353286
|
|
|
353259
353287
|
|
|
353288
|
+
var __assign = this && this.__assign || function () {
|
|
353289
|
+
__assign = Object.assign || function (t) {
|
|
353290
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
353291
|
+
s = arguments[i];
|
|
353292
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
353293
|
+
}
|
|
353294
|
+
return t;
|
|
353295
|
+
};
|
|
353296
|
+
return __assign.apply(this, arguments);
|
|
353297
|
+
};
|
|
353260
353298
|
var __rest = this && this.__rest || function (s, e) {
|
|
353261
353299
|
var t = {};
|
|
353262
353300
|
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p];
|
|
@@ -353265,6 +353303,28 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
353265
353303
|
}
|
|
353266
353304
|
return t;
|
|
353267
353305
|
};
|
|
353306
|
+
var __read = this && this.__read || function (o, n) {
|
|
353307
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
353308
|
+
if (!m) return o;
|
|
353309
|
+
var i = m.call(o),
|
|
353310
|
+
r,
|
|
353311
|
+
ar = [],
|
|
353312
|
+
e;
|
|
353313
|
+
try {
|
|
353314
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
353315
|
+
} catch (error) {
|
|
353316
|
+
e = {
|
|
353317
|
+
error: error
|
|
353318
|
+
};
|
|
353319
|
+
} finally {
|
|
353320
|
+
try {
|
|
353321
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
353322
|
+
} finally {
|
|
353323
|
+
if (e) throw e.error;
|
|
353324
|
+
}
|
|
353325
|
+
}
|
|
353326
|
+
return ar;
|
|
353327
|
+
};
|
|
353268
353328
|
exports.__esModule = true;
|
|
353269
353329
|
exports.createKubeValues = void 0;
|
|
353270
353330
|
var lodash_1 = __nccwpck_require__(23255);
|
|
@@ -353305,6 +353365,14 @@ var createAppConfig = function (context, application) {
|
|
|
353305
353365
|
);
|
|
353306
353366
|
};
|
|
353307
353367
|
|
|
353368
|
+
var removeFalsy = function (record) {
|
|
353369
|
+
if (!record) return undefined;
|
|
353370
|
+
return Object.fromEntries(Object.entries(record).filter(function (_a) {
|
|
353371
|
+
var _b = __read(_a, 2),
|
|
353372
|
+
value = _b[1];
|
|
353373
|
+
return value !== false;
|
|
353374
|
+
}));
|
|
353375
|
+
};
|
|
353308
353376
|
var createKubeValues = function (context) {
|
|
353309
353377
|
var _a, _b;
|
|
353310
353378
|
var deployConfig = context.componentConfig.deploy;
|
|
@@ -353321,13 +353389,18 @@ var createKubeValues = function (context) {
|
|
|
353321
353389
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
353322
353390
|
var _c = values !== null && values !== void 0 ? values : {},
|
|
353323
353391
|
application = _c.application,
|
|
353324
|
-
|
|
353392
|
+
jobs = _c.jobs,
|
|
353393
|
+
cronjobs = _c.cronjobs,
|
|
353394
|
+
rest = __rest(_c, ["application", "jobs", "cronjobs"]);
|
|
353325
353395
|
var env = (0, kubeEnv_1.createKubeEnv)(context);
|
|
353326
353396
|
var defaultKubeValues = (0, lodash_1.merge)({
|
|
353327
353397
|
env: env,
|
|
353328
353398
|
application: createAppConfig(context, application)
|
|
353329
353399
|
}, (0, cloudSql_1.hasKubernetesCloudSQL)(context) ? (0, cloudSql_1.createCloudsqlBaseConfig)(context) : {}, ((_b = (_a = deployConfig.values) === null || _a === void 0 ? void 0 : _a.mongodb) === null || _b === void 0 ? void 0 : _b.enabled) ? (0, mongodb_1.createMongodbBaseConfig)(context) : {});
|
|
353330
|
-
var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues,
|
|
353400
|
+
var kubeValues = (0, processSecretsAsFiles_1.processSecretsAsFiles)((0, utils_1.mergeWithMergingArrays)(defaultKubeValues, __assign({
|
|
353401
|
+
jobs: removeFalsy(jobs),
|
|
353402
|
+
cronjobs: removeFalsy(cronjobs)
|
|
353403
|
+
}, rest)));
|
|
353331
353404
|
return kubeValues;
|
|
353332
353405
|
};
|
|
353333
353406
|
exports.createKubeValues = createKubeValues;
|
|
@@ -354376,14 +354449,19 @@ var getFullReferencedJobName = function (referencedJobName, componentName, env,
|
|
|
354376
354449
|
var replaceReferences = function (job, componentName, env, allRawJobs) {
|
|
354377
354450
|
var _a, _b, _c;
|
|
354378
354451
|
var stage = job.envMode === "stagePerEnv" ? "".concat(job.stage, " ").concat(env) : job.stage;
|
|
354379
|
-
var
|
|
354380
|
-
var needs = cleanedNeeds === null || cleanedNeeds === void 0 ? void 0 : cleanedNeeds.map(function (n) {
|
|
354381
|
-
var _a;
|
|
354452
|
+
var needsFromNeeds = (_a = job.needs) === null || _a === void 0 ? void 0 : _a.map(function (n) {
|
|
354382
354453
|
return (0, lodash_1.isObject)(n) ? {
|
|
354383
|
-
job: getFullReferencedJobName(n.job,
|
|
354454
|
+
job: getFullReferencedJobName(n.job, componentName, env, allRawJobs),
|
|
354384
354455
|
artifacts: n.artifacts
|
|
354385
354456
|
} : getFullReferencedJobName(n, componentName, env, allRawJobs);
|
|
354386
354457
|
});
|
|
354458
|
+
var needsFromOtherComponents = (_b = job.needsOtherComponent) === null || _b === void 0 ? void 0 : _b.map(function (other) {
|
|
354459
|
+
return {
|
|
354460
|
+
artifacts: other.artifacts,
|
|
354461
|
+
job: getFullReferencedJobName(other.job, other.componentName, env, allRawJobs)
|
|
354462
|
+
};
|
|
354463
|
+
});
|
|
354464
|
+
var needs = __spreadArray(__spreadArray([], __read(needsFromNeeds !== null && needsFromNeeds !== void 0 ? needsFromNeeds : []), false), __read(needsFromOtherComponents !== null && needsFromOtherComponents !== void 0 ? needsFromOtherComponents : []), false);
|
|
354387
354465
|
return __assign(__assign({}, job), {
|
|
354388
354466
|
stage: stage,
|
|
354389
354467
|
needs: needs,
|
|
@@ -354496,37 +354574,6 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
354496
354574
|
}
|
|
354497
354575
|
return t;
|
|
354498
354576
|
};
|
|
354499
|
-
var __read = this && this.__read || function (o, n) {
|
|
354500
|
-
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
354501
|
-
if (!m) return o;
|
|
354502
|
-
var i = m.call(o),
|
|
354503
|
-
r,
|
|
354504
|
-
ar = [],
|
|
354505
|
-
e;
|
|
354506
|
-
try {
|
|
354507
|
-
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
354508
|
-
} catch (error) {
|
|
354509
|
-
e = {
|
|
354510
|
-
error: error
|
|
354511
|
-
};
|
|
354512
|
-
} finally {
|
|
354513
|
-
try {
|
|
354514
|
-
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
354515
|
-
} finally {
|
|
354516
|
-
if (e) throw e.error;
|
|
354517
|
-
}
|
|
354518
|
-
}
|
|
354519
|
-
return ar;
|
|
354520
|
-
};
|
|
354521
|
-
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
354522
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
354523
|
-
if (ar || !(i in from)) {
|
|
354524
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
354525
|
-
ar[i] = from[i];
|
|
354526
|
-
}
|
|
354527
|
-
}
|
|
354528
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
354529
|
-
};
|
|
354530
354577
|
exports.__esModule = true;
|
|
354531
354578
|
exports.makeGitlabJob = void 0;
|
|
354532
354579
|
var lodash_1 = __nccwpck_require__(23255);
|
|
@@ -354543,9 +354590,9 @@ var makeGitlabJob = function (_a) {
|
|
|
354543
354590
|
rest = __rest(_a, ["envMode", "needsStages", "needsOtherComponent", "name", "needs"]);
|
|
354544
354591
|
return __assign(__assign({}, rest), {
|
|
354545
354592
|
// sort in a predictable manner for snapshot tests
|
|
354546
|
-
needs: needs ?
|
|
354593
|
+
needs: needs === null || needs === void 0 ? void 0 : needs.sort(function (a, b) {
|
|
354547
354594
|
return getJobName(a).localeCompare(getJobName(b));
|
|
354548
|
-
})
|
|
354595
|
+
}),
|
|
354549
354596
|
retry: defaults_1.BASE_RETRY,
|
|
354550
354597
|
interruptible: true
|
|
354551
354598
|
});
|