@catladder/cli 0.0.0-refactor-image-ca767657 → 0.0.0-refactor-gcloud-auth-no-file-b43bf0d9
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/CONTRIBUTING.md +17 -12
- package/README.md +19 -12
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js +12 -7
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js.map +1 -1
- package/dist/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.d.ts +3 -0
- package/dist/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js +189 -0
- package/dist/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.js.map +1 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js +3 -0
- package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -1
- package/dist/apps/cli/commands/project/index.js +2 -0
- package/dist/apps/cli/commands/project/index.js.map +1 -1
- package/dist/bundles/catenv/index.js +549 -81
- package/dist/bundles/cli/index.js +1128 -237
- package/dist/gcloud/cloudSql/copyDb.d.ts +12 -0
- package/dist/gcloud/cloudSql/copyDb.js +64 -0
- package/dist/gcloud/cloudSql/copyDb.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +51 -2
- package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +11 -29
- package/src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts +175 -0
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +3 -0
- package/src/apps/cli/commands/project/index.ts +2 -0
- package/src/gcloud/cloudSql/copyDb.ts +57 -0
|
@@ -133,7 +133,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
135
|
exports.__esModule = true;
|
|
136
|
-
var
|
|
136
|
+
var copyDb_1 = __nccwpck_require__(45772);
|
|
137
137
|
var startProxy_1 = __nccwpck_require__(63069);
|
|
138
138
|
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
139
139
|
return __generator(this, function (_a) {
|
|
@@ -141,7 +141,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
141
141
|
.command("cloud-sql-restore-db", "restore a db from one source to another target")
|
|
142
142
|
.action(function restoreDb() {
|
|
143
143
|
return __awaiter(this, void 0, void 0, function () {
|
|
144
|
-
var sourceInstance, sourceProxy, targetProxy, sourcePort, targetPort, sourceLocalPort, sourceUsername, sourcePassword, sourceDbName, targetInstance, targetLocalPort, targetUsername, targetPassword, targetDbName, shouldContinue
|
|
144
|
+
var sourceInstance, sourceProxy, targetProxy, sourcePort, targetPort, sourceLocalPort, sourceUsername, sourcePassword, sourceDbName, targetInstance, targetLocalPort, targetUsername, targetPassword, targetDbName, shouldContinue;
|
|
145
145
|
return __generator(this, function (_a) {
|
|
146
146
|
switch (_a.label) {
|
|
147
147
|
case 0: return [4 /*yield*/, this.prompt({
|
|
@@ -252,14 +252,19 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
252
252
|
if (!shouldContinue) {
|
|
253
253
|
return [2 /*return*/];
|
|
254
254
|
}
|
|
255
|
-
targetPSQL = function (command) {
|
|
256
|
-
return "PGPASSWORD=".concat(targetPassword, " psql -p ").concat(targetPort, " --host=localhost --user=").concat(targetUsername, " -q ").concat(command);
|
|
257
|
-
};
|
|
258
|
-
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 ");
|
|
259
255
|
_a.label = 18;
|
|
260
256
|
case 18:
|
|
261
257
|
_a.trys.push([18, , 20, 21]);
|
|
262
|
-
return [4 /*yield*/, (0,
|
|
258
|
+
return [4 /*yield*/, (0, copyDb_1.spawnCopyDb)({
|
|
259
|
+
targetPassword: targetPassword,
|
|
260
|
+
targetPort: targetPort,
|
|
261
|
+
targetUsername: targetUsername,
|
|
262
|
+
sourceUsername: sourceUsername,
|
|
263
|
+
sourcePassword: sourcePassword,
|
|
264
|
+
sourcePort: sourcePort,
|
|
265
|
+
sourceDbName: sourceDbName,
|
|
266
|
+
targetDbName: targetDbName
|
|
267
|
+
})];
|
|
263
268
|
case 19:
|
|
264
269
|
_a.sent();
|
|
265
270
|
return [3 /*break*/, 21];
|
|
@@ -1400,6 +1405,202 @@ exports.getProjectMongodbAllPodsSortedWithLabel = getProjectMongodbAllPodsSorted
|
|
|
1400
1405
|
|
|
1401
1406
|
/***/ }),
|
|
1402
1407
|
|
|
1408
|
+
/***/ 38831:
|
|
1409
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
1410
|
+
|
|
1411
|
+
"use strict";
|
|
1412
|
+
|
|
1413
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1414
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1415
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1416
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1417
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1418
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1419
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1420
|
+
});
|
|
1421
|
+
};
|
|
1422
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
1423
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
1424
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
1425
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
1426
|
+
function step(op) {
|
|
1427
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
1428
|
+
while (_) try {
|
|
1429
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
1430
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
1431
|
+
switch (op[0]) {
|
|
1432
|
+
case 0: case 1: t = op; break;
|
|
1433
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
1434
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
1435
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
1436
|
+
default:
|
|
1437
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
1438
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
1439
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
1440
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
1441
|
+
if (t[2]) _.ops.pop();
|
|
1442
|
+
_.trys.pop(); continue;
|
|
1443
|
+
}
|
|
1444
|
+
op = body.call(thisArg, _);
|
|
1445
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
1446
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
1447
|
+
}
|
|
1448
|
+
};
|
|
1449
|
+
exports.__esModule = true;
|
|
1450
|
+
var getProjectConfig_1 = __nccwpck_require__(24146);
|
|
1451
|
+
var startProxy_1 = __nccwpck_require__(63069);
|
|
1452
|
+
var autocompletions_1 = __nccwpck_require__(41373);
|
|
1453
|
+
var connection_string_parser_1 = __nccwpck_require__(71004);
|
|
1454
|
+
var copyDb_1 = __nccwpck_require__(45772);
|
|
1455
|
+
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1456
|
+
return __generator(this, function (_a) {
|
|
1457
|
+
return [2 /*return*/, vorpal
|
|
1458
|
+
.command("project-cloud-sql-restore-db", "restores a project db from one source to another target")
|
|
1459
|
+
.action(function restoreDb() {
|
|
1460
|
+
var _a, _b, _c, _d;
|
|
1461
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1462
|
+
var envs, sourceEnvAndComponent, _e, sourceEnv, sourceComponent, sourceContext, sourceEnvVars, sourceProxy, sourceDbName, sourceUsername, sourcePassword, targetUsername, targetPassword, targetProxy, sourcePort, targetPort, targetDbName, closeAll, parser, parsersResult, targetEnvAndComponent, _f, targetEnv, targetComponent, targetContext, targetEnvVars, parser, parsersResult, shouldContinue, confirmInstance;
|
|
1463
|
+
return __generator(this, function (_g) {
|
|
1464
|
+
switch (_g.label) {
|
|
1465
|
+
case 0: return [4 /*yield*/, (0, autocompletions_1.envAndComponents)()];
|
|
1466
|
+
case 1:
|
|
1467
|
+
envs = _g.sent();
|
|
1468
|
+
return [4 /*yield*/, this.prompt({
|
|
1469
|
+
type: "list",
|
|
1470
|
+
name: "sourceEnvAndComponent",
|
|
1471
|
+
choices: envs,
|
|
1472
|
+
message: "Source instance (connection string or 'local')? 🤔 "
|
|
1473
|
+
})];
|
|
1474
|
+
case 2:
|
|
1475
|
+
sourceEnvAndComponent = (_g.sent()).sourceEnvAndComponent;
|
|
1476
|
+
_e = sourceEnvAndComponent.split(":"), sourceEnv = _e[0], sourceComponent = _e[1];
|
|
1477
|
+
return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(sourceEnv, sourceComponent)];
|
|
1478
|
+
case 3:
|
|
1479
|
+
sourceContext = _g.sent();
|
|
1480
|
+
return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(this, sourceContext.environment.shortName, sourceContext.componentName)];
|
|
1481
|
+
case 4:
|
|
1482
|
+
sourceEnvVars = _g.sent();
|
|
1483
|
+
closeAll = function () {
|
|
1484
|
+
sourceProxy === null || sourceProxy === void 0 ? void 0 : sourceProxy.stop();
|
|
1485
|
+
targetProxy === null || targetProxy === void 0 ? void 0 : targetProxy.stop();
|
|
1486
|
+
};
|
|
1487
|
+
if (!(sourceEnv === "local")) return [3 /*break*/, 5];
|
|
1488
|
+
parser = new connection_string_parser_1.ConnectionStringParser({
|
|
1489
|
+
scheme: "postgres",
|
|
1490
|
+
hosts: []
|
|
1491
|
+
});
|
|
1492
|
+
parsersResult = parser.parse(sourceEnvVars.DATABASE_URL);
|
|
1493
|
+
sourcePort = (_b = (_a = parsersResult.hosts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.port;
|
|
1494
|
+
sourceUsername = parsersResult.username;
|
|
1495
|
+
sourcePassword = parsersResult.password;
|
|
1496
|
+
sourceDbName = parsersResult.endpoint;
|
|
1497
|
+
return [3 /*break*/, 7];
|
|
1498
|
+
case 5:
|
|
1499
|
+
sourcePort = 54399;
|
|
1500
|
+
return [4 /*yield*/, (0, startProxy_1.startCloudSqlProxyInBackground)({
|
|
1501
|
+
instanceName: sourceEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME,
|
|
1502
|
+
localPort: sourcePort
|
|
1503
|
+
})];
|
|
1504
|
+
case 6:
|
|
1505
|
+
sourceProxy = _g.sent();
|
|
1506
|
+
sourceUsername = sourceEnvVars.DB_USER;
|
|
1507
|
+
sourcePassword = sourceEnvVars.DB_PASSWORD;
|
|
1508
|
+
sourceDbName = sourceEnvVars.DB_NAME;
|
|
1509
|
+
_g.label = 7;
|
|
1510
|
+
case 7: return [4 /*yield*/, this.prompt({
|
|
1511
|
+
type: "list",
|
|
1512
|
+
name: "targetEnvAndComponent",
|
|
1513
|
+
choices: envs,
|
|
1514
|
+
message: "target env? 🤔 "
|
|
1515
|
+
})];
|
|
1516
|
+
case 8:
|
|
1517
|
+
targetEnvAndComponent = (_g.sent()).targetEnvAndComponent;
|
|
1518
|
+
_f = targetEnvAndComponent.split(":"), targetEnv = _f[0], targetComponent = _f[1];
|
|
1519
|
+
return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(targetEnv, targetComponent)];
|
|
1520
|
+
case 9:
|
|
1521
|
+
targetContext = _g.sent();
|
|
1522
|
+
return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(this, targetContext.environment.shortName, targetContext.componentName)];
|
|
1523
|
+
case 10:
|
|
1524
|
+
targetEnvVars = _g.sent();
|
|
1525
|
+
if (!(targetEnv === "local")) return [3 /*break*/, 11];
|
|
1526
|
+
parser = new connection_string_parser_1.ConnectionStringParser({
|
|
1527
|
+
scheme: "postgres",
|
|
1528
|
+
hosts: []
|
|
1529
|
+
});
|
|
1530
|
+
parsersResult = parser.parse(targetEnvVars.DATABASE_URL);
|
|
1531
|
+
targetPort = (_d = (_c = parsersResult.hosts) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.port;
|
|
1532
|
+
targetUsername = parsersResult.username;
|
|
1533
|
+
targetPassword = parsersResult.password;
|
|
1534
|
+
targetDbName = parsersResult.endpoint;
|
|
1535
|
+
return [3 /*break*/, 13];
|
|
1536
|
+
case 11:
|
|
1537
|
+
targetPort = 54499;
|
|
1538
|
+
return [4 /*yield*/, (0, startProxy_1.startCloudSqlProxyInBackground)({
|
|
1539
|
+
instanceName: targetEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME,
|
|
1540
|
+
localPort: targetPort
|
|
1541
|
+
})];
|
|
1542
|
+
case 12:
|
|
1543
|
+
targetProxy = _g.sent();
|
|
1544
|
+
targetUsername = targetEnvVars.DB_USER;
|
|
1545
|
+
targetPassword = targetEnvVars.DB_PASSWORD;
|
|
1546
|
+
targetDbName = targetEnvVars.DB_NAME;
|
|
1547
|
+
_g.label = 13;
|
|
1548
|
+
case 13: return [4 /*yield*/, this.prompt({
|
|
1549
|
+
type: "confirm",
|
|
1550
|
+
name: "shouldContinue",
|
|
1551
|
+
message: "This will drop ".concat(targetEnv, "/").concat(targetDbName, " and replace it with ").concat(sourceEnv, "/").concat(sourceDbName, ". Continue? \uD83E\uDD14 ")
|
|
1552
|
+
})];
|
|
1553
|
+
case 14:
|
|
1554
|
+
shouldContinue = (_g.sent()).shouldContinue;
|
|
1555
|
+
if (!shouldContinue) {
|
|
1556
|
+
this.log("abort");
|
|
1557
|
+
closeAll();
|
|
1558
|
+
return [2 /*return*/];
|
|
1559
|
+
}
|
|
1560
|
+
if (!(targetContext.environment.envType === "prod")) return [3 /*break*/, 16];
|
|
1561
|
+
this.log("\n\uD83D\uDEA8 You are overriding a production environment. Please type in ".concat(targetEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME, " to continue\n\n"));
|
|
1562
|
+
return [4 /*yield*/, this.prompt({
|
|
1563
|
+
type: "input",
|
|
1564
|
+
name: "confirmInstance",
|
|
1565
|
+
message: "confirm: "
|
|
1566
|
+
})];
|
|
1567
|
+
case 15:
|
|
1568
|
+
confirmInstance = (_g.sent()).confirmInstance;
|
|
1569
|
+
if (confirmInstance !== targetEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME) {
|
|
1570
|
+
this.log("abort");
|
|
1571
|
+
closeAll();
|
|
1572
|
+
return [2 /*return*/];
|
|
1573
|
+
}
|
|
1574
|
+
_g.label = 16;
|
|
1575
|
+
case 16:
|
|
1576
|
+
_g.trys.push([16, , 18, 19]);
|
|
1577
|
+
return [4 /*yield*/, (0, copyDb_1.spawnCopyDb)({
|
|
1578
|
+
targetPassword: targetPassword,
|
|
1579
|
+
targetPort: targetPort,
|
|
1580
|
+
targetUsername: targetUsername,
|
|
1581
|
+
sourceUsername: sourceUsername,
|
|
1582
|
+
sourcePassword: sourcePassword,
|
|
1583
|
+
sourcePort: sourcePort,
|
|
1584
|
+
sourceDbName: sourceDbName,
|
|
1585
|
+
targetDbName: targetDbName
|
|
1586
|
+
})];
|
|
1587
|
+
case 17:
|
|
1588
|
+
_g.sent();
|
|
1589
|
+
return [3 /*break*/, 19];
|
|
1590
|
+
case 18:
|
|
1591
|
+
closeAll();
|
|
1592
|
+
return [7 /*endfinally*/];
|
|
1593
|
+
case 19: return [2 /*return*/];
|
|
1594
|
+
}
|
|
1595
|
+
});
|
|
1596
|
+
});
|
|
1597
|
+
})];
|
|
1598
|
+
});
|
|
1599
|
+
}); });
|
|
1600
|
+
//# sourceMappingURL=commandProjectRestoreDb.js.map
|
|
1601
|
+
|
|
1602
|
+
/***/ }),
|
|
1603
|
+
|
|
1403
1604
|
/***/ 23526:
|
|
1404
1605
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
1405
1606
|
|
|
@@ -1813,6 +2014,7 @@ var doItFor = function (instance, envAndComponents) { return __awaiter(void 0, v
|
|
|
1813
2014
|
return [3 /*break*/, 4];
|
|
1814
2015
|
case 11: return [3 /*break*/, 2];
|
|
1815
2016
|
case 12:
|
|
2017
|
+
instance.log("");
|
|
1816
2018
|
instance.log("upserting all variables, please wait...");
|
|
1817
2019
|
instance.log("");
|
|
1818
2020
|
_f = 0, _g = Object.entries(envAndComponents);
|
|
@@ -1825,11 +2027,13 @@ var doItFor = function (instance, envAndComponents) { return __awaiter(void 0, v
|
|
|
1825
2027
|
case 14:
|
|
1826
2028
|
if (!(_j < envs_2.length)) return [3 /*break*/, 17];
|
|
1827
2029
|
env = envs_2[_j];
|
|
2030
|
+
instance.log("upserting " + env + ":" + componentName + "...\n");
|
|
1828
2031
|
return [4 /*yield*/, (0, gitlab_1.upsertAllVariables)(instance, valuesToEdit[componentName][env], env, componentName)];
|
|
1829
2032
|
case 15:
|
|
1830
2033
|
_k.sent();
|
|
1831
2034
|
instance.log("");
|
|
1832
2035
|
instance.log("✅ " + env + ":" + componentName);
|
|
2036
|
+
instance.log("--------------------------------\n");
|
|
1833
2037
|
_k.label = 16;
|
|
1834
2038
|
case 16:
|
|
1835
2039
|
_j++;
|
|
@@ -4136,6 +4340,7 @@ var commandPortForward_1 = __importDefault(__nccwpck_require__(3415));
|
|
|
4136
4340
|
var commandTriggerCronjob_1 = __importDefault(__nccwpck_require__(51827));
|
|
4137
4341
|
var commandOpenGrafanaPod_1 = __importDefault(__nccwpck_require__(55848));
|
|
4138
4342
|
var commandSecretsClearBackups_1 = __importDefault(__nccwpck_require__(41863));
|
|
4343
|
+
var commandProjectRestoreDb_1 = __importDefault(__nccwpck_require__(38831));
|
|
4139
4344
|
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
4140
4345
|
return __generator(this, function (_a) {
|
|
4141
4346
|
(0, commandSetup_1["default"])(vorpal);
|
|
@@ -4150,6 +4355,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
4150
4355
|
(0, commandOpenGrafana_1["default"])(vorpal);
|
|
4151
4356
|
(0, commandOpenGrafanaPod_1["default"])(vorpal);
|
|
4152
4357
|
(0, commandCloudSqlProxy_1["default"])(vorpal);
|
|
4358
|
+
(0, commandProjectRestoreDb_1["default"])(vorpal);
|
|
4153
4359
|
(0, commandOpenGit_1["default"])(vorpal);
|
|
4154
4360
|
(0, commandOpenEnv_1["default"])(vorpal);
|
|
4155
4361
|
(0, commandTriggerCronjob_1["default"])(vorpal);
|
|
@@ -6672,135 +6878,7 @@ exports.openGoogleCloudRunDashboard = openGoogleCloudRunDashboard;
|
|
|
6672
6878
|
|
|
6673
6879
|
/***/ }),
|
|
6674
6880
|
|
|
6675
|
-
/***/
|
|
6676
|
-
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
6677
|
-
|
|
6678
|
-
"use strict";
|
|
6679
|
-
|
|
6680
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6681
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6682
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6683
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6684
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6685
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6686
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6687
|
-
});
|
|
6688
|
-
};
|
|
6689
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
6690
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
6691
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
6692
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
6693
|
-
function step(op) {
|
|
6694
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
6695
|
-
while (_) try {
|
|
6696
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
6697
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
6698
|
-
switch (op[0]) {
|
|
6699
|
-
case 0: case 1: t = op; break;
|
|
6700
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
6701
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
6702
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
6703
|
-
default:
|
|
6704
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
6705
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
6706
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
6707
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
6708
|
-
if (t[2]) _.ops.pop();
|
|
6709
|
-
_.trys.pop(); continue;
|
|
6710
|
-
}
|
|
6711
|
-
op = body.call(thisArg, _);
|
|
6712
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
6713
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
6714
|
-
}
|
|
6715
|
-
};
|
|
6716
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6717
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6718
|
-
};
|
|
6719
|
-
exports.__esModule = true;
|
|
6720
|
-
exports.startCloudSqlProxyInBackground = exports.startCloudSqlProxyInCurrentShell = exports.ERROR_NOT_INSTALLED = void 0;
|
|
6721
|
-
var child_process_promise_1 = __nccwpck_require__(75763);
|
|
6722
|
-
var command_exists_promise_1 = __importDefault(__nccwpck_require__(80133));
|
|
6723
|
-
exports.ERROR_NOT_INSTALLED = "cloud-sql-proxy not installed";
|
|
6724
|
-
var getProxyCommandSpawnArgs = function (_a) {
|
|
6725
|
-
var localPort = _a.localPort, instanceName = _a.instanceName;
|
|
6726
|
-
return __awaiter(void 0, void 0, void 0, function () {
|
|
6727
|
-
var commandString, _b, _c, cmd, args;
|
|
6728
|
-
return __generator(this, function (_d) {
|
|
6729
|
-
switch (_d.label) {
|
|
6730
|
-
case 0: return [4 /*yield*/, (0, command_exists_promise_1["default"])("cloud-sql-proxy")];
|
|
6731
|
-
case 1:
|
|
6732
|
-
if (!(_d.sent())) return [3 /*break*/, 2];
|
|
6733
|
-
_b = "cloud-sql-proxy --port ".concat(localPort, " ").concat(instanceName);
|
|
6734
|
-
return [3 /*break*/, 4];
|
|
6735
|
-
case 2: return [4 /*yield*/, (0, command_exists_promise_1["default"])("cloud_sql_proxy" // v1
|
|
6736
|
-
)];
|
|
6737
|
-
case 3:
|
|
6738
|
-
_b = (_d.sent())
|
|
6739
|
-
? "cloud_sql_proxy -instances ".concat(instanceName, "=tcp:").concat(localPort)
|
|
6740
|
-
: null;
|
|
6741
|
-
_d.label = 4;
|
|
6742
|
-
case 4:
|
|
6743
|
-
commandString = _b;
|
|
6744
|
-
if (!commandString) {
|
|
6745
|
-
throw new Error(exports.ERROR_NOT_INSTALLED);
|
|
6746
|
-
}
|
|
6747
|
-
_c = commandString.split(" "), cmd = _c[0], args = _c.slice(1);
|
|
6748
|
-
return [2 /*return*/, { cmd: cmd, args: args }];
|
|
6749
|
-
}
|
|
6750
|
-
});
|
|
6751
|
-
});
|
|
6752
|
-
};
|
|
6753
|
-
var startCloudSqlProxyInCurrentShell = function (opts) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6754
|
-
var _a, cmd, args;
|
|
6755
|
-
return __generator(this, function (_b) {
|
|
6756
|
-
switch (_b.label) {
|
|
6757
|
-
case 0: return [4 /*yield*/, getProxyCommandSpawnArgs(opts)];
|
|
6758
|
-
case 1:
|
|
6759
|
-
_a = _b.sent(), cmd = _a.cmd, args = _a.args;
|
|
6760
|
-
return [4 /*yield*/, (0, child_process_promise_1.spawn)(cmd, args, {
|
|
6761
|
-
stdio: "inherit",
|
|
6762
|
-
shell: true
|
|
6763
|
-
})];
|
|
6764
|
-
case 2:
|
|
6765
|
-
_b.sent();
|
|
6766
|
-
return [2 /*return*/];
|
|
6767
|
-
}
|
|
6768
|
-
});
|
|
6769
|
-
}); };
|
|
6770
|
-
exports.startCloudSqlProxyInCurrentShell = startCloudSqlProxyInCurrentShell;
|
|
6771
|
-
var startCloudSqlProxyInBackground = function (opts) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6772
|
-
var _a, cmd, args, proxyPromise, stop;
|
|
6773
|
-
return __generator(this, function (_b) {
|
|
6774
|
-
switch (_b.label) {
|
|
6775
|
-
case 0: return [4 /*yield*/, getProxyCommandSpawnArgs(opts)];
|
|
6776
|
-
case 1:
|
|
6777
|
-
_a = _b.sent(), cmd = _a.cmd, args = _a.args;
|
|
6778
|
-
proxyPromise = (0, child_process_promise_1.spawn)(cmd, args, { shell: "bash" });
|
|
6779
|
-
// wait until it starts
|
|
6780
|
-
return [4 /*yield*/, (0, child_process_promise_1.spawn)("echo -n \"Waiting for proxy\"\n until echo > /dev/tcp/localhost/".concat(opts.localPort, "; do\n sleep 0.2\n echo -n \".\"\n done 2>/dev/null"), [], { shell: "bash" })];
|
|
6781
|
-
case 2:
|
|
6782
|
-
// wait until it starts
|
|
6783
|
-
_b.sent();
|
|
6784
|
-
stop = function () {
|
|
6785
|
-
proxyPromise["catch"](function () {
|
|
6786
|
-
// ignore
|
|
6787
|
-
});
|
|
6788
|
-
proxyPromise.childProcess.kill();
|
|
6789
|
-
};
|
|
6790
|
-
// stop if catladder i stopped
|
|
6791
|
-
process.on("beforeExit", stop);
|
|
6792
|
-
return [2 /*return*/, {
|
|
6793
|
-
stop: stop
|
|
6794
|
-
}];
|
|
6795
|
-
}
|
|
6796
|
-
});
|
|
6797
|
-
}); };
|
|
6798
|
-
exports.startCloudSqlProxyInBackground = startCloudSqlProxyInBackground;
|
|
6799
|
-
//# sourceMappingURL=startProxy.js.map
|
|
6800
|
-
|
|
6801
|
-
/***/ }),
|
|
6802
|
-
|
|
6803
|
-
/***/ 4895:
|
|
6881
|
+
/***/ 45772:
|
|
6804
6882
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
6805
6883
|
|
|
6806
6884
|
"use strict";
|
|
@@ -6842,35 +6920,234 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
6842
6920
|
}
|
|
6843
6921
|
};
|
|
6844
6922
|
exports.__esModule = true;
|
|
6845
|
-
exports.
|
|
6923
|
+
exports.spawnCopyDb = void 0;
|
|
6846
6924
|
var child_process_promise_1 = __nccwpck_require__(75763);
|
|
6847
|
-
var
|
|
6848
|
-
var
|
|
6925
|
+
var spawnCopyDb = function (opts) { return __awaiter(void 0, void 0, void 0, function () {
|
|
6926
|
+
var script;
|
|
6849
6927
|
return __generator(this, function (_a) {
|
|
6850
6928
|
switch (_a.label) {
|
|
6851
6929
|
case 0:
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
case 2:
|
|
6859
|
-
_a.sent();
|
|
6860
|
-
_a.label = 3;
|
|
6861
|
-
case 3:
|
|
6862
|
-
_i++;
|
|
6863
|
-
return [3 /*break*/, 1];
|
|
6864
|
-
case 4: return [2 /*return*/];
|
|
6930
|
+
script = createCopyDbScript(opts);
|
|
6931
|
+
return [4 /*yield*/, (0, child_process_promise_1.spawn)(script, [], {
|
|
6932
|
+
shell: "bash",
|
|
6933
|
+
stdio: "inherit"
|
|
6934
|
+
})];
|
|
6935
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
6865
6936
|
}
|
|
6866
6937
|
});
|
|
6867
6938
|
}); };
|
|
6868
|
-
exports.
|
|
6869
|
-
|
|
6939
|
+
exports.spawnCopyDb = spawnCopyDb;
|
|
6940
|
+
var createCopyDbScript = function (_a) {
|
|
6941
|
+
var targetPassword = _a.targetPassword, targetPort = _a.targetPort, targetUsername = _a.targetUsername, sourceUsername = _a.sourceUsername, sourcePassword = _a.sourcePassword, sourcePort = _a.sourcePort, sourceDbName = _a.sourceDbName, targetDbName = _a.targetDbName;
|
|
6942
|
+
var targetPSQL = function (command) {
|
|
6943
|
+
return "PGPASSWORD=".concat(targetPassword, " psql -p ").concat(targetPort, " --host=localhost --user=").concat(targetUsername, " -q ").concat(command);
|
|
6944
|
+
};
|
|
6945
|
+
var 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 ");
|
|
6946
|
+
return copyDBScript;
|
|
6947
|
+
};
|
|
6948
|
+
//# sourceMappingURL=copyDb.js.map
|
|
6870
6949
|
|
|
6871
6950
|
/***/ }),
|
|
6872
6951
|
|
|
6873
|
-
/***/
|
|
6952
|
+
/***/ 63069:
|
|
6953
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
6954
|
+
|
|
6955
|
+
"use strict";
|
|
6956
|
+
|
|
6957
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6958
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6959
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6960
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6961
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6962
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
6963
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
6964
|
+
});
|
|
6965
|
+
};
|
|
6966
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
6967
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
6968
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
6969
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
6970
|
+
function step(op) {
|
|
6971
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
6972
|
+
while (_) try {
|
|
6973
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
6974
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
6975
|
+
switch (op[0]) {
|
|
6976
|
+
case 0: case 1: t = op; break;
|
|
6977
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
6978
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
6979
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
6980
|
+
default:
|
|
6981
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
6982
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
6983
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
6984
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
6985
|
+
if (t[2]) _.ops.pop();
|
|
6986
|
+
_.trys.pop(); continue;
|
|
6987
|
+
}
|
|
6988
|
+
op = body.call(thisArg, _);
|
|
6989
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
6990
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
6991
|
+
}
|
|
6992
|
+
};
|
|
6993
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
6994
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6995
|
+
};
|
|
6996
|
+
exports.__esModule = true;
|
|
6997
|
+
exports.startCloudSqlProxyInBackground = exports.startCloudSqlProxyInCurrentShell = exports.ERROR_NOT_INSTALLED = void 0;
|
|
6998
|
+
var child_process_promise_1 = __nccwpck_require__(75763);
|
|
6999
|
+
var command_exists_promise_1 = __importDefault(__nccwpck_require__(80133));
|
|
7000
|
+
exports.ERROR_NOT_INSTALLED = "cloud-sql-proxy not installed";
|
|
7001
|
+
var getProxyCommandSpawnArgs = function (_a) {
|
|
7002
|
+
var localPort = _a.localPort, instanceName = _a.instanceName;
|
|
7003
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
7004
|
+
var commandString, _b, _c, cmd, args;
|
|
7005
|
+
return __generator(this, function (_d) {
|
|
7006
|
+
switch (_d.label) {
|
|
7007
|
+
case 0: return [4 /*yield*/, (0, command_exists_promise_1["default"])("cloud-sql-proxy")];
|
|
7008
|
+
case 1:
|
|
7009
|
+
if (!(_d.sent())) return [3 /*break*/, 2];
|
|
7010
|
+
_b = "cloud-sql-proxy --port ".concat(localPort, " ").concat(instanceName);
|
|
7011
|
+
return [3 /*break*/, 4];
|
|
7012
|
+
case 2: return [4 /*yield*/, (0, command_exists_promise_1["default"])("cloud_sql_proxy" // v1
|
|
7013
|
+
)];
|
|
7014
|
+
case 3:
|
|
7015
|
+
_b = (_d.sent())
|
|
7016
|
+
? "cloud_sql_proxy -instances ".concat(instanceName, "=tcp:").concat(localPort)
|
|
7017
|
+
: null;
|
|
7018
|
+
_d.label = 4;
|
|
7019
|
+
case 4:
|
|
7020
|
+
commandString = _b;
|
|
7021
|
+
if (!commandString) {
|
|
7022
|
+
throw new Error(exports.ERROR_NOT_INSTALLED);
|
|
7023
|
+
}
|
|
7024
|
+
_c = commandString.split(" "), cmd = _c[0], args = _c.slice(1);
|
|
7025
|
+
return [2 /*return*/, { cmd: cmd, args: args }];
|
|
7026
|
+
}
|
|
7027
|
+
});
|
|
7028
|
+
});
|
|
7029
|
+
};
|
|
7030
|
+
var startCloudSqlProxyInCurrentShell = function (opts) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7031
|
+
var _a, cmd, args;
|
|
7032
|
+
return __generator(this, function (_b) {
|
|
7033
|
+
switch (_b.label) {
|
|
7034
|
+
case 0: return [4 /*yield*/, getProxyCommandSpawnArgs(opts)];
|
|
7035
|
+
case 1:
|
|
7036
|
+
_a = _b.sent(), cmd = _a.cmd, args = _a.args;
|
|
7037
|
+
return [4 /*yield*/, (0, child_process_promise_1.spawn)(cmd, args, {
|
|
7038
|
+
stdio: "inherit",
|
|
7039
|
+
shell: true
|
|
7040
|
+
})];
|
|
7041
|
+
case 2:
|
|
7042
|
+
_b.sent();
|
|
7043
|
+
return [2 /*return*/];
|
|
7044
|
+
}
|
|
7045
|
+
});
|
|
7046
|
+
}); };
|
|
7047
|
+
exports.startCloudSqlProxyInCurrentShell = startCloudSqlProxyInCurrentShell;
|
|
7048
|
+
var startCloudSqlProxyInBackground = function (opts) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7049
|
+
var _a, cmd, args, proxyPromise, stop;
|
|
7050
|
+
return __generator(this, function (_b) {
|
|
7051
|
+
switch (_b.label) {
|
|
7052
|
+
case 0: return [4 /*yield*/, getProxyCommandSpawnArgs(opts)];
|
|
7053
|
+
case 1:
|
|
7054
|
+
_a = _b.sent(), cmd = _a.cmd, args = _a.args;
|
|
7055
|
+
proxyPromise = (0, child_process_promise_1.spawn)(cmd, args, { shell: "bash" });
|
|
7056
|
+
// wait until it starts
|
|
7057
|
+
return [4 /*yield*/, (0, child_process_promise_1.spawn)("echo -n \"Waiting for proxy\"\n until echo > /dev/tcp/localhost/".concat(opts.localPort, "; do\n sleep 0.2\n echo -n \".\"\n done 2>/dev/null"), [], { shell: "bash" })];
|
|
7058
|
+
case 2:
|
|
7059
|
+
// wait until it starts
|
|
7060
|
+
_b.sent();
|
|
7061
|
+
stop = function () {
|
|
7062
|
+
proxyPromise["catch"](function () {
|
|
7063
|
+
// ignore
|
|
7064
|
+
});
|
|
7065
|
+
proxyPromise.childProcess.kill();
|
|
7066
|
+
};
|
|
7067
|
+
// stop if catladder i stopped
|
|
7068
|
+
process.on("beforeExit", stop);
|
|
7069
|
+
return [2 /*return*/, {
|
|
7070
|
+
stop: stop
|
|
7071
|
+
}];
|
|
7072
|
+
}
|
|
7073
|
+
});
|
|
7074
|
+
}); };
|
|
7075
|
+
exports.startCloudSqlProxyInBackground = startCloudSqlProxyInBackground;
|
|
7076
|
+
//# sourceMappingURL=startProxy.js.map
|
|
7077
|
+
|
|
7078
|
+
/***/ }),
|
|
7079
|
+
|
|
7080
|
+
/***/ 4895:
|
|
7081
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
7082
|
+
|
|
7083
|
+
"use strict";
|
|
7084
|
+
|
|
7085
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
7086
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7087
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7088
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7089
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7090
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7091
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
7092
|
+
});
|
|
7093
|
+
};
|
|
7094
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
7095
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
7096
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
7097
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
7098
|
+
function step(op) {
|
|
7099
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
7100
|
+
while (_) try {
|
|
7101
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
7102
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
7103
|
+
switch (op[0]) {
|
|
7104
|
+
case 0: case 1: t = op; break;
|
|
7105
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
7106
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
7107
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
7108
|
+
default:
|
|
7109
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
7110
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
7111
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
7112
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
7113
|
+
if (t[2]) _.ops.pop();
|
|
7114
|
+
_.trys.pop(); continue;
|
|
7115
|
+
}
|
|
7116
|
+
op = body.call(thisArg, _);
|
|
7117
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
7118
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
7119
|
+
}
|
|
7120
|
+
};
|
|
7121
|
+
exports.__esModule = true;
|
|
7122
|
+
exports.enableGCloudServices = void 0;
|
|
7123
|
+
var child_process_promise_1 = __nccwpck_require__(75763);
|
|
7124
|
+
var enableGCloudServices = function (services, config) { return __awaiter(void 0, void 0, void 0, function () {
|
|
7125
|
+
var _i, services_1, service;
|
|
7126
|
+
return __generator(this, function (_a) {
|
|
7127
|
+
switch (_a.label) {
|
|
7128
|
+
case 0:
|
|
7129
|
+
_i = 0, services_1 = services;
|
|
7130
|
+
_a.label = 1;
|
|
7131
|
+
case 1:
|
|
7132
|
+
if (!(_i < services_1.length)) return [3 /*break*/, 4];
|
|
7133
|
+
service = services_1[_i];
|
|
7134
|
+
return [4 /*yield*/, (0, child_process_promise_1.exec)("gcloud services enable ".concat(service, " --project=").concat(config.projectId))];
|
|
7135
|
+
case 2:
|
|
7136
|
+
_a.sent();
|
|
7137
|
+
_a.label = 3;
|
|
7138
|
+
case 3:
|
|
7139
|
+
_i++;
|
|
7140
|
+
return [3 /*break*/, 1];
|
|
7141
|
+
case 4: return [2 /*return*/];
|
|
7142
|
+
}
|
|
7143
|
+
});
|
|
7144
|
+
}); };
|
|
7145
|
+
exports.enableGCloudServices = enableGCloudServices;
|
|
7146
|
+
//# sourceMappingURL=enableServices.js.map
|
|
7147
|
+
|
|
7148
|
+
/***/ }),
|
|
7149
|
+
|
|
7150
|
+
/***/ 41087:
|
|
6874
7151
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
6875
7152
|
|
|
6876
7153
|
"use strict";
|
|
@@ -135473,6 +135750,152 @@ var isArray = Array.isArray || function (xs) {
|
|
|
135473
135750
|
};
|
|
135474
135751
|
|
|
135475
135752
|
|
|
135753
|
+
/***/ }),
|
|
135754
|
+
|
|
135755
|
+
/***/ 71004:
|
|
135756
|
+
/***/ ((module, exports) => {
|
|
135757
|
+
|
|
135758
|
+
// MIT License
|
|
135759
|
+
(function (factory) {
|
|
135760
|
+
if ( true && typeof module.exports === "object") {
|
|
135761
|
+
var v = factory(require, exports);
|
|
135762
|
+
if (v !== undefined) module.exports = v;
|
|
135763
|
+
}
|
|
135764
|
+
else if (typeof define === "function" && define.amd) {
|
|
135765
|
+
define(["require", "exports"], factory);
|
|
135766
|
+
}
|
|
135767
|
+
})(function () {
|
|
135768
|
+
"use strict";
|
|
135769
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
135770
|
+
exports.ConnectionStringParser = void 0;
|
|
135771
|
+
class ConnectionStringParser {
|
|
135772
|
+
constructor(options) {
|
|
135773
|
+
this.scheme = (options && options.scheme) || ConnectionStringParser.DEFAULT_SCHEME;
|
|
135774
|
+
}
|
|
135775
|
+
/**
|
|
135776
|
+
* Takes a connection string object and returns a URI string of the form:
|
|
135777
|
+
*
|
|
135778
|
+
* scheme://[username[:password]@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[endpoint]][?options]
|
|
135779
|
+
* @param connectionStringObject The object that describes connection string parameters
|
|
135780
|
+
*/
|
|
135781
|
+
format(connectionStringObject) {
|
|
135782
|
+
if (!connectionStringObject) {
|
|
135783
|
+
return this.scheme + "://localhost";
|
|
135784
|
+
}
|
|
135785
|
+
if (this.scheme && connectionStringObject.scheme && this.scheme !== connectionStringObject.scheme) {
|
|
135786
|
+
throw new Error(`Scheme not supported: ${connectionStringObject.scheme}`);
|
|
135787
|
+
}
|
|
135788
|
+
let uri = (this.scheme || connectionStringObject.scheme || ConnectionStringParser.DEFAULT_SCHEME) + "://";
|
|
135789
|
+
if (connectionStringObject.username) {
|
|
135790
|
+
uri += encodeURIComponent(connectionStringObject.username);
|
|
135791
|
+
// Allow empty passwords
|
|
135792
|
+
if (connectionStringObject.password) {
|
|
135793
|
+
uri += ":" + encodeURIComponent(connectionStringObject.password);
|
|
135794
|
+
}
|
|
135795
|
+
uri += "@";
|
|
135796
|
+
}
|
|
135797
|
+
uri += this._formatAddress(connectionStringObject);
|
|
135798
|
+
// Only put a slash when there is an endpoint
|
|
135799
|
+
if (connectionStringObject.endpoint) {
|
|
135800
|
+
uri += "/" + encodeURIComponent(connectionStringObject.endpoint);
|
|
135801
|
+
}
|
|
135802
|
+
if (connectionStringObject.options && Object.keys(connectionStringObject.options).length > 0) {
|
|
135803
|
+
uri += "?" + Object.keys(connectionStringObject.options)
|
|
135804
|
+
.map((option) => encodeURIComponent(option) + "=" + encodeURIComponent(connectionStringObject.options[option]))
|
|
135805
|
+
.join("&");
|
|
135806
|
+
}
|
|
135807
|
+
return uri;
|
|
135808
|
+
}
|
|
135809
|
+
/**
|
|
135810
|
+
* Takes a connection string URI of form:
|
|
135811
|
+
*
|
|
135812
|
+
* scheme://[username[:password]@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[endpoint]][?options]
|
|
135813
|
+
*
|
|
135814
|
+
* and returns an object of form:
|
|
135815
|
+
*
|
|
135816
|
+
* {
|
|
135817
|
+
* scheme: string,
|
|
135818
|
+
* username?: string,
|
|
135819
|
+
* password?: string,
|
|
135820
|
+
* hosts: [ { host: string, port?: number }, ... ],
|
|
135821
|
+
* endpoint?: string,
|
|
135822
|
+
* options?: object
|
|
135823
|
+
* }
|
|
135824
|
+
*
|
|
135825
|
+
* Where scheme and hosts will always be present. Other fields will only be present in the result if they were
|
|
135826
|
+
* present in the input.
|
|
135827
|
+
* @param uri The connection string URI
|
|
135828
|
+
*/
|
|
135829
|
+
parse(uri) {
|
|
135830
|
+
const connectionStringParser = new RegExp("^\\s*" + // Optional whitespace padding at the beginning of the line
|
|
135831
|
+
"([^:]+)://" + // Scheme (Group 1)
|
|
135832
|
+
"(?:([^:@,/?=&]+)(?::([^:@,/?=&]+))?@)?" + // User (Group 2) and Password (Group 3)
|
|
135833
|
+
"([^@/?=&]+)" + // Host address(es) (Group 4)
|
|
135834
|
+
"(?:/([^:@,/?=&]+)?)?" + // Endpoint (Group 5)
|
|
135835
|
+
"(?:\\?([^:@,/?]+)?)?" + // Options (Group 6)
|
|
135836
|
+
"\\s*$", // Optional whitespace padding at the end of the line
|
|
135837
|
+
"gi");
|
|
135838
|
+
const connectionStringObject = {};
|
|
135839
|
+
if (!uri.includes("://")) {
|
|
135840
|
+
throw new Error(`No scheme found in URI ${uri}`);
|
|
135841
|
+
}
|
|
135842
|
+
const tokens = connectionStringParser.exec(uri);
|
|
135843
|
+
if (Array.isArray(tokens)) {
|
|
135844
|
+
connectionStringObject.scheme = tokens[1];
|
|
135845
|
+
if (this.scheme && this.scheme !== connectionStringObject.scheme) {
|
|
135846
|
+
throw new Error(`URI must start with '${this.scheme}://'`);
|
|
135847
|
+
}
|
|
135848
|
+
connectionStringObject.username = tokens[2] ? decodeURIComponent(tokens[2]) : tokens[2];
|
|
135849
|
+
connectionStringObject.password = tokens[3] ? decodeURIComponent(tokens[3]) : tokens[3];
|
|
135850
|
+
connectionStringObject.hosts = this._parseAddress(tokens[4]);
|
|
135851
|
+
connectionStringObject.endpoint = tokens[5] ? decodeURIComponent(tokens[5]) : tokens[5];
|
|
135852
|
+
connectionStringObject.options = tokens[6] ? this._parseOptions(tokens[6]) : tokens[6];
|
|
135853
|
+
}
|
|
135854
|
+
return connectionStringObject;
|
|
135855
|
+
}
|
|
135856
|
+
/**
|
|
135857
|
+
* Formats the address portion of a connection string
|
|
135858
|
+
* @param connectionStringObject The object that describes connection string parameters
|
|
135859
|
+
*/
|
|
135860
|
+
_formatAddress(connectionStringObject) {
|
|
135861
|
+
return connectionStringObject.hosts
|
|
135862
|
+
.map((address) => encodeURIComponent(address.host) + (address.port ? ":" + encodeURIComponent(address.port.toString(10)) : ""))
|
|
135863
|
+
.join(",");
|
|
135864
|
+
}
|
|
135865
|
+
/**
|
|
135866
|
+
* Parses an address
|
|
135867
|
+
* @param addresses The address(es) to process
|
|
135868
|
+
*/
|
|
135869
|
+
_parseAddress(addresses) {
|
|
135870
|
+
return addresses.split(",")
|
|
135871
|
+
.map((address) => {
|
|
135872
|
+
const i = address.indexOf(":");
|
|
135873
|
+
return (i >= 0 ?
|
|
135874
|
+
{ host: decodeURIComponent(address.substring(0, i)), port: +address.substring(i + 1) } :
|
|
135875
|
+
{ host: decodeURIComponent(address) });
|
|
135876
|
+
});
|
|
135877
|
+
}
|
|
135878
|
+
/**
|
|
135879
|
+
* Parses options
|
|
135880
|
+
* @param options The options to process
|
|
135881
|
+
*/
|
|
135882
|
+
_parseOptions(options) {
|
|
135883
|
+
const result = {};
|
|
135884
|
+
options.split("&")
|
|
135885
|
+
.forEach((option) => {
|
|
135886
|
+
const i = option.indexOf("=");
|
|
135887
|
+
if (i >= 0) {
|
|
135888
|
+
result[decodeURIComponent(option.substring(0, i))] = decodeURIComponent(option.substring(i + 1));
|
|
135889
|
+
}
|
|
135890
|
+
});
|
|
135891
|
+
return result;
|
|
135892
|
+
}
|
|
135893
|
+
}
|
|
135894
|
+
exports.ConnectionStringParser = ConnectionStringParser;
|
|
135895
|
+
ConnectionStringParser.DEFAULT_SCHEME = "db";
|
|
135896
|
+
});
|
|
135897
|
+
|
|
135898
|
+
|
|
135476
135899
|
/***/ }),
|
|
135477
135900
|
|
|
135478
135901
|
/***/ 10968:
|
|
@@ -353250,7 +353673,6 @@ exports.RUNNER_BUILD_RESOURCE_VARIABLES = exports.APP_BUILD_JOB_NAME = void 0;
|
|
|
353250
353673
|
exports.APP_BUILD_JOB_NAME = "🔨 app";
|
|
353251
353674
|
exports.RUNNER_BUILD_RESOURCE_VARIABLES = {
|
|
353252
353675
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
353253
|
-
KUBERNETES_CPU_LIMIT: "2",
|
|
353254
353676
|
KUBERNETES_MEMORY_REQUEST: "1Gi",
|
|
353255
353677
|
KUBERNETES_MEMORY_LIMIT: "4Gi"
|
|
353256
353678
|
};
|
|
@@ -353606,7 +354028,6 @@ var types_1 = __nccwpck_require__(71197);
|
|
|
353606
354028
|
var base_1 = __nccwpck_require__(18035);
|
|
353607
354029
|
var RUNNER_BUILD_VARIABLES = {
|
|
353608
354030
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
353609
|
-
KUBERNETES_CPU_LIMIT: "2",
|
|
353610
354031
|
KUBERNETES_MEMORY_REQUEST: "2Gi",
|
|
353611
354032
|
KUBERNETES_MEMORY_LIMIT: "4Gi"
|
|
353612
354033
|
};
|
|
@@ -353631,7 +354052,7 @@ var createCustomBuildJobs = function (context) {
|
|
|
353631
354052
|
}
|
|
353632
354053
|
} : undefined,
|
|
353633
354054
|
dockerBuild: {
|
|
353634
|
-
script: (0, docker_1.getDockerBuildDefaultScript)(((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
|
|
354055
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context, ((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
|
|
353635
354056
|
variables: {}
|
|
353636
354057
|
}
|
|
353637
354058
|
});
|
|
@@ -353742,7 +354163,6 @@ var types_1 = __nccwpck_require__(71197);
|
|
|
353742
354163
|
var createArtifactsConfig_1 = __nccwpck_require__(5669);
|
|
353743
354164
|
var RUNNER_CUSTOM_TEST_VARIABLES = {
|
|
353744
354165
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
353745
|
-
KUBERNETES_CPU_LIMIT: "2",
|
|
353746
354166
|
KUBERNETES_MEMORY_REQUEST: "2Gi",
|
|
353747
354167
|
KUBERNETES_MEMORY_LIMIT: "4Gi"
|
|
353748
354168
|
};
|
|
@@ -353816,26 +354236,73 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
353816
354236
|
}
|
|
353817
354237
|
return t;
|
|
353818
354238
|
};
|
|
354239
|
+
var __read = this && this.__read || function (o, n) {
|
|
354240
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
354241
|
+
if (!m) return o;
|
|
354242
|
+
var i = m.call(o),
|
|
354243
|
+
r,
|
|
354244
|
+
ar = [],
|
|
354245
|
+
e;
|
|
354246
|
+
try {
|
|
354247
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
354248
|
+
} catch (error) {
|
|
354249
|
+
e = {
|
|
354250
|
+
error: error
|
|
354251
|
+
};
|
|
354252
|
+
} finally {
|
|
354253
|
+
try {
|
|
354254
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
354255
|
+
} finally {
|
|
354256
|
+
if (e) throw e.error;
|
|
354257
|
+
}
|
|
354258
|
+
}
|
|
354259
|
+
return ar;
|
|
354260
|
+
};
|
|
354261
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
354262
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
354263
|
+
if (ar || !(i in from)) {
|
|
354264
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
354265
|
+
ar[i] = from[i];
|
|
354266
|
+
}
|
|
354267
|
+
}
|
|
354268
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
354269
|
+
};
|
|
354270
|
+
var __importDefault = this && this.__importDefault || function (mod) {
|
|
354271
|
+
return mod && mod.__esModule ? mod : {
|
|
354272
|
+
"default": mod
|
|
354273
|
+
};
|
|
354274
|
+
};
|
|
353819
354275
|
exports.__esModule = true;
|
|
353820
|
-
exports.getDockerBuildDefaultScript = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
|
|
354276
|
+
exports.hasDockerfile = exports.getDockerBuildDefaultScript = exports.gitlabDockerLogin = exports.createDockerBuildJobBase = exports.getDockerJobBaseProps = exports.DOCKER_BUILD_JOB_NAME = exports.getDockerBuildVariables = exports.requiresDockerBuild = exports.getDockerImageVariables = void 0;
|
|
353821
354277
|
var lodash_1 = __nccwpck_require__(23255);
|
|
353822
354278
|
var deploy_1 = __nccwpck_require__(90223);
|
|
353823
354279
|
var runner_1 = __nccwpck_require__(55071);
|
|
354280
|
+
var fs_1 = __nccwpck_require__(57147);
|
|
354281
|
+
var path_1 = __importDefault(__nccwpck_require__(71017));
|
|
354282
|
+
var gitlab_1 = __nccwpck_require__(84997);
|
|
354283
|
+
var artifactsRegistry_1 = __nccwpck_require__(28159);
|
|
354284
|
+
var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(22607);
|
|
353824
354285
|
var DOCKER_RUNNER_BUILD_VARIABLES = {
|
|
353825
354286
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
353826
|
-
KUBERNETES_CPU_LIMIT: "1",
|
|
353827
354287
|
KUBERNETES_MEMORY_REQUEST: "1Gi",
|
|
353828
354288
|
KUBERNETES_MEMORY_LIMIT: "2Gi"
|
|
353829
354289
|
};
|
|
353830
354290
|
var getDockerImageVariables = function (context) {
|
|
353831
|
-
return {
|
|
354291
|
+
return __assign(__assign({}, (0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ? {
|
|
354292
|
+
DOCKER_REGISTRY: (0, artifactsRegistry_1.getArtifactsRegistryHost)(context),
|
|
354293
|
+
DOCKER_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryImageName)(context),
|
|
354294
|
+
DOCKER_CACHE_IMAGE: (0, artifactsRegistry_1.getArtifactsRegistryBuildCacheImage)(context)
|
|
354295
|
+
} :
|
|
354296
|
+
// gitlab registry:
|
|
354297
|
+
{
|
|
353832
354298
|
DOCKER_REGISTRY: "$CI_REGISTRY",
|
|
353833
|
-
|
|
353834
|
-
|
|
354299
|
+
DOCKER_CACHE_IMAGE: "$CI_REGISTRY_IMAGE/caches/" + context.componentName,
|
|
354300
|
+
// ONLY USED IN KUBERNETES
|
|
353835
354301
|
DOCKER_IMAGE_NAME: context.environment.shortName + "/" + context.componentName,
|
|
353836
|
-
DOCKER_IMAGE: "$
|
|
354302
|
+
DOCKER_IMAGE: "$CI_REGISTRY_IMAGE/$DOCKER_IMAGE_NAME"
|
|
354303
|
+
}), {
|
|
353837
354304
|
DOCKER_IMAGE_TAG: "$CI_COMMIT_SHA"
|
|
353838
|
-
};
|
|
354305
|
+
});
|
|
353839
354306
|
};
|
|
353840
354307
|
exports.getDockerImageVariables = getDockerImageVariables;
|
|
353841
354308
|
/**
|
|
@@ -353869,7 +354336,7 @@ var getDockerJobBaseProps = function (context) {
|
|
|
353869
354336
|
return {
|
|
353870
354337
|
image: (0, runner_1.getRunnerImage)("docker-build"),
|
|
353871
354338
|
services: [{
|
|
353872
|
-
name: "docker:
|
|
354339
|
+
name: "docker:24.0.6-dind",
|
|
353873
354340
|
command: ["--tls=false"]
|
|
353874
354341
|
}],
|
|
353875
354342
|
variables: getDockerBaseVariables()
|
|
@@ -353890,11 +354357,19 @@ var createDockerBuildJobBase = function (context, _a) {
|
|
|
353890
354357
|
}, def);
|
|
353891
354358
|
};
|
|
353892
354359
|
exports.createDockerBuildJobBase = createDockerBuildJobBase;
|
|
353893
|
-
|
|
353894
|
-
|
|
353895
|
-
|
|
354360
|
+
var gitlabDockerLogin = function (context) {
|
|
354361
|
+
return (0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ? __spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), ["gcloud auth configure-docker ".concat((0, artifactsRegistry_1.getArtifactsRegistryHost)(context))], false) : ["docker login --username gitlab-ci-token --password $CI_JOB_TOKEN $CI_REGISTRY"];
|
|
354362
|
+
};
|
|
354363
|
+
exports.gitlabDockerLogin = gitlabDockerLogin;
|
|
354364
|
+
var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
|
|
354365
|
+
return __spreadArray(__spreadArray(__spreadArray([ensureDockerFileScript], __read((0, gitlab_1.collapseableSection)("docker-login", "Docker Login")((0, exports.gitlabDockerLogin)(context))), false), __read((0, gitlab_1.collapseableSection)("docker-build", "Docker build")(["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" //BUILDKIT_INLINE_CACHE, see https://testdriven.io/blog/faster-ci-builds-with-docker-cache/
|
|
354366
|
+
])), false), __read((0, gitlab_1.collapseableSection)("docker-push", "Docker push and tag")(["docker push $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_CACHE_IMAGE", "docker push $DOCKER_CACHE_IMAGE"])), false).filter(Boolean);
|
|
353896
354367
|
};
|
|
353897
354368
|
exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
|
|
354369
|
+
var hasDockerfile = function (context) {
|
|
354370
|
+
return (0, fs_1.existsSync)(path_1["default"].join(context.componentConfig.dir, "Dockerfile"));
|
|
354371
|
+
};
|
|
354372
|
+
exports.hasDockerfile = hasDockerfile;
|
|
353898
354373
|
|
|
353899
354374
|
/***/ }),
|
|
353900
354375
|
|
|
@@ -353972,8 +354447,8 @@ exports.BUILD_TYPES = {
|
|
|
353972
354447
|
return {
|
|
353973
354448
|
startCommand: "/cnb/process/web",
|
|
353974
354449
|
cnbBuilder: {
|
|
353975
|
-
image: "heroku/
|
|
353976
|
-
packVersion: "0.
|
|
354450
|
+
image: "heroku/builder:22",
|
|
354451
|
+
packVersion: "0.32.1"
|
|
353977
354452
|
}
|
|
353978
354453
|
};
|
|
353979
354454
|
}
|
|
@@ -354055,15 +354530,19 @@ var createNodeBuildJobs = function (context) {
|
|
|
354055
354530
|
cache: __spreadArray(__spreadArray(__spreadArray([], __read((_b = (0, utils_1.ensureArray)(buildConfig.jobCache)) !== null && _b !== void 0 ? _b : []), false), __read((0, cache_1.getNodeCache)(context)), false), __read((0, cache_1.getNextCache)(context)), false),
|
|
354056
354531
|
script: __spreadArray(__spreadArray([], __read(yarnInstall), false), __read((_c = (0, utils_1.ensureArray)(buildConfig.buildCommand)) !== null && _c !== void 0 ? _c : []), false),
|
|
354057
354532
|
artifacts: {
|
|
354058
|
-
paths: __spreadArray([
|
|
354059
|
-
|
|
354060
|
-
|
|
354061
|
-
|
|
354533
|
+
paths: __spreadArray([context.componentConfig.dir], __read((_e = (_d = context.packageManagerInfo) === null || _d === void 0 ? void 0 : _d.currentWorkspaceDependencies) !== null && _e !== void 0 ? _e : []), false).flatMap(function (dir) {
|
|
354534
|
+
var _a, _b;
|
|
354535
|
+
return __spreadArray([(0, path_1.join)(dir, "__build_info.json"), (0, path_1.join)(dir, "dist"), (0, path_1.join)(dir, ".next")], __read((_b = (_a = buildConfig.artifactsPaths) === null || _a === void 0 ? void 0 : _a.map(function (path) {
|
|
354536
|
+
return (0, path_1.join)(dir, path);
|
|
354537
|
+
})) !== null && _b !== void 0 ? _b : []), false);
|
|
354538
|
+
}),
|
|
354539
|
+
expire_in: "1 day",
|
|
354540
|
+
when: "always"
|
|
354062
354541
|
},
|
|
354063
354542
|
jobTags: buildConfig.jobTags
|
|
354064
354543
|
} : undefined,
|
|
354065
354544
|
dockerBuild: {
|
|
354066
|
-
script: (0, docker_1.getDockerBuildDefaultScript)(buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "ensureNginxDockerfile" : "ensureNodeDockerfile"),
|
|
354545
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "ensureNginxDockerfile" : "ensureNodeDockerfile"),
|
|
354067
354546
|
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
|
|
354068
354547
|
variables: {
|
|
354069
354548
|
// only required for non static
|
|
@@ -354125,6 +354604,7 @@ exports.__esModule = true;
|
|
|
354125
354604
|
exports.getNextCache = exports.getNodeCache = exports.getNodeModulesCache = exports.getYarnCache = void 0;
|
|
354126
354605
|
var path_1 = __nccwpck_require__(71017);
|
|
354127
354606
|
var slugify_1 = __importDefault(__nccwpck_require__(44035));
|
|
354607
|
+
var lodash_1 = __nccwpck_require__(23255);
|
|
354128
354608
|
var getYarnCache = function (context, policy) {
|
|
354129
354609
|
var _a;
|
|
354130
354610
|
if (policy === void 0) {
|
|
@@ -354154,9 +354634,9 @@ var getNodeModulesCache = function (context, policy) {
|
|
|
354154
354634
|
// if component is in a shared workspace, use workspace cache. use individual cache else
|
|
354155
354635
|
key: componentIsInWorkspace ? "node-modules-workspace" : (0, slugify_1["default"])(context.componentConfig.dir) + "-node-modules",
|
|
354156
354636
|
policy: policy,
|
|
354157
|
-
paths: __spreadArray([], __read(componentIsInWorkspace ? __spreadArray(["node_modules"], __read((_c = (_b = context.packageManagerInfo) === null || _b === void 0 ? void 0 : _b.workspaces.map(function (w) {
|
|
354637
|
+
paths: __spreadArray([], __read(componentIsInWorkspace ? (0, lodash_1.uniq)(__spreadArray(["node_modules"], __read((_c = (_b = context.packageManagerInfo) === null || _b === void 0 ? void 0 : _b.workspaces.map(function (w) {
|
|
354158
354638
|
return (0, path_1.join)(w.location, "node_modules");
|
|
354159
|
-
})) !== null && _c !== void 0 ? _c : []), false) : [(0, path_1.join)(context.componentConfig.dir, "node_modules")]), false)
|
|
354639
|
+
})) !== null && _c !== void 0 ? _c : []), false)) : [(0, path_1.join)(context.componentConfig.dir, "node_modules")]), false)
|
|
354160
354640
|
}];
|
|
354161
354641
|
};
|
|
354162
354642
|
exports.getNodeModulesCache = getNodeModulesCache;
|
|
@@ -354188,7 +354668,6 @@ exports.__esModule = true;
|
|
|
354188
354668
|
exports.NODE_RUNNER_BUILD_VARIABLES = void 0;
|
|
354189
354669
|
exports.NODE_RUNNER_BUILD_VARIABLES = {
|
|
354190
354670
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
354191
|
-
KUBERNETES_CPU_LIMIT: "2",
|
|
354192
354671
|
KUBERNETES_MEMORY_REQUEST: "2Gi",
|
|
354193
354672
|
KUBERNETES_MEMORY_LIMIT: "4Gi"
|
|
354194
354673
|
};
|
|
@@ -354324,7 +354803,7 @@ var createMeteorBuildJobs = function (context) {
|
|
|
354324
354803
|
}
|
|
354325
354804
|
} : undefined,
|
|
354326
354805
|
dockerBuild: {
|
|
354327
|
-
script: (0, docker_1.getDockerBuildDefaultScript)("ensureMeteorDockerfile"),
|
|
354806
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context, "ensureMeteorDockerfile"),
|
|
354328
354807
|
variables: {
|
|
354329
354808
|
METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? "true" : ""
|
|
354330
354809
|
}
|
|
@@ -354421,14 +354900,14 @@ var createNodeTestJobs = function (context) {
|
|
|
354421
354900
|
}, base), {
|
|
354422
354901
|
image: (_l = (_k = buildConfig.lint) === null || _k === void 0 ? void 0 : _k.jobImage) !== null && _l !== void 0 ? _l : defaultImage,
|
|
354423
354902
|
cache: (0, cache_1.getNodeCache)(context),
|
|
354424
|
-
script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(yarnInstall), false), __read((_o = (0, utils_1.ensureArray)((_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.command)) !== null && _o !== void 0 ? _o : ["yarn lint"]), false)
|
|
354903
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read(yarnInstall), false), __read((_o = (0, utils_1.ensureArray)((_m = buildConfig.lint) === null || _m === void 0 ? void 0 : _m.command)) !== null && _o !== void 0 ? _o : ["yarn lint"]), false)
|
|
354425
354904
|
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_p = buildConfig.lint) === null || _p === void 0 ? void 0 : _p.artifactsReports, (_q = buildConfig.lint) === null || _q === void 0 ? void 0 : _q.artifacts)) : null;
|
|
354426
354905
|
var testJob = buildConfig.test !== false ? __assign(__assign(__assign({
|
|
354427
354906
|
name: "🧪 test"
|
|
354428
354907
|
}, base), {
|
|
354429
354908
|
image: (_s = (_r = buildConfig.test) === null || _r === void 0 ? void 0 : _r.jobImage) !== null && _s !== void 0 ? _s : (0, runner_1.getRunnerImage)("jobs-testing-chrome"),
|
|
354430
354909
|
cache: (0, cache_1.getNodeCache)(context),
|
|
354431
|
-
script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(yarnInstall), false), __read((_u = (0, utils_1.ensureArray)((_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.command)) !== null && _u !== void 0 ? _u : ["yarn test"]), false)
|
|
354910
|
+
script: __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, yarn_1.ensureNodeVersion)(context)), false), ["cd ".concat(context.componentConfig.dir)], false), __read(yarnInstall), false), __read((_u = (0, utils_1.ensureArray)((_t = buildConfig.test) === null || _t === void 0 ? void 0 : _t.command)) !== null && _u !== void 0 ? _u : ["yarn test"]), false)
|
|
354432
354911
|
}), (0, createArtifactsConfig_1.createArtifactsConfig)(context.componentConfig.dir, (_v = buildConfig.test) === null || _v === void 0 ? void 0 : _v.artifactsReports, (_w = buildConfig.test) === null || _w === void 0 ? void 0 : _w.artifacts)) : null;
|
|
354433
354912
|
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
354434
354913
|
};
|
|
@@ -354476,6 +354955,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
354476
354955
|
exports.__esModule = true;
|
|
354477
354956
|
exports.getDockerAppCopyAndBuildScript = exports.getYarnInstall = exports.ensureNodeVersion = void 0;
|
|
354478
354957
|
var utils_1 = __nccwpck_require__(37461);
|
|
354958
|
+
var gitlab_1 = __nccwpck_require__(84997);
|
|
354479
354959
|
var YARN_INSTALL_CLASSIC = "yarn install --frozen-lockfile";
|
|
354480
354960
|
// FIXME: check why and when rebuild is needed
|
|
354481
354961
|
var YARN_BERRY_PROD_REBUILD = "yarn workspaces focus --production && yarn rebuild";
|
|
@@ -354487,13 +354967,13 @@ var getYarnInstallCommand = function (context) {
|
|
|
354487
354967
|
return "yarn install --immutable";
|
|
354488
354968
|
};
|
|
354489
354969
|
var ensureNodeVersion = function (context) {
|
|
354490
|
-
return ["if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi", "if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi"];
|
|
354970
|
+
return (0, gitlab_1.collapseableSection)("nodeinstall", "Ensure node version")(["if [ -f ~/.nvm/nvm.sh ]; then source ~/.nvm/nvm.sh; fi", "if command -v nvm &> /dev/null && [ -f ./.nvmrc ]; then nvm install; fi"]);
|
|
354491
354971
|
};
|
|
354492
354972
|
exports.ensureNodeVersion = ensureNodeVersion;
|
|
354493
354973
|
var getYarnInstall = function (context, options) {
|
|
354494
354974
|
var _a;
|
|
354495
354975
|
var postInstall = "postInstall" in context.componentConfig.build ? context.componentConfig.build.postInstall : null;
|
|
354496
|
-
return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), [getYarnInstallCommand(context)], false), __read(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall) ? (_a = (0, utils_1.ensureArray)(postInstall)) !== null && _a !== void 0 ? _a : [] : []), false);
|
|
354976
|
+
return __spreadArray(__spreadArray(__spreadArray([], __read((0, exports.ensureNodeVersion)(context)), false), __read((0, gitlab_1.collapseableSection)("yarninstall", "Yarn install")([getYarnInstallCommand(context)])), false), __read(postInstall && !(options === null || options === void 0 ? void 0 : options.noCustomPostInstall) ? (0, gitlab_1.collapseableSection)("postinstall", "Custom post install")((_a = (0, utils_1.ensureArray)(postInstall)) !== null && _a !== void 0 ? _a : []) : []), false);
|
|
354497
354977
|
};
|
|
354498
354978
|
exports.getYarnInstall = getYarnInstall;
|
|
354499
354979
|
var DOCKER_COPY_FILES = "COPY --chown=node:node $APP_DIR .";
|
|
@@ -354555,6 +355035,15 @@ var __read = this && this.__read || function (o, n) {
|
|
|
354555
355035
|
}
|
|
354556
355036
|
return ar;
|
|
354557
355037
|
};
|
|
355038
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
355039
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
355040
|
+
if (ar || !(i in from)) {
|
|
355041
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
355042
|
+
ar[i] = from[i];
|
|
355043
|
+
}
|
|
355044
|
+
}
|
|
355045
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
355046
|
+
};
|
|
354558
355047
|
exports.__esModule = true;
|
|
354559
355048
|
exports.createRailsBuildJobs = void 0;
|
|
354560
355049
|
var base_1 = __nccwpck_require__(18035);
|
|
@@ -354567,6 +355056,15 @@ var createRailsBuildJobs = function (context) {
|
|
|
354567
355056
|
// should not happen
|
|
354568
355057
|
throw new Error("build type is not rails");
|
|
354569
355058
|
}
|
|
355059
|
+
if ((0, docker_1.hasDockerfile)(context)) {
|
|
355060
|
+
return (0, base_1.createBuildJobs)(context, {
|
|
355061
|
+
appBuild: undefined,
|
|
355062
|
+
dockerBuild: {
|
|
355063
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context),
|
|
355064
|
+
variables: {}
|
|
355065
|
+
}
|
|
355066
|
+
});
|
|
355067
|
+
}
|
|
354570
355068
|
var cnbConf = buildConfig.cnbBuilder;
|
|
354571
355069
|
var packEnvArgs = Object.entries((_a = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.buildVars) !== null && _a !== void 0 ? _a : {}).map(function (_a) {
|
|
354572
355070
|
var _b = __read(_a, 2),
|
|
@@ -354579,9 +355077,9 @@ var createRailsBuildJobs = function (context) {
|
|
|
354579
355077
|
dockerBuild: {
|
|
354580
355078
|
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.componentConfig.build.extraVars),
|
|
354581
355079
|
// custom script
|
|
354582
|
-
script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
|
|
355080
|
+
script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), ["docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "/pack-v").concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packVersion, "-linux.tgz | tar -zx --directory /usr/local/bin pack"), "chmod +x /usr/local/bin/pack",
|
|
354583
355081
|
// replace private git ssh gem sources with https to make bundler with credentials via env var work
|
|
354584
|
-
"sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs, " ").concat((_c = (_b = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : "")]
|
|
355082
|
+
"sed --in-place 's|git@\\([^:]*\\):|https://\\1/|g' Gemfile Gemfile.lock", "pack build \"$DOCKER_IMAGE:$DOCKER_IMAGE_TAG\" --builder '".concat(cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.image, "' --publish --cache-image \"$DOCKER_CACHE_IMAGE\" ").concat(packEnvArgs, " ").concat((_c = (_b = cnbConf === null || cnbConf === void 0 ? void 0 : cnbConf.packExtraArgs) === null || _b === void 0 ? void 0 : _b.join(" ")) !== null && _c !== void 0 ? _c : "")], false)
|
|
354585
355083
|
}
|
|
354586
355084
|
});
|
|
354587
355085
|
};
|
|
@@ -354964,7 +355462,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
354964
355462
|
|
|
354965
355463
|
exports.__esModule = true;
|
|
354966
355464
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
354967
|
-
exports.PIPELINE_IMAGE_TAG = "refactor-
|
|
355465
|
+
exports.PIPELINE_IMAGE_TAG = "refactor-gcloud-auth-no-file-b43bf0d9" || 0;
|
|
354968
355466
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
354969
355467
|
|
|
354970
355468
|
/***/ }),
|
|
@@ -355395,7 +355893,7 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
|
|
|
355395
355893
|
alreadyVisited = {};
|
|
355396
355894
|
}
|
|
355397
355895
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
355398
|
-
var environmentContext, envConfigRaw, deployConfigRaw, buildConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegacyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
|
|
355896
|
+
var environmentContext, envConfigRaw, deployConfigRaw, buildConfigRaw, envType, basePredefinedVariables, predefinedVariables, host, url, devLocalConfig, port, additionalEnvVars, HOST_INTERNAL, publicEnvVarsRaw, additionalSecretKeys, secretEnvVarKeys, secretEnvVars, legacyFromComponents, publicEnvVarsRawWithLegacyFromComponents, publicEnvVarsRawSanitized, envVarsRaw, envVars;
|
|
355399
355897
|
var _a, _b;
|
|
355400
355898
|
var _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
355401
355899
|
return __generator(this, function (_m) {
|
|
@@ -355419,16 +355917,21 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
|
|
|
355419
355917
|
predefinedVariables = {
|
|
355420
355918
|
ENV_SHORT: "local",
|
|
355421
355919
|
ROOT_URL: url,
|
|
355920
|
+
HOST_INTERNAL: host,
|
|
355921
|
+
ROOT_URL_INTERNAL: "http://" + host,
|
|
355422
355922
|
PORT: port.toString()
|
|
355423
355923
|
};
|
|
355424
355924
|
} else {
|
|
355425
355925
|
additionalEnvVars = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext) : {};
|
|
355426
|
-
|
|
355926
|
+
HOST_INTERNAL = (_d = additionalEnvVars.HOST_INTERNAL) !== null && _d !== void 0 ? _d : "unknown-host.example.com";
|
|
355927
|
+
host = (_e = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _e !== void 0 ? _e : HOST_INTERNAL;
|
|
355427
355928
|
url = "https://".concat(host);
|
|
355428
355929
|
predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), config.components[componentName].build.type === "rails" ? {} : {
|
|
355429
355930
|
HOST: host
|
|
355430
355931
|
}), {
|
|
355431
|
-
ROOT_URL: url
|
|
355932
|
+
ROOT_URL: url,
|
|
355933
|
+
HOST_CANONICAL: HOST_INTERNAL,
|
|
355934
|
+
ROOT_URL_INTERNAL: "https://" + HOST_INTERNAL
|
|
355432
355935
|
}), additionalEnvVars);
|
|
355433
355936
|
}
|
|
355434
355937
|
publicEnvVarsRaw = (_g = (_f = envConfigRaw.vars) === null || _f === void 0 ? void 0 : _f.public) !== null && _g !== void 0 ? _g : {};
|
|
@@ -356279,7 +356782,7 @@ var createDeployJob = function (context, jobDefinition) {
|
|
|
356279
356782
|
var _a, _b, _c, _d;
|
|
356280
356783
|
var hasDocker = (0, docker_1.requiresDockerBuild)(context);
|
|
356281
356784
|
var isStoppable = (0, utils_1.contextIsStoppable)(context);
|
|
356282
|
-
var autoStop = context.environment.envType === "review" ? "
|
|
356785
|
+
var autoStop = context.environment.envType === "review" ? "1 week" : context.environment.envType === "dev" ? "4 weeks" : undefined;
|
|
356283
356786
|
// if auto or manual is configured explicitly, use that
|
|
356284
356787
|
var whenDeployDefined = context.componentConfig.deploy && context.componentConfig.deploy.when ? context.componentConfig.deploy.when : undefined;
|
|
356285
356788
|
// otherwise auto deploy if env is not prod. If its prod, deploy automatically if stage is disabled
|
|
@@ -356483,13 +356986,269 @@ exports.__esModule = true;
|
|
|
356483
356986
|
exports.DEPLOY_RUNNER_VARIABLES = void 0;
|
|
356484
356987
|
exports.DEPLOY_RUNNER_VARIABLES = {
|
|
356485
356988
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
356486
|
-
KUBERNETES_CPU_LIMIT: "1",
|
|
356487
356989
|
KUBERNETES_MEMORY_REQUEST: "200Mi",
|
|
356488
356990
|
KUBERNETES_MEMORY_LIMIT: "400Mi"
|
|
356489
356991
|
};
|
|
356490
356992
|
|
|
356491
356993
|
/***/ }),
|
|
356492
356994
|
|
|
356995
|
+
/***/ 28159:
|
|
356996
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
356997
|
+
|
|
356998
|
+
"use strict";
|
|
356999
|
+
|
|
357000
|
+
|
|
357001
|
+
var __read = this && this.__read || function (o, n) {
|
|
357002
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
357003
|
+
if (!m) return o;
|
|
357004
|
+
var i = m.call(o),
|
|
357005
|
+
r,
|
|
357006
|
+
ar = [],
|
|
357007
|
+
e;
|
|
357008
|
+
try {
|
|
357009
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
357010
|
+
} catch (error) {
|
|
357011
|
+
e = {
|
|
357012
|
+
error: error
|
|
357013
|
+
};
|
|
357014
|
+
} finally {
|
|
357015
|
+
try {
|
|
357016
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
357017
|
+
} finally {
|
|
357018
|
+
if (e) throw e.error;
|
|
357019
|
+
}
|
|
357020
|
+
}
|
|
357021
|
+
return ar;
|
|
357022
|
+
};
|
|
357023
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
357024
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
357025
|
+
if (ar || !(i in from)) {
|
|
357026
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
357027
|
+
ar[i] = from[i];
|
|
357028
|
+
}
|
|
357029
|
+
}
|
|
357030
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
357031
|
+
};
|
|
357032
|
+
exports.__esModule = true;
|
|
357033
|
+
exports.getDeleteUnusedImagesCommands = exports.getArtifactsRegistryImage = exports.getArtifactsRegistryBuildCacheImage = exports.getArtifactsRegistryImageName = exports.getArtifactsRegistryDockerUrl = exports.getArtifactsRegistryHost = void 0;
|
|
357034
|
+
var gitlab_1 = __nccwpck_require__(84997);
|
|
357035
|
+
var types_1 = __nccwpck_require__(63109);
|
|
357036
|
+
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(77547);
|
|
357037
|
+
var getArtifactsRegistryHost = function (_a) {
|
|
357038
|
+
var deploy = _a.componentConfig.deploy;
|
|
357039
|
+
if (!(0, types_1.isOfDeployType)(deploy, "google-cloudrun")) {
|
|
357040
|
+
// should not happen
|
|
357041
|
+
throw new Error("deploy config is wrong");
|
|
357042
|
+
}
|
|
357043
|
+
return "".concat(deploy.region, "-docker.pkg.dev");
|
|
357044
|
+
};
|
|
357045
|
+
exports.getArtifactsRegistryHost = getArtifactsRegistryHost;
|
|
357046
|
+
var getArtifactsRegistryDockerUrl = function (context) {
|
|
357047
|
+
var deployConfig = context.componentConfig.deploy;
|
|
357048
|
+
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
357049
|
+
// should not happen
|
|
357050
|
+
throw new Error("deploy config is wrong");
|
|
357051
|
+
}
|
|
357052
|
+
var fullAppName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName);
|
|
357053
|
+
return "".concat((0, exports.getArtifactsRegistryHost)(context), "/").concat(deployConfig.projectId, "/catladder-deploy/").concat(fullAppName);
|
|
357054
|
+
};
|
|
357055
|
+
exports.getArtifactsRegistryDockerUrl = getArtifactsRegistryDockerUrl;
|
|
357056
|
+
/**
|
|
357057
|
+
*
|
|
357058
|
+
* lecacyReviewImageName is only temporary. In old versions the images had no reviewslug in review apps, which makes cleanup harder. We delete all those images now, but need the path
|
|
357059
|
+
*/
|
|
357060
|
+
var getArtifactsRegistryImageName = function (context, lecacyReviewImageName) {
|
|
357061
|
+
var _a;
|
|
357062
|
+
if (lecacyReviewImageName === void 0) {
|
|
357063
|
+
lecacyReviewImageName = false;
|
|
357064
|
+
}
|
|
357065
|
+
if (lecacyReviewImageName && context.environment.envType !== "review") {
|
|
357066
|
+
throw new Error("lecacyReviewImageName is only allowed for review app");
|
|
357067
|
+
}
|
|
357068
|
+
var dockerUrl = (0, exports.getArtifactsRegistryDockerUrl)(context);
|
|
357069
|
+
var gcloudImagePath = __spreadArray([dockerUrl, context.environment.shortName, context.componentName], __read(context.environment.envType === "review" && !lecacyReviewImageName ? [(_a = context.commitInfo) === null || _a === void 0 ? void 0 : _a.reviewSlug] : []), false);
|
|
357070
|
+
return gcloudImagePath.join("/");
|
|
357071
|
+
};
|
|
357072
|
+
exports.getArtifactsRegistryImageName = getArtifactsRegistryImageName;
|
|
357073
|
+
var getArtifactsRegistryBuildCacheImage = function (context) {
|
|
357074
|
+
var dockerUrl = (0, exports.getArtifactsRegistryDockerUrl)(context);
|
|
357075
|
+
// does not include env, so that after merge, you might get more cache hits (review-->dev)
|
|
357076
|
+
var gcloudImagePath = [dockerUrl, "caches", context.componentName];
|
|
357077
|
+
return gcloudImagePath.join("/");
|
|
357078
|
+
};
|
|
357079
|
+
exports.getArtifactsRegistryBuildCacheImage = getArtifactsRegistryBuildCacheImage;
|
|
357080
|
+
var getArtifactsRegistryImage = function (context) {
|
|
357081
|
+
return "".concat((0, exports.getArtifactsRegistryImageName)(context), ":$DOCKER_IMAGE_TAG");
|
|
357082
|
+
};
|
|
357083
|
+
exports.getArtifactsRegistryImage = getArtifactsRegistryImage;
|
|
357084
|
+
var getDeleteImageCommands = function (fullImageName, keepNewest) {
|
|
357085
|
+
if (keepNewest === void 0) {
|
|
357086
|
+
keepNewest = 0;
|
|
357087
|
+
}
|
|
357088
|
+
if (keepNewest === 0) {
|
|
357089
|
+
// no need to list tags, we delete the whole thing
|
|
357090
|
+
return ["gcloud artifacts docker images delete ".concat(fullImageName, " --quiet --delete-tags")];
|
|
357091
|
+
}
|
|
357092
|
+
// delete unused tags
|
|
357093
|
+
var listAllImagesCommand = "gcloud artifacts docker images list ".concat(fullImageName, " --sort-by=~CREATE_TIME --format=\"value(version)\"");
|
|
357094
|
+
var listImagesToDeletecommand = (0, removeFirstLinesFromCommandOutput_1.removeFirstLinesFromCommandOutput)(listAllImagesCommand, keepNewest);
|
|
357095
|
+
var deleteImageCommand = "gcloud artifacts docker images delete ".concat(fullImageName, "@$version --quiet --delete-tags");
|
|
357096
|
+
var deleteImagesCommand = "".concat(listImagesToDeletecommand, " | while read -r version; do ").concat(deleteImageCommand, "; done");
|
|
357097
|
+
return [deleteImagesCommand];
|
|
357098
|
+
};
|
|
357099
|
+
/**
|
|
357100
|
+
* commands to delete unused images.
|
|
357101
|
+
*
|
|
357102
|
+
* @param context
|
|
357103
|
+
* @param keep how many of the newest images to keep
|
|
357104
|
+
* @returns
|
|
357105
|
+
*/
|
|
357106
|
+
var getDeleteUnusedImagesCommands = function (context, keep) {
|
|
357107
|
+
if (keep === void 0) {
|
|
357108
|
+
keep = 0;
|
|
357109
|
+
}
|
|
357110
|
+
var deployConfig = context.componentConfig.deploy;
|
|
357111
|
+
if (deployConfig === false) {
|
|
357112
|
+
return [];
|
|
357113
|
+
}
|
|
357114
|
+
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
357115
|
+
// should not happen
|
|
357116
|
+
throw new Error("deploy config is wrong");
|
|
357117
|
+
}
|
|
357118
|
+
var fullImageName = (0, exports.getArtifactsRegistryImageName)(context);
|
|
357119
|
+
var buildCacheImageName = (0, exports.getArtifactsRegistryBuildCacheImage)(context);
|
|
357120
|
+
return __spreadArray(__spreadArray(__spreadArray([], __read(getDeleteImageCommands(fullImageName, keep)), false), __read(getDeleteImageCommands(buildCacheImageName, 1)), false), __read(context.environment.envType === "review" ? (0, gitlab_1.allowFailureInScripts)(getDeleteImageCommands((0, exports.getArtifactsRegistryImageName)(context, true), 0)) : []), false);
|
|
357121
|
+
};
|
|
357122
|
+
exports.getDeleteUnusedImagesCommands = getDeleteUnusedImagesCommands;
|
|
357123
|
+
|
|
357124
|
+
/***/ }),
|
|
357125
|
+
|
|
357126
|
+
/***/ 10964:
|
|
357127
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
357128
|
+
|
|
357129
|
+
"use strict";
|
|
357130
|
+
|
|
357131
|
+
|
|
357132
|
+
var __read = this && this.__read || function (o, n) {
|
|
357133
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
357134
|
+
if (!m) return o;
|
|
357135
|
+
var i = m.call(o),
|
|
357136
|
+
r,
|
|
357137
|
+
ar = [],
|
|
357138
|
+
e;
|
|
357139
|
+
try {
|
|
357140
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
357141
|
+
} catch (error) {
|
|
357142
|
+
e = {
|
|
357143
|
+
error: error
|
|
357144
|
+
};
|
|
357145
|
+
} finally {
|
|
357146
|
+
try {
|
|
357147
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
357148
|
+
} finally {
|
|
357149
|
+
if (e) throw e.error;
|
|
357150
|
+
}
|
|
357151
|
+
}
|
|
357152
|
+
return ar;
|
|
357153
|
+
};
|
|
357154
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
357155
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
357156
|
+
if (ar || !(i in from)) {
|
|
357157
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
357158
|
+
ar[i] = from[i];
|
|
357159
|
+
}
|
|
357160
|
+
}
|
|
357161
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
357162
|
+
};
|
|
357163
|
+
exports.__esModule = true;
|
|
357164
|
+
exports.getRemoveOldRevisionsAndImagesCommand = void 0;
|
|
357165
|
+
var artifactsRegistry_1 = __nccwpck_require__(28159);
|
|
357166
|
+
var cloudRunRevisions_1 = __nccwpck_require__(31101);
|
|
357167
|
+
var getRemoveOldRevisionsAndImagesCommand = function (context, when) {
|
|
357168
|
+
if (when === "onStop") {
|
|
357169
|
+
// service is already deleted, so we don't need to delete old revisions, just delete all images
|
|
357170
|
+
return (0, artifactsRegistry_1.getDeleteUnusedImagesCommands)(context);
|
|
357171
|
+
}
|
|
357172
|
+
// this number only targets inactive revisions
|
|
357173
|
+
var revisionsToKeep = context.environment.envType === "prod" ? 5 : 0;
|
|
357174
|
+
// this number needs to be higher than inactive after deploy, so we add one
|
|
357175
|
+
var imagesToKeep = revisionsToKeep + 1;
|
|
357176
|
+
var deleteOldRevisionsCommands = (0, cloudRunRevisions_1.getDeleteUnusedRevisionsCommands)(context, revisionsToKeep);
|
|
357177
|
+
var deleteOldImagesCommands = (0, artifactsRegistry_1.getDeleteUnusedImagesCommands)(context, imagesToKeep);
|
|
357178
|
+
return __spreadArray(__spreadArray([], __read(deleteOldRevisionsCommands), false), __read(deleteOldImagesCommands), false);
|
|
357179
|
+
};
|
|
357180
|
+
exports.getRemoveOldRevisionsAndImagesCommand = getRemoveOldRevisionsAndImagesCommand;
|
|
357181
|
+
|
|
357182
|
+
/***/ }),
|
|
357183
|
+
|
|
357184
|
+
/***/ 31101:
|
|
357185
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
357186
|
+
|
|
357187
|
+
"use strict";
|
|
357188
|
+
|
|
357189
|
+
|
|
357190
|
+
var __assign = this && this.__assign || function () {
|
|
357191
|
+
__assign = Object.assign || function (t) {
|
|
357192
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
357193
|
+
s = arguments[i];
|
|
357194
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
357195
|
+
}
|
|
357196
|
+
return t;
|
|
357197
|
+
};
|
|
357198
|
+
return __assign.apply(this, arguments);
|
|
357199
|
+
};
|
|
357200
|
+
exports.__esModule = true;
|
|
357201
|
+
exports.getDeleteUnusedRevisionsCommands = void 0;
|
|
357202
|
+
var types_1 = __nccwpck_require__(63109);
|
|
357203
|
+
var createArgsString_1 = __nccwpck_require__(8686);
|
|
357204
|
+
var getServiceName_1 = __nccwpck_require__(89391);
|
|
357205
|
+
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(77547);
|
|
357206
|
+
var getListRevisionsCommand = function (context, args) {
|
|
357207
|
+
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
357208
|
+
var deployConfig = context.componentConfig.deploy;
|
|
357209
|
+
if (!deployConfig || !(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
357210
|
+
// should not happen
|
|
357211
|
+
throw new Error("deploy config is wrong");
|
|
357212
|
+
}
|
|
357213
|
+
var filterRevisionArgs = __assign({
|
|
357214
|
+
project: deployConfig.projectId,
|
|
357215
|
+
region: deployConfig.region,
|
|
357216
|
+
// only show inactive revisions
|
|
357217
|
+
service: serviceName,
|
|
357218
|
+
limit: "unlimited",
|
|
357219
|
+
"sort-by": "metadata.creationTimestamp"
|
|
357220
|
+
}, args);
|
|
357221
|
+
// this prints out all inactive images of the given app
|
|
357222
|
+
return "gcloud run revisions list ".concat((0, createArgsString_1.createArgsString)(filterRevisionArgs));
|
|
357223
|
+
};
|
|
357224
|
+
var getDeleteUnusedRevisionsCommands = function (context, keep) {
|
|
357225
|
+
var deployConfig = context.componentConfig.deploy;
|
|
357226
|
+
if (deployConfig === false) {
|
|
357227
|
+
return [];
|
|
357228
|
+
}
|
|
357229
|
+
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
357230
|
+
// should not happen
|
|
357231
|
+
throw new Error("deploy config is wrong");
|
|
357232
|
+
}
|
|
357233
|
+
// this prints out all inactive images of the given app
|
|
357234
|
+
var listAllInactiveRevisionsCmd = getListRevisionsCommand(context, {
|
|
357235
|
+
format: "\"value(name)\"",
|
|
357236
|
+
filter: "'(status.conditions.status=False OR status.conditions.status=Unknown)'"
|
|
357237
|
+
});
|
|
357238
|
+
// this removes the newest `revisionsToKeep` images
|
|
357239
|
+
var listRevisionsToDeleteCmd = (0, removeFirstLinesFromCommandOutput_1.removeFirstLinesFromCommandOutput)(listAllInactiveRevisionsCmd, keep);
|
|
357240
|
+
var deleteRevisionCmd = "gcloud run revisions delete ".concat((0, createArgsString_1.createArgsString)({
|
|
357241
|
+
project: deployConfig.projectId,
|
|
357242
|
+
region: deployConfig.region,
|
|
357243
|
+
quiet: true
|
|
357244
|
+
}), " $revisionname ");
|
|
357245
|
+
var deleteRevisionsCmd = "".concat(listRevisionsToDeleteCmd, " | while read -r revisionname; do ").concat(deleteRevisionCmd, "; done");
|
|
357246
|
+
return [deleteRevisionsCmd];
|
|
357247
|
+
};
|
|
357248
|
+
exports.getDeleteUnusedRevisionsCommands = getDeleteUnusedRevisionsCommands;
|
|
357249
|
+
|
|
357250
|
+
/***/ }),
|
|
357251
|
+
|
|
356493
357252
|
/***/ 82256:
|
|
356494
357253
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
356495
357254
|
|
|
@@ -356553,9 +357312,20 @@ var createArgsString_1 = __nccwpck_require__(8686);
|
|
|
356553
357312
|
var database_1 = __nccwpck_require__(41384);
|
|
356554
357313
|
var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(22607);
|
|
356555
357314
|
var jobName_1 = __nccwpck_require__(77311);
|
|
356556
|
-
var
|
|
357315
|
+
var artifactsRegistry_1 = __nccwpck_require__(28159);
|
|
357316
|
+
var getServiceName_1 = __nccwpck_require__(89391);
|
|
357317
|
+
var cleanup_1 = __nccwpck_require__(10964);
|
|
357318
|
+
var setGoogleProjectNumberScript = function (deployConfig) {
|
|
356557
357319
|
return ["export GCLOUD_PROJECT_NUMBER=$(gcloud projects describe ".concat(deployConfig.projectId, " --format=\"value(projectNumber)\")"), "echo \"GCLOUD_PROJECT_NUMBER: $GCLOUD_PROJECT_NUMBER\""];
|
|
356558
357320
|
};
|
|
357321
|
+
var makeLabelString = function (obj) {
|
|
357322
|
+
return Object.entries(obj).map(function (_a) {
|
|
357323
|
+
var _b = __read(_a, 2),
|
|
357324
|
+
key = _b[0],
|
|
357325
|
+
value = _b[1];
|
|
357326
|
+
return "".concat(key, "=").concat(value);
|
|
357327
|
+
}).join(",");
|
|
357328
|
+
};
|
|
356559
357329
|
var createGoogleCloudRunDeployJobs = function (context) {
|
|
356560
357330
|
var _a, _b, _c;
|
|
356561
357331
|
var deployConfig = context.componentConfig.deploy;
|
|
@@ -356566,28 +357336,17 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
356566
357336
|
// should not happen
|
|
356567
357337
|
throw new Error("deploy config is wrong");
|
|
356568
357338
|
}
|
|
356569
|
-
var fullAppName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName);
|
|
356570
|
-
var dockerUrl = "".concat(deployConfig.region, "-docker.pkg.dev/").concat(deployConfig.projectId, "/catladder-deploy/").concat(fullAppName);
|
|
356571
|
-
var gcloudImageName = "".concat(dockerUrl, "/").concat(context.environment.shortName, "/").concat(context.componentName, ":$DOCKER_IMAGE_TAG");
|
|
356572
|
-
var pushImageToArtifactsRegistry = [docker_1.gitlabDockerLogin, "gcloud auth configure-docker ".concat(deployConfig.region, "-docker.pkg.dev"), "docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG ".concat(gcloudImageName), "docker push ".concat(gcloudImageName)];
|
|
356573
357339
|
var allEnvVars = (0, lodash_1.omit)(context.environment.envVars, _1.GCLOUD_DEPLOY_CREDENTIALS_KEY);
|
|
356574
|
-
var labelsString = Object.entries((0, getLabels_1.getLabels)(context)).map(function (_a) {
|
|
356575
|
-
var _b = __read(_a, 2),
|
|
356576
|
-
key = _b[0],
|
|
356577
|
-
value = _b[1];
|
|
356578
|
-
return "".concat(key, "=").concat(value);
|
|
356579
|
-
}).join(",");
|
|
356580
357340
|
var commonArgs = {
|
|
356581
357341
|
project: deployConfig.projectId,
|
|
356582
357342
|
region: deployConfig.region
|
|
356583
357343
|
};
|
|
356584
357344
|
var commonDeployArgs = __assign(__assign({
|
|
356585
|
-
image:
|
|
357345
|
+
image: (0, artifactsRegistry_1.getArtifactsRegistryImage)(context)
|
|
356586
357346
|
}, commonArgs), {
|
|
356587
|
-
"set-cloudsql-instances": deployConfig.cloudSql ? deployConfig.cloudSql.instanceConnectionName : undefined
|
|
356588
|
-
labels: labelsString
|
|
357347
|
+
"set-cloudsql-instances": deployConfig.cloudSql ? deployConfig.cloudSql.instanceConnectionName : undefined
|
|
356589
357348
|
});
|
|
356590
|
-
var serviceName =
|
|
357349
|
+
var serviceName = (0, getServiceName_1.getServiceName)(context);
|
|
356591
357350
|
var getFullJobName = function (name) {
|
|
356592
357351
|
return (0, jobName_1.getCloudRunJobName)(context.environment.fullName, name);
|
|
356593
357352
|
};
|
|
@@ -356616,30 +357375,41 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
356616
357375
|
};
|
|
356617
357376
|
});
|
|
356618
357377
|
var getServiceDeployScript = function (service, nameSuffix) {
|
|
356619
|
-
var _a, _b, _c, _d;
|
|
357378
|
+
var _a, _b, _c, _d, _e;
|
|
356620
357379
|
var customConfig = service !== true ? service : undefined;
|
|
356621
357380
|
var command = service !== true ? (_a = service === null || service === void 0 ? void 0 : service.command) !== null && _a !== void 0 ? _a : context.componentConfig.build.startCommand : undefined;
|
|
357381
|
+
var commandArray = command ? Array.isArray(command) ? command : command.split(" ") : undefined;
|
|
357382
|
+
var fullServiceName = "".concat(serviceName).concat(nameSuffix !== null && nameSuffix !== void 0 ? nameSuffix : "");
|
|
356622
357383
|
var argsString = (0, createArgsString_1.createArgsString)(__assign(__assign({
|
|
356623
357384
|
// command as empty string resets it to default (uses the image's entrypoint)
|
|
356624
|
-
command:
|
|
357385
|
+
command: commandArray ? '"' + commandArray.join(",") + '"' : '""'
|
|
356625
357386
|
}, commonDeployArgs), {
|
|
357387
|
+
labels: makeLabelString(__assign(__assign({}, (0, getLabels_1.getLabels)(context)), {
|
|
357388
|
+
"cloud-run-service-name": fullServiceName
|
|
357389
|
+
})),
|
|
356626
357390
|
"env-vars-file": "____envvars.yaml",
|
|
356627
357391
|
"min-instances": (_b = customConfig === null || customConfig === void 0 ? void 0 : customConfig.minInstances) !== null && _b !== void 0 ? _b : 0,
|
|
356628
357392
|
"max-instances": (_c = customConfig === null || customConfig === void 0 ? void 0 : customConfig.maxInstances) !== null && _c !== void 0 ? _c : 100,
|
|
356629
357393
|
"cpu-throttling": (customConfig === null || customConfig === void 0 ? void 0 : customConfig.noCpuThrottling) !== true,
|
|
356630
357394
|
memory: customConfig === null || customConfig === void 0 ? void 0 : customConfig.memory,
|
|
356631
357395
|
"allow-unauthenticated": (_d = customConfig === null || customConfig === void 0 ? void 0 : customConfig.allowUnauthenticated) !== null && _d !== void 0 ? _d : true,
|
|
357396
|
+
ingress: (_e = customConfig === null || customConfig === void 0 ? void 0 : customConfig.ingress) !== null && _e !== void 0 ? _e : "all",
|
|
356632
357397
|
"cpu-boost": true
|
|
356633
357398
|
}));
|
|
356634
|
-
return "gcloud run deploy ".concat(
|
|
357399
|
+
return "gcloud run deploy ".concat(fullServiceName, " ").concat(argsString);
|
|
356635
357400
|
};
|
|
356636
357401
|
var getJobCreateScriptsForJob = function (jobName, job) {
|
|
356637
357402
|
// due to some oversight from google, jobs create does not accept `--env-vars-file` 🤦
|
|
356638
357403
|
// lucky, update on the other hand accepts it... so let's just imediatly update it
|
|
356639
357404
|
// also we cannot upsert a job, so we have to create it and catch the error and then update
|
|
357405
|
+
var commandArray = Array.isArray(job.command) ? job.command : job.command.split(" ");
|
|
356640
357406
|
var commonDeployArgsString = (0, createArgsString_1.createArgsString)(__assign(__assign({
|
|
356641
|
-
command: '"' +
|
|
357407
|
+
command: '"' + commandArray.join(",") + '"'
|
|
356642
357408
|
}, commonDeployArgs), {
|
|
357409
|
+
labels: makeLabelString(__assign(__assign({}, (0, getLabels_1.getLabels)(context)), {
|
|
357410
|
+
"cloud-run-job-name": jobName
|
|
357411
|
+
})),
|
|
357412
|
+
image: job.image || commonDeployArgs.image,
|
|
356643
357413
|
memory: job.memory || "512Mi",
|
|
356644
357414
|
"task-timeout": job.timeout || "10m"
|
|
356645
357415
|
}));
|
|
@@ -356654,8 +357424,8 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
356654
357424
|
return getJobCreateScriptsForJob(jobName, job);
|
|
356655
357425
|
}).flat();
|
|
356656
357426
|
};
|
|
356657
|
-
var getJobRunScriptForJob = function (jobName) {
|
|
356658
|
-
return "gcloud beta run jobs execute ".concat(jobName, " ").concat(commonArgsString);
|
|
357427
|
+
var getJobRunScriptForJob = function (jobName, wait) {
|
|
357428
|
+
return "gcloud beta run jobs execute ".concat(jobName, " ").concat(commonArgsString).concat(wait ? " --wait" : "");
|
|
356659
357429
|
};
|
|
356660
357430
|
var getJobRunScripts = function (when) {
|
|
356661
357431
|
return jobsWithNames.filter(function (_a) {
|
|
@@ -356663,7 +357433,9 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
356663
357433
|
return job.when === when;
|
|
356664
357434
|
}).map(function (_a) {
|
|
356665
357435
|
var jobName = _a.jobName;
|
|
356666
|
-
return getJobRunScriptForJob(jobName
|
|
357436
|
+
return getJobRunScriptForJob(jobName,
|
|
357437
|
+
// wait for completin on stop jobs, since stop will delete the jobs afterwards, so they will fail
|
|
357438
|
+
["preStop", "postStop"].includes(when));
|
|
356667
357439
|
});
|
|
356668
357440
|
};
|
|
356669
357441
|
var getCreateScheduleScripts = function () {
|
|
@@ -356703,18 +357475,19 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
356703
357475
|
"gcloud beta run jobs executions list ".concat(commonArgsString, " --job ").concat(jobName, " --format=\"value(name)\" | xargs -I {} gcloud beta run jobs executions delete {} --quiet ").concat(commonArgsString), "gcloud beta run jobs delete ".concat(jobName, " ").concat(commonArgsString)];
|
|
356704
357476
|
});
|
|
356705
357477
|
};
|
|
356706
|
-
var deployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(
|
|
357478
|
+
var deployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gitlab_1.collapseableSection)("prepare", "Prepare...")(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(setGoogleProjectNumberScript(deployConfig)), false))), false), __read((0, gitlab_1.collapseableSection)("deploy", "Deploy to cloud run")(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(["echo \"$ENV_VARS\" > ____envvars.yaml"], __read(deployConfig.cloudSql ? (0, database_1.getDatabaseCreateScript)(context, deployConfig) // we create the db, so that we can also delete it afterwards
|
|
356707
357479
|
: []), false), __read(getCreateScheduleScripts()), false), __read(getJobCreateScripts()), false), __read(getJobRunScripts("preDeploy")), false), __read(deployConfig.service !== false ? [getServiceDeployScript(deployConfig.service)] : []), false), __read(Object.entries((_b = deployConfig.additionalServices) !== null && _b !== void 0 ? _b : {}).map(function (_a) {
|
|
356708
357480
|
var _b = __read(_a, 2),
|
|
356709
357481
|
name = _b[0],
|
|
356710
357482
|
service = _b[1];
|
|
356711
357483
|
return getServiceDeployScript(service, "-" + name);
|
|
356712
|
-
})), false), __read(getJobRunScripts("postDeploy")), false),
|
|
356713
|
-
|
|
357484
|
+
})), false), __read(getJobRunScripts("postDeploy")), false))), false), __read((0, gitlab_1.collapseableSection)("cleanup", "Cleanup")((0, cleanup_1.getRemoveOldRevisionsAndImagesCommand)(context, "postDeploy") // we cleanup inactive images both on deploy and stop
|
|
357485
|
+
)), false), __read((0, sbom_1.getDependencyTrackUploadScript)(context)), false);
|
|
357486
|
+
var stopScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(getJobRunScripts("preStop")), false), __read(deployConfig.service !== false ? ["gcloud run services delete ".concat(serviceName, " ").concat(commonArgsString)] : []), false), __read(Object.entries((_c = deployConfig.additionalServices) !== null && _c !== void 0 ? _c : {}).map(function (_a) {
|
|
356714
357487
|
var _b = __read(_a, 1),
|
|
356715
357488
|
name = _b[0];
|
|
356716
357489
|
return "gcloud run services delete ".concat(serviceName, "-").concat(name, " ").concat(commonArgsString);
|
|
356717
|
-
})), false), __read(getDeleteSchedulesScripts()), false), __read(getDeleteJobsScripts()), false), __read(deployConfig.cloudSql && deployConfig.cloudSql.deleteDatabaseOnStop ? (0, database_1.getDatabaseDeleteScript)(context, deployConfig) : []), false), __read((0, sbom_1.getDependencyTrackDeleteScript)(context)), false);
|
|
357490
|
+
})), false), __read(getJobRunScripts("postStop")), false), __read(getDeleteSchedulesScripts()), false), __read(getDeleteJobsScripts()), false), __read(deployConfig.cloudSql && deployConfig.cloudSql.deleteDatabaseOnStop ? (0, database_1.getDatabaseDeleteScript)(context, deployConfig) : []), false), __read((0, cleanup_1.getRemoveOldRevisionsAndImagesCommand)(context, "onStop")), false), __read((0, sbom_1.getDependencyTrackDeleteScript)(context)), false);
|
|
356718
357491
|
return (0, base_1.createDeployementJobs)(context, {
|
|
356719
357492
|
deploy: (0, lodash_1.merge)((0, docker_1.getDockerJobBaseProps)(context), {
|
|
356720
357493
|
artifacts: {
|
|
@@ -356799,6 +357572,7 @@ var utils_1 = __nccwpck_require__(70463);
|
|
|
356799
357572
|
var deployJob_1 = __nccwpck_require__(82256);
|
|
356800
357573
|
var jobName_1 = __nccwpck_require__(77311);
|
|
356801
357574
|
exports.GCLOUD_DEPLOY_CREDENTIALS_KEY = "GCLOUD_DEPLOY_credentialsKey";
|
|
357575
|
+
// FIXME: rename to internalHostSuffix, but this means that project-setup needs to be rerun, so its kindof a breaking change
|
|
356802
357576
|
exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX = "GCLOUD_RUN_canonicalHostSuffix";
|
|
356803
357577
|
var getCloudSqlVariables = function (_a) {
|
|
356804
357578
|
var _b, _c;
|
|
@@ -356857,7 +357631,7 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
|
|
|
356857
357631
|
env = ctx.env,
|
|
356858
357632
|
componentName = ctx.componentName,
|
|
356859
357633
|
deployConfigRaw = ctx.deployConfigRaw;
|
|
356860
|
-
var
|
|
357634
|
+
var HOST_INTERNAL = fullName.toLowerCase() + "-" + ((_a = process.env[(0, context_1.getSecretVarName)(env, componentName, exports.GCLOUD_RUN_CANONICAL_HOST_SUFFIX)]) !== null && _a !== void 0 ? _a : "unknown-host.example.com");
|
|
356861
357635
|
var jobTriggers = deployConfigRaw && deployConfigRaw.jobs ? Object.fromEntries(Object.entries(deployConfigRaw.jobs).map(function (_a) {
|
|
356862
357636
|
var _b = __read(_a, 2),
|
|
356863
357637
|
name = _b[0],
|
|
@@ -356865,7 +357639,7 @@ exports.GCLOUD_RUN_DEPLOY_TYPE = {
|
|
|
356865
357639
|
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")];
|
|
356866
357640
|
})) : {};
|
|
356867
357641
|
return __assign(__assign({
|
|
356868
|
-
|
|
357642
|
+
HOST_INTERNAL: HOST_INTERNAL
|
|
356869
357643
|
}, getCloudSqlVariables(ctx)), jobTriggers);
|
|
356870
357644
|
}
|
|
356871
357645
|
};
|
|
@@ -357016,12 +357790,27 @@ exports.gcloudServiceAccountLoginCommands = void 0;
|
|
|
357016
357790
|
var __1 = __nccwpck_require__(81344);
|
|
357017
357791
|
var context_1 = __nccwpck_require__(22041);
|
|
357018
357792
|
var gcloudServiceAccountLoginCommands = function (context) {
|
|
357019
|
-
return ["echo $".concat((0, context_1.getSecretVarNameForContext)(context, __1.GCLOUD_DEPLOY_CREDENTIALS_KEY), "
|
|
357793
|
+
return ["gcloud auth activate-service-account --key-file=<(echo \"$".concat((0, context_1.getSecretVarNameForContext)(context, __1.GCLOUD_DEPLOY_CREDENTIALS_KEY), "\")")];
|
|
357020
357794
|
};
|
|
357021
357795
|
exports.gcloudServiceAccountLoginCommands = gcloudServiceAccountLoginCommands;
|
|
357022
357796
|
|
|
357023
357797
|
/***/ }),
|
|
357024
357798
|
|
|
357799
|
+
/***/ 89391:
|
|
357800
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
357801
|
+
|
|
357802
|
+
"use strict";
|
|
357803
|
+
|
|
357804
|
+
|
|
357805
|
+
exports.__esModule = true;
|
|
357806
|
+
exports.getServiceName = void 0;
|
|
357807
|
+
var getServiceName = function (context) {
|
|
357808
|
+
return context.environment.fullName.toLowerCase();
|
|
357809
|
+
};
|
|
357810
|
+
exports.getServiceName = getServiceName;
|
|
357811
|
+
|
|
357812
|
+
/***/ }),
|
|
357813
|
+
|
|
357025
357814
|
/***/ 77311:
|
|
357026
357815
|
/***/ ((__unused_webpack_module, exports) => {
|
|
357027
357816
|
|
|
@@ -357037,6 +357826,29 @@ exports.getCloudRunJobName = getCloudRunJobName;
|
|
|
357037
357826
|
|
|
357038
357827
|
/***/ }),
|
|
357039
357828
|
|
|
357829
|
+
/***/ 77547:
|
|
357830
|
+
/***/ ((__unused_webpack_module, exports) => {
|
|
357831
|
+
|
|
357832
|
+
"use strict";
|
|
357833
|
+
|
|
357834
|
+
|
|
357835
|
+
exports.__esModule = true;
|
|
357836
|
+
exports.removeFirstLinesFromCommandOutput = void 0;
|
|
357837
|
+
/**
|
|
357838
|
+
*
|
|
357839
|
+
* takes a command and removes the first keep lines from the output
|
|
357840
|
+
*
|
|
357841
|
+
* @param cmd the command, its stdout is then limited
|
|
357842
|
+
* @param removeFirstN how many lines to remove at the start of the command
|
|
357843
|
+
* @returns
|
|
357844
|
+
*/
|
|
357845
|
+
var removeFirstLinesFromCommandOutput = function (cmd, removeFirstN) {
|
|
357846
|
+
return removeFirstN === 0 ? cmd : "".concat(cmd, " | tail -n +").concat(removeFirstN + 1);
|
|
357847
|
+
};
|
|
357848
|
+
exports.removeFirstLinesFromCommandOutput = removeFirstLinesFromCommandOutput;
|
|
357849
|
+
|
|
357850
|
+
/***/ }),
|
|
357851
|
+
|
|
357040
357852
|
/***/ 70463:
|
|
357041
357853
|
/***/ ((__unused_webpack_module, exports) => {
|
|
357042
357854
|
|
|
@@ -357169,6 +357981,37 @@ var __assign = this && this.__assign || function () {
|
|
|
357169
357981
|
};
|
|
357170
357982
|
return __assign.apply(this, arguments);
|
|
357171
357983
|
};
|
|
357984
|
+
var __read = this && this.__read || function (o, n) {
|
|
357985
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
357986
|
+
if (!m) return o;
|
|
357987
|
+
var i = m.call(o),
|
|
357988
|
+
r,
|
|
357989
|
+
ar = [],
|
|
357990
|
+
e;
|
|
357991
|
+
try {
|
|
357992
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
357993
|
+
} catch (error) {
|
|
357994
|
+
e = {
|
|
357995
|
+
error: error
|
|
357996
|
+
};
|
|
357997
|
+
} finally {
|
|
357998
|
+
try {
|
|
357999
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
358000
|
+
} finally {
|
|
358001
|
+
if (e) throw e.error;
|
|
358002
|
+
}
|
|
358003
|
+
}
|
|
358004
|
+
return ar;
|
|
358005
|
+
};
|
|
358006
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
358007
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
358008
|
+
if (ar || !(i in from)) {
|
|
358009
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
358010
|
+
ar[i] = from[i];
|
|
358011
|
+
}
|
|
358012
|
+
}
|
|
358013
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
358014
|
+
};
|
|
357172
358015
|
exports.__esModule = true;
|
|
357173
358016
|
exports.createDockerTagDeployJobs = void 0;
|
|
357174
358017
|
var docker_1 = __nccwpck_require__(33219);
|
|
@@ -357186,7 +358029,7 @@ var createDockerTagDeployJobs = function (context) {
|
|
|
357186
358029
|
var tag = deployConfig.tag;
|
|
357187
358030
|
return (0, base_1.createDeployementJobs)(context, {
|
|
357188
358031
|
deploy: __assign(__assign({}, (0, docker_1.getDockerJobBaseProps)(context)), {
|
|
357189
|
-
script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_IMAGE:".concat(tag), "docker push $DOCKER_IMAGE:".concat(tag), "echo \"pushed as $DOCKER_IMAGE:".concat(tag, "\"")]
|
|
358032
|
+
script: __spreadArray(__spreadArray([], __read((0, docker_1.gitlabDockerLogin)(context)), false), ["docker pull $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_IMAGE:".concat(tag), "docker push $DOCKER_IMAGE:".concat(tag), "echo \"pushed as $DOCKER_IMAGE:".concat(tag, "\"")], false)
|
|
357190
358033
|
})
|
|
357191
358034
|
});
|
|
357192
358035
|
};
|
|
@@ -357508,12 +358351,12 @@ exports.KUBERNETES_DEPLOY_TYPE = {
|
|
|
357508
358351
|
var domainCanonical = deployConfigRaw && ((_b = deployConfigRaw.cluster) === null || _b === void 0 ? void 0 : _b.domainCanonical) ||
|
|
357509
358352
|
// 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
|
|
357510
358353
|
fullConfig.domainCanonical || "panter.cloud";
|
|
357511
|
-
var
|
|
358354
|
+
var HOST_INTERNAL = "".concat(componentSlug, ".").concat(envInUrl, ".").concat(fullConfig.appName, ".").concat(fullConfig.customerName, ".").concat(domainCanonical); // default for kubernetes and rest
|
|
357512
358355
|
return {
|
|
357513
358356
|
KUBE_NAMESPACE: KUBE_NAMESPACE,
|
|
357514
358357
|
KUBE_APP_NAME: KUBE_APP_NAME,
|
|
357515
358358
|
KUBE_APP_NAME_PREFIX: KUBE_APP_NAME_PREFIX,
|
|
357516
|
-
|
|
358359
|
+
HOST_INTERNAL: HOST_INTERNAL
|
|
357517
358360
|
};
|
|
357518
358361
|
}
|
|
357519
358362
|
};
|
|
@@ -358719,7 +359562,8 @@ var createChildPipeline = function (type, trigger, config) {
|
|
|
358719
359562
|
_a = {
|
|
358720
359563
|
image: (0, runner_1.getRunnerImage)("jobs-default"),
|
|
358721
359564
|
variables: {
|
|
358722
|
-
FF_USE_FASTZIP: "true"
|
|
359565
|
+
FF_USE_FASTZIP: "true",
|
|
359566
|
+
GIT_DEPTH: 1
|
|
358723
359567
|
},
|
|
358724
359568
|
workflow: {
|
|
358725
359569
|
rules: rules_1.RULES_ALWAYS
|
|
@@ -359437,7 +360281,7 @@ var path_equal_1 = __nccwpck_require__(84843);
|
|
|
359437
360281
|
var yarnUtils_1 = __nccwpck_require__(51369);
|
|
359438
360282
|
var getPackageManagerInfo = function (config, componentName) {
|
|
359439
360283
|
return __awaiter(void 0, void 0, void 0, function () {
|
|
359440
|
-
var version, isClassic, component, workspaces, currentWorkspace, componentIsInWorkspace, workspaceRoot, packageJson, workspacePackageJson, lockFile, configFiles, configFilePaths,
|
|
360284
|
+
var version, isClassic, component, workspaces, currentWorkspace, componentIsInWorkspace, workspaceRoot, packageJson, workspacePackageJson, lockFile, configFiles, configFilePaths, currentWorkspaceDependencies, pathsToCopyInDocker;
|
|
359441
360285
|
return __generator(this, function (_a) {
|
|
359442
360286
|
switch (_a.label) {
|
|
359443
360287
|
case 0:
|
|
@@ -359464,19 +360308,15 @@ var getPackageManagerInfo = function (config, componentName) {
|
|
|
359464
360308
|
})), false).filter(function (f) {
|
|
359465
360309
|
return (0, fs_1.existsSync)(f);
|
|
359466
360310
|
});
|
|
359467
|
-
|
|
359468
|
-
|
|
359469
|
-
return (_a = workspaces.find(function (w) {
|
|
359470
|
-
return w.name === name;
|
|
359471
|
-
})) === null || _a === void 0 ? void 0 : _a.location;
|
|
359472
|
-
}).filter(Boolean) : [];
|
|
359473
|
-
pathsToCopyInDocker = __spreadArray(__spreadArray(__spreadArray(__spreadArray([packageJson], __read(workspacePackageJson ? [workspacePackageJson] : []), false), [lockFile], false), __read(configFilePaths), false), __read(workspaceDependencies), false);
|
|
360311
|
+
currentWorkspaceDependencies = currentWorkspace ? (0, yarnUtils_1.getWorkspaceDependencies)(currentWorkspace, workspaces) : [];
|
|
360312
|
+
pathsToCopyInDocker = __spreadArray(__spreadArray(__spreadArray(__spreadArray([packageJson], __read(workspacePackageJson ? [workspacePackageJson] : []), false), [lockFile], false), __read(configFilePaths), false), __read(currentWorkspaceDependencies), false);
|
|
359474
360313
|
return [2 /*return*/, {
|
|
359475
360314
|
type: "yarn",
|
|
359476
360315
|
workspaces: workspaces,
|
|
359477
360316
|
version: version,
|
|
359478
360317
|
isClassic: isClassic,
|
|
359479
360318
|
currentWorkspace: currentWorkspace,
|
|
360319
|
+
currentWorkspaceDependencies: currentWorkspaceDependencies,
|
|
359480
360320
|
componentIsInWorkspace: componentIsInWorkspace,
|
|
359481
360321
|
pathsToCopyInDocker: pathsToCopyInDocker
|
|
359482
360322
|
}];
|
|
@@ -359609,13 +360449,44 @@ var __generator = this && this.__generator || function (thisArg, body) {
|
|
|
359609
360449
|
};
|
|
359610
360450
|
}
|
|
359611
360451
|
};
|
|
360452
|
+
var __read = this && this.__read || function (o, n) {
|
|
360453
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
360454
|
+
if (!m) return o;
|
|
360455
|
+
var i = m.call(o),
|
|
360456
|
+
r,
|
|
360457
|
+
ar = [],
|
|
360458
|
+
e;
|
|
360459
|
+
try {
|
|
360460
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
360461
|
+
} catch (error) {
|
|
360462
|
+
e = {
|
|
360463
|
+
error: error
|
|
360464
|
+
};
|
|
360465
|
+
} finally {
|
|
360466
|
+
try {
|
|
360467
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
360468
|
+
} finally {
|
|
360469
|
+
if (e) throw e.error;
|
|
360470
|
+
}
|
|
360471
|
+
}
|
|
360472
|
+
return ar;
|
|
360473
|
+
};
|
|
360474
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
360475
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
360476
|
+
if (ar || !(i in from)) {
|
|
360477
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
360478
|
+
ar[i] = from[i];
|
|
360479
|
+
}
|
|
360480
|
+
}
|
|
360481
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
360482
|
+
};
|
|
359612
360483
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
359613
360484
|
return mod && mod.__esModule ? mod : {
|
|
359614
360485
|
"default": mod
|
|
359615
360486
|
};
|
|
359616
360487
|
};
|
|
359617
360488
|
exports.__esModule = true;
|
|
359618
|
-
exports.getWorkspaces = exports.getYarnVersion = void 0;
|
|
360489
|
+
exports.getWorkspaceDependencies = exports.getWorkspaces = exports.getYarnVersion = void 0;
|
|
359619
360490
|
var child_process_promise_1 = __nccwpck_require__(75763);
|
|
359620
360491
|
var memoizee_1 = __importDefault(__nccwpck_require__(85839));
|
|
359621
360492
|
var execOrFail = function (cmd, onFail) {
|
|
@@ -359685,6 +360556,20 @@ exports.getWorkspaces = (0, memoizee_1["default"])(function (isClassic) {
|
|
|
359685
360556
|
}, {
|
|
359686
360557
|
promise: true
|
|
359687
360558
|
});
|
|
360559
|
+
// recursivly get all workspace dependencies
|
|
360560
|
+
var getWorkspaceDependencies = function (ws, allWorkspaces) {
|
|
360561
|
+
return ws ? __spreadArray(__spreadArray([], __read(ws.workspaceDependencies), false), __read(ws.mismatchedWorkspaceDependencies), false).flatMap(function (location) {
|
|
360562
|
+
// we have to do this recursivly
|
|
360563
|
+
var otherWorkspace = allWorkspaces.find(function (w) {
|
|
360564
|
+
return w.location === location;
|
|
360565
|
+
});
|
|
360566
|
+
if (otherWorkspace) {
|
|
360567
|
+
return __spreadArray(__spreadArray([], __read((0, exports.getWorkspaceDependencies)(otherWorkspace, allWorkspaces)), false), [otherWorkspace.location], false);
|
|
360568
|
+
}
|
|
360569
|
+
return [];
|
|
360570
|
+
}).filter(Boolean) : [];
|
|
360571
|
+
};
|
|
360572
|
+
exports.getWorkspaceDependencies = getWorkspaceDependencies;
|
|
359688
360573
|
|
|
359689
360574
|
/***/ }),
|
|
359690
360575
|
|
|
@@ -359926,7 +360811,7 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
359926
360811
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
359927
360812
|
};
|
|
359928
360813
|
exports.__esModule = true;
|
|
359929
|
-
exports.repeatOnFailure = exports.sanitizeForBashVariable = exports.allowFailureInScripts = void 0;
|
|
360814
|
+
exports.collapseableSection = exports.repeatOnFailure = exports.sanitizeForBashVariable = exports.allowFailureInScripts = void 0;
|
|
359930
360815
|
var allowFailureInScripts = function (script) {
|
|
359931
360816
|
return __spreadArray(__spreadArray(["set +e"], __read(script), false), ["set -e" // reenable
|
|
359932
360817
|
], false);
|
|
@@ -359940,6 +360825,12 @@ var repeatOnFailure = function (command, options) {
|
|
|
359940
360825
|
return "\n until ".concat(command, "\n do\n echo \"Trying again.\"\n sleep ").concat(options.pauseInSeconds, "\n done\n ");
|
|
359941
360826
|
};
|
|
359942
360827
|
exports.repeatOnFailure = repeatOnFailure;
|
|
360828
|
+
var collapseableSection = function (name, header) {
|
|
360829
|
+
return function (commands) {
|
|
360830
|
+
return __spreadArray(__spreadArray(["echo -e \"\\e[0Ksection_start:$(date +%s):".concat(name, "[collapsed=true]\\r\\e[0K").concat(header, "\"")], __read(commands), false), ["echo -e \"\\e[0Ksection_end:$(date +%s):".concat(name, "\\r\\e[0K\"")], false);
|
|
360831
|
+
};
|
|
360832
|
+
};
|
|
360833
|
+
exports.collapseableSection = collapseableSection;
|
|
359943
360834
|
|
|
359944
360835
|
/***/ }),
|
|
359945
360836
|
|
|
@@ -362436,7 +363327,7 @@ module.exports = underscoreNodeF._;
|
|
|
362436
363327
|
/***/ ((module) => {
|
|
362437
363328
|
|
|
362438
363329
|
"use strict";
|
|
362439
|
-
module.exports = JSON.parse('{"name":"@catladder/cli","author":"Marco Wettstein <maw@panter.ch>","homepage":"https://git.panter.ch/catladder/catladder/#readme","bugs":"https://git.panter.ch/catladder/catladder/issues","license":"MIT","scripts":{"lint":"eslint \\"src/**/*.ts\\"","lint:fix":"eslint \\"src/**/*.ts\\" --fix","test":"yarn run lint","build":"yarn build:compile && yarn build:bundle","build:bundle":"./scripts/bundle","build:compile":"yarn tsc","build:watch":"yarn tsc -w"},"bin":{"catenv":"./bin/catenv","catladder":"./bin/catladder"},"dependencies":{"ts-node":"^10.9.1"},"engines":{"node":">=12.0.0"},"devDependencies":{"@catladder/pipeline":"0.0.0","@kubernetes/client-node":"^0.16.2","@tsconfig/node14":"^1.0.1","@types/common-tags":"^1.8.0","@types/fs-extra":"^5.0.4","@types/js-yaml":"^4.0.5","@types/lodash":"^4.14.185","@types/memoizee":"^0.4.2","@types/node-fetch":"^2.1.4","@types/request":"^2.48.1","@types/tmp":"^0.2.3","@types/update-notifier":"^2.5.0","@types/vorpal":"^1.12.0","@types/websocket":"^0.0.40","@types/yargs":"^13.0.0","child-process-promise":"^2.2.1","clipboardy":"^2.0.0","command-exists-promise":"^2.0.2","common-tags":"^1.8.0","dayjs":"^1.10.4","eslint":"^8.7.0","fs-extra":"^7.0.1","gitlab":"^4.4.1","js-yaml":"^4.1.0","lodash":"^4.17.21","memoizee":"^0.4.14","node-fetch":"^2.3.0","open":"^8.4.0","prettier":"^2.5.1","tmp-promise":"^2.0.2","typescript":"^4.5.4","vorpal":"^1.12.0"}
|
|
363330
|
+
module.exports = JSON.parse('{"name":"@catladder/cli","description":"Panter cli tool for Kubernetes","author":"Marco Wettstein <maw@panter.ch>","homepage":"https://git.panter.ch/catladder/catladder/#readme","bugs":"https://git.panter.ch/catladder/catladder/issues","repository":{"type":"git","url":"git+https://git.panter.ch/catladder/catladder.git","directory":"cli"},"keywords":["GitLab","cloud","cli","gitlab-ci","ci/cd","pipeline","deployment","devops","automation","typescript"],"contributors":[{"name":"Marco Wettstein","email":"maw@panter.ch"},{"name":"Michael Leu","email":"leu@panter.ch"},{"name":"Luboš Matejčík","email":"lma@panter.ch"},{"name":"Kaspar Vollenweider","email":"vok@panter.ch"},{"name":"Silvan Adrian","email":"sia@panter.ch"},{"name":"Stefan Bakocs","email":"stb@panter.ch"},{"name":"Lukas Brezina","email":"brl@panter.ch"}],"license":"MIT","version":"0.0.0","scripts":{"lint":"eslint \\"src/**/*.ts\\"","lint:fix":"eslint \\"src/**/*.ts\\" --fix","test":"yarn run lint","build":"yarn build:compile && yarn build:bundle","build:bundle":"./scripts/bundle","build:compile":"yarn tsc","build:watch":"yarn tsc -w"},"bin":{"catenv":"./bin/catenv","catladder":"./bin/catladder"},"dependencies":{"ts-node":"^10.9.1"},"engines":{"node":">=12.0.0"},"devDependencies":{"@catladder/pipeline":"0.0.0","@kubernetes/client-node":"^0.16.2","@tsconfig/node14":"^1.0.1","@types/common-tags":"^1.8.0","@types/fs-extra":"^5.0.4","@types/js-yaml":"^4.0.5","@types/lodash":"^4.14.185","@types/memoizee":"^0.4.2","@types/node-fetch":"^2.1.4","@types/request":"^2.48.1","@types/tmp":"^0.2.3","@types/update-notifier":"^2.5.0","@types/vorpal":"^1.12.0","@types/websocket":"^0.0.40","@types/yargs":"^13.0.0","child-process-promise":"^2.2.1","clipboardy":"^2.0.0","command-exists-promise":"^2.0.2","common-tags":"^1.8.0","connection-string-parser":"^1.0.4","dayjs":"^1.10.4","eslint":"^8.7.0","fs-extra":"^7.0.1","gitlab":"^4.4.1","js-yaml":"^4.1.0","lodash":"^4.17.21","memoizee":"^0.4.14","node-fetch":"^2.3.0","open":"^8.4.0","prettier":"^2.5.1","tmp-promise":"^2.0.2","typescript":"^4.5.4","vorpal":"^1.12.0"}}');
|
|
362440
363331
|
|
|
362441
363332
|
/***/ }),
|
|
362442
363333
|
|