@catladder/cli 0.0.0-fix-meteor-2-e94ec0c0 → 0.0.0-fix-cloud-run-ar-only-415e668a
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/README.md +6 -0
- 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/index.js +2 -0
- package/dist/apps/cli/commands/project/index.js.map +1 -1
- package/dist/bundles/catenv/index.js +108 -32
- package/dist/bundles/cli/index.js +536 -40
- 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 +3 -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/index.ts +2 -0
- package/src/gcloud/cloudSql/copyDb.ts +57 -0
package/README.md
CHANGED
|
@@ -33,3 +33,9 @@ Catladder stores some preferences in `~/.catladder/preferences.yml` in case you
|
|
|
33
33
|
## Contribution
|
|
34
34
|
|
|
35
35
|
Check the documentation [here](https://git.panter.ch/catladder/catladder/-/tree/main/cli/CONTRIBUTING.md).
|
|
36
|
+
|
|
37
|
+
### Adding packages in cli
|
|
38
|
+
|
|
39
|
+
if you add npm libs in cli, make sure to add them as dev-dependencies.
|
|
40
|
+
|
|
41
|
+
the reason is that we bundle all dependencies in the cli package, so that if you add that to your project, it won't install all @catladder/cli's dependencies.
|
|
@@ -36,7 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
exports.__esModule = true;
|
|
39
|
-
var
|
|
39
|
+
var copyDb_1 = require("../../../../gcloud/cloudSql/copyDb");
|
|
40
40
|
var startProxy_1 = require("../../../../gcloud/cloudSql/startProxy");
|
|
41
41
|
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
42
|
return __generator(this, function (_a) {
|
|
@@ -44,7 +44,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
44
44
|
.command("cloud-sql-restore-db", "restore a db from one source to another target")
|
|
45
45
|
.action(function restoreDb() {
|
|
46
46
|
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
-
var sourceInstance, sourceProxy, targetProxy, sourcePort, targetPort, sourceLocalPort, sourceUsername, sourcePassword, sourceDbName, targetInstance, targetLocalPort, targetUsername, targetPassword, targetDbName, shouldContinue
|
|
47
|
+
var sourceInstance, sourceProxy, targetProxy, sourcePort, targetPort, sourceLocalPort, sourceUsername, sourcePassword, sourceDbName, targetInstance, targetLocalPort, targetUsername, targetPassword, targetDbName, shouldContinue;
|
|
48
48
|
return __generator(this, function (_a) {
|
|
49
49
|
switch (_a.label) {
|
|
50
50
|
case 0: return [4 /*yield*/, this.prompt({
|
|
@@ -155,14 +155,19 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
155
155
|
if (!shouldContinue) {
|
|
156
156
|
return [2 /*return*/];
|
|
157
157
|
}
|
|
158
|
-
targetPSQL = function (command) {
|
|
159
|
-
return "PGPASSWORD=".concat(targetPassword, " psql -p ").concat(targetPort, " --host=localhost --user=").concat(targetUsername, " -q ").concat(command);
|
|
160
|
-
};
|
|
161
|
-
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 ");
|
|
162
158
|
_a.label = 18;
|
|
163
159
|
case 18:
|
|
164
160
|
_a.trys.push([18, , 20, 21]);
|
|
165
|
-
return [4 /*yield*/, (0,
|
|
161
|
+
return [4 /*yield*/, (0, copyDb_1.spawnCopyDb)({
|
|
162
|
+
targetPassword: targetPassword,
|
|
163
|
+
targetPort: targetPort,
|
|
164
|
+
targetUsername: targetUsername,
|
|
165
|
+
sourceUsername: sourceUsername,
|
|
166
|
+
sourcePassword: sourcePassword,
|
|
167
|
+
sourcePort: sourcePort,
|
|
168
|
+
sourceDbName: sourceDbName,
|
|
169
|
+
targetDbName: targetDbName
|
|
170
|
+
})];
|
|
166
171
|
case 19:
|
|
167
172
|
_a.sent();
|
|
168
173
|
return [3 /*break*/, 21];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commandRestoreDb.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/cloudSQL/commandRestoreDb.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"commandRestoreDb.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/cloudSQL/commandRestoreDb.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,6DAAiE;AAEjE,qEAAwF;AAExF,sBAAe,UAAO,MAAc;;QAClC,sBAAA,MAAM;iBACH,O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AqB;qCAC/B,CAAC,EAAA;;gCALM,YAAY,GAAK,CAAA,SAKvB,CAAA,aALkB;gCAOO,qBAAM,IAAI,CAAC,MAAM,CAAC;wCAC3C,IAAI,EAAE,SAAS;wCACf,IAAI,EAAE,gBAAgB;wCACtB,OAAO,EAAE,yBAAkB,cAAc,cAAI,YAAY,kCAAwB,cAAc,cAAI,YAAY,8BAAiB;qCACjI,CAAC,EAAA;;gCAJM,cAAc,GAAK,CAAA,SAIzB,CAAA,eAJoB;gCAMtB,IAAI,CAAC,cAAc,EAAE;oCACnB,sBAAO;iCACR;;;;gCAGC,qBAAM,IAAA,oBAAW,EAAC;wCAChB,cAAc,gBAAA;wCACd,UAAU,YAAA;wCACV,cAAc,gBAAA;wCACd,cAAc,gBAAA;wCACd,cAAc,gBAAA;wCACd,UAAU,YAAA;wCACV,YAAY,cAAA;wCACZ,YAAY,cAAA;qCACb,CAAC,EAAA;;gCATF,SASE,CAAC;;;gCAEH,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,EAAE,CAAC;gCACpB,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,IAAI,EAAE,CAAC;;;;;;aAEvB,CAAC,EAAA;;KAAA,EAAC"}
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
13
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
+
function step(op) {
|
|
16
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
+
while (_) try {
|
|
18
|
+
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;
|
|
19
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
+
switch (op[0]) {
|
|
21
|
+
case 0: case 1: t = op; break;
|
|
22
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
+
default:
|
|
26
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
+
if (t[2]) _.ops.pop();
|
|
31
|
+
_.trys.pop(); continue;
|
|
32
|
+
}
|
|
33
|
+
op = body.call(thisArg, _);
|
|
34
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
exports.__esModule = true;
|
|
39
|
+
var getProjectConfig_1 = require("../../../../../config/getProjectConfig");
|
|
40
|
+
var startProxy_1 = require("../../../../../gcloud/cloudSql/startProxy");
|
|
41
|
+
var autocompletions_1 = require("../utils/autocompletions");
|
|
42
|
+
var connection_string_parser_1 = require("connection-string-parser");
|
|
43
|
+
var copyDb_1 = require("../../../../../gcloud/cloudSql/copyDb");
|
|
44
|
+
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
45
|
+
return __generator(this, function (_a) {
|
|
46
|
+
return [2 /*return*/, vorpal
|
|
47
|
+
.command("project-cloud-sql-restore-db", "restores a project db from one source to another target")
|
|
48
|
+
.action(function restoreDb() {
|
|
49
|
+
var _a, _b, _c, _d;
|
|
50
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
51
|
+
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;
|
|
52
|
+
return __generator(this, function (_g) {
|
|
53
|
+
switch (_g.label) {
|
|
54
|
+
case 0: return [4 /*yield*/, (0, autocompletions_1.envAndComponents)()];
|
|
55
|
+
case 1:
|
|
56
|
+
envs = _g.sent();
|
|
57
|
+
return [4 /*yield*/, this.prompt({
|
|
58
|
+
type: "list",
|
|
59
|
+
name: "sourceEnvAndComponent",
|
|
60
|
+
choices: envs,
|
|
61
|
+
message: "Source instance (connection string or 'local')? 🤔 "
|
|
62
|
+
})];
|
|
63
|
+
case 2:
|
|
64
|
+
sourceEnvAndComponent = (_g.sent()).sourceEnvAndComponent;
|
|
65
|
+
_e = sourceEnvAndComponent.split(":"), sourceEnv = _e[0], sourceComponent = _e[1];
|
|
66
|
+
return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(sourceEnv, sourceComponent)];
|
|
67
|
+
case 3:
|
|
68
|
+
sourceContext = _g.sent();
|
|
69
|
+
return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(this, sourceContext.environment.shortName, sourceContext.componentName)];
|
|
70
|
+
case 4:
|
|
71
|
+
sourceEnvVars = _g.sent();
|
|
72
|
+
closeAll = function () {
|
|
73
|
+
sourceProxy === null || sourceProxy === void 0 ? void 0 : sourceProxy.stop();
|
|
74
|
+
targetProxy === null || targetProxy === void 0 ? void 0 : targetProxy.stop();
|
|
75
|
+
};
|
|
76
|
+
if (!(sourceEnv === "local")) return [3 /*break*/, 5];
|
|
77
|
+
parser = new connection_string_parser_1.ConnectionStringParser({
|
|
78
|
+
scheme: "postgres",
|
|
79
|
+
hosts: []
|
|
80
|
+
});
|
|
81
|
+
parsersResult = parser.parse(sourceEnvVars.DATABASE_URL);
|
|
82
|
+
sourcePort = (_b = (_a = parsersResult.hosts) === null || _a === void 0 ? void 0 : _a[0]) === null || _b === void 0 ? void 0 : _b.port;
|
|
83
|
+
sourceUsername = parsersResult.username;
|
|
84
|
+
sourcePassword = parsersResult.password;
|
|
85
|
+
sourceDbName = parsersResult.endpoint;
|
|
86
|
+
return [3 /*break*/, 7];
|
|
87
|
+
case 5:
|
|
88
|
+
sourcePort = 54399;
|
|
89
|
+
return [4 /*yield*/, (0, startProxy_1.startCloudSqlProxyInBackground)({
|
|
90
|
+
instanceName: sourceEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME,
|
|
91
|
+
localPort: sourcePort
|
|
92
|
+
})];
|
|
93
|
+
case 6:
|
|
94
|
+
sourceProxy = _g.sent();
|
|
95
|
+
sourceUsername = sourceEnvVars.DB_USER;
|
|
96
|
+
sourcePassword = sourceEnvVars.DB_PASSWORD;
|
|
97
|
+
sourceDbName = sourceEnvVars.DB_NAME;
|
|
98
|
+
_g.label = 7;
|
|
99
|
+
case 7: return [4 /*yield*/, this.prompt({
|
|
100
|
+
type: "list",
|
|
101
|
+
name: "targetEnvAndComponent",
|
|
102
|
+
choices: envs,
|
|
103
|
+
message: "target env? 🤔 "
|
|
104
|
+
})];
|
|
105
|
+
case 8:
|
|
106
|
+
targetEnvAndComponent = (_g.sent()).targetEnvAndComponent;
|
|
107
|
+
_f = targetEnvAndComponent.split(":"), targetEnv = _f[0], targetComponent = _f[1];
|
|
108
|
+
return [4 /*yield*/, (0, getProjectConfig_1.getPipelineContextByChoice)(targetEnv, targetComponent)];
|
|
109
|
+
case 9:
|
|
110
|
+
targetContext = _g.sent();
|
|
111
|
+
return [4 /*yield*/, (0, getProjectConfig_1.getEnvVarsResolved)(this, targetContext.environment.shortName, targetContext.componentName)];
|
|
112
|
+
case 10:
|
|
113
|
+
targetEnvVars = _g.sent();
|
|
114
|
+
if (!(targetEnv === "local")) return [3 /*break*/, 11];
|
|
115
|
+
parser = new connection_string_parser_1.ConnectionStringParser({
|
|
116
|
+
scheme: "postgres",
|
|
117
|
+
hosts: []
|
|
118
|
+
});
|
|
119
|
+
parsersResult = parser.parse(targetEnvVars.DATABASE_URL);
|
|
120
|
+
targetPort = (_d = (_c = parsersResult.hosts) === null || _c === void 0 ? void 0 : _c[0]) === null || _d === void 0 ? void 0 : _d.port;
|
|
121
|
+
targetUsername = parsersResult.username;
|
|
122
|
+
targetPassword = parsersResult.password;
|
|
123
|
+
targetDbName = parsersResult.endpoint;
|
|
124
|
+
return [3 /*break*/, 13];
|
|
125
|
+
case 11:
|
|
126
|
+
targetPort = 54499;
|
|
127
|
+
return [4 /*yield*/, (0, startProxy_1.startCloudSqlProxyInBackground)({
|
|
128
|
+
instanceName: targetEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME,
|
|
129
|
+
localPort: targetPort
|
|
130
|
+
})];
|
|
131
|
+
case 12:
|
|
132
|
+
targetProxy = _g.sent();
|
|
133
|
+
targetUsername = targetEnvVars.DB_USER;
|
|
134
|
+
targetPassword = targetEnvVars.DB_PASSWORD;
|
|
135
|
+
targetDbName = sourceEnvVars.DB_NAME;
|
|
136
|
+
_g.label = 13;
|
|
137
|
+
case 13: return [4 /*yield*/, this.prompt({
|
|
138
|
+
type: "confirm",
|
|
139
|
+
name: "shouldContinue",
|
|
140
|
+
message: "This will drop ".concat(targetEnv, "/").concat(targetDbName, " and replace it with ").concat(sourceEnv, "/").concat(sourceDbName, ". Continue? \uD83E\uDD14 ")
|
|
141
|
+
})];
|
|
142
|
+
case 14:
|
|
143
|
+
shouldContinue = (_g.sent()).shouldContinue;
|
|
144
|
+
if (!shouldContinue) {
|
|
145
|
+
this.log("abort");
|
|
146
|
+
closeAll();
|
|
147
|
+
return [2 /*return*/];
|
|
148
|
+
}
|
|
149
|
+
if (!(targetContext.environment.envType === "prod")) return [3 /*break*/, 16];
|
|
150
|
+
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"));
|
|
151
|
+
return [4 /*yield*/, this.prompt({
|
|
152
|
+
type: "input",
|
|
153
|
+
name: "confirmInstance",
|
|
154
|
+
message: "confirm: "
|
|
155
|
+
})];
|
|
156
|
+
case 15:
|
|
157
|
+
confirmInstance = (_g.sent()).confirmInstance;
|
|
158
|
+
if (confirmInstance !== targetEnvVars.CLOUD_SQL_INSTANCE_CONNECTION_NAME) {
|
|
159
|
+
this.log("abort");
|
|
160
|
+
closeAll();
|
|
161
|
+
return [2 /*return*/];
|
|
162
|
+
}
|
|
163
|
+
_g.label = 16;
|
|
164
|
+
case 16:
|
|
165
|
+
_g.trys.push([16, , 18, 19]);
|
|
166
|
+
return [4 /*yield*/, (0, copyDb_1.spawnCopyDb)({
|
|
167
|
+
targetPassword: targetPassword,
|
|
168
|
+
targetPort: targetPort,
|
|
169
|
+
targetUsername: targetUsername,
|
|
170
|
+
sourceUsername: sourceUsername,
|
|
171
|
+
sourcePassword: sourcePassword,
|
|
172
|
+
sourcePort: sourcePort,
|
|
173
|
+
sourceDbName: sourceDbName,
|
|
174
|
+
targetDbName: targetDbName
|
|
175
|
+
})];
|
|
176
|
+
case 17:
|
|
177
|
+
_g.sent();
|
|
178
|
+
return [3 /*break*/, 19];
|
|
179
|
+
case 18:
|
|
180
|
+
closeAll();
|
|
181
|
+
return [7 /*endfinally*/];
|
|
182
|
+
case 19: return [2 /*return*/];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
})];
|
|
187
|
+
});
|
|
188
|
+
}); });
|
|
189
|
+
//# sourceMappingURL=commandProjectRestoreDb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commandProjectRestoreDb.js","sourceRoot":"","sources":["../../../../../../src/apps/cli/commands/project/cloudSql/commandProjectRestoreDb.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,2EAGgD;AAEhD,wEAA2F;AAC3F,4DAA4D;AAE5D,qEAAkE;AAClE,gEAAoE;AAEpE,sBAAe,UAAO,MAAc;;QAClC,sBAAA,MAAM;iBACH,OAAO,CACN,8BAA8B,EAC9B,yDAAyD,CAC1D;iBACA,MAAM,CAAC,SAAe,SAAS;;;;;;oCACjB,qBAAM,IAAA,kCAAgB,GAAE,EAAA;;gCAA/B,IAAI,GAAG,SAAwB;gCAEH,qBAAM,IAAI,CAAC,MAAM,CAAC;wCAClD,IAAI,EAAE,MAAM;wCACZ,IAAI,EAAE,uBAAuB;wCAC7B,OAAO,EAAE,IAAI;wCAEb,OAAO,EAAE,qDAAqD;qCAC/D,CAAC,EAAA;;gCANM,qBAAqB,GAAK,CAAA,SAMhC,CAAA,sBAN2B;gCAQvB,KAA+B,qBAAqB,CAAC,KAAK,CAAC,GAAG,CAAC,EAA9D,SAAS,QAAA,EAAE,eAAe,QAAA,CAAqC;gCAEhD,qBAAM,IAAA,6CAA0B,EACpD,SAAS,EACT,eAAe,CAChB,EAAA;;gCAHK,aAAa,GAAG,SAGrB;gCAEqB,qBAAM,IAAA,qCAAkB,EAC5C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BAAgB;oCACtB,OAAO,EAAE,yBAAkB,SAAS,cAAI,YAAY,kCAAwB,SAAS,cAAI,YAAY,8BAAiB;iCACvH,CAAC,EAAA;;gCAJM,cAAc,GAAK,CAAA,SAIzB,CAAA,eAJoB;gCAMtB,IAAI,CAAC,cAAc,EAAE;oCACnB,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;oCAClB,QAAQ,EAAE,CAAC;oCACX,sBAAO;iCACR;qCAEG,CAAA,aAAa,CAAC,WAAW,CAAC,OAAO,KAAK,MAAM,CAAA,EAA5C,yBAA4C;gCAC9C,IAAI,CAAC,GAAG,CACN,qFAAoE,aAAa,CAAC,kCAAkC,qBAAkB,CACvI,CAAC;gCAC0B,qBAAM,IAAI,CAAC,MAAM,CAAC;wCAC5C,IAAI,EAAE,OAAO;wCACb,IAAI,EAAE,iBAAiB;wCACvB,OAAO,EAAE,WAAW;qCACrB,CAAC,EAAA;;gCAJM,eAAe,GAAK,CAAA,SAI1B,CAAA,gBAJqB;gCAMvB,IACE,eAAe,KAAK,aAAa,CAAC,kCAAkC,EACpE;oCACA,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;oCAClB,QAAQ,EAAE,CAAC;oCACX,sBAAO;iCACR;;;;gCAID,qBAAM,IAAA,oBAAW,EAAC;wCAChB,cAAc,gBAAA;wCACd,UAAU,YAAA;wCACV,cAAc,gBAAA;wCACd,cAAc,gBAAA;wCACd,cAAc,gBAAA;wCACd,UAAU,YAAA;wCACV,YAAY,cAAA;wCACZ,YAAY,cAAA;qCACb,CAAC,EAAA;;gCATF,SASE,CAAC;;;gCAEH,QAAQ,EAAE,CAAC;;;;;;aAEd,CAAC,EAAA;;KAAA,EAAC"}
|
|
@@ -63,6 +63,7 @@ var commandPortForward_1 = __importDefault(require("./commandPortForward"));
|
|
|
63
63
|
var commandTriggerCronjob_1 = __importDefault(require("./commandTriggerCronjob"));
|
|
64
64
|
var commandOpenGrafanaPod_1 = __importDefault(require("./commandOpenGrafanaPod"));
|
|
65
65
|
var commandSecretsClearBackups_1 = __importDefault(require("./commandSecretsClearBackups"));
|
|
66
|
+
var commandProjectRestoreDb_1 = __importDefault(require("./cloudSql/commandProjectRestoreDb"));
|
|
66
67
|
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
67
68
|
return __generator(this, function (_a) {
|
|
68
69
|
(0, commandSetup_1["default"])(vorpal);
|
|
@@ -77,6 +78,7 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
77
78
|
(0, commandOpenGrafana_1["default"])(vorpal);
|
|
78
79
|
(0, commandOpenGrafanaPod_1["default"])(vorpal);
|
|
79
80
|
(0, commandCloudSqlProxy_1["default"])(vorpal);
|
|
81
|
+
(0, commandProjectRestoreDb_1["default"])(vorpal);
|
|
80
82
|
(0, commandOpenGit_1["default"])(vorpal);
|
|
81
83
|
(0, commandOpenEnv_1["default"])(vorpal);
|
|
82
84
|
(0, commandTriggerCronjob_1["default"])(vorpal);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/project/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,gFAA0D;AAC1D,gFAA0D;AAE1D,0EAAoD;AACpD,gFAA0D;AAC1D,oEAA8C;AAC9C,0FAAoE;AACpE,sEAAgD;AAChD,sEAAgD;AAChD,gEAA0C;AAC1C,4DAA4D;AAC5D,sEAAgD;AAChD,8EAAwD;AACxD,wEAAkD;AAClD,wFAAkE;AAClE,gFAA0D;AAC1D,oEAA8C;AAC9C,oEAA8C;AAC9C,sEAAgD;AAChD,8EAAwD;AACxD,4EAAsD;AACtD,4EAAsD;AACtD,kFAA4D;AAE5D,kFAA4D;AAC5D,4FAAsE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/project/index.ts"],"names":[],"mappings":";;;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C,MAAM,CAAC,CAAC;QACnC,IAAA,8BAAiB,EAAC,MAAM,CAAC,CAAC;QAE1B,IAAA,4BAAe,EAAC,MAAM,CAAC,CAAC;QACxB,IAAA,+BAAkB,EAAC,MAAM,CAAC,CAAC;QAE3B,IAAA,4BAAe,EAAC,MAAM,CAAC,CAAC;QAExB,IAAA,sCAAyB,EAAC,MAAM,CAAC,CAAC;QAClC,IAAA,gCAAmB,EAAC,MAAM,CAAC,CAAC;;;KAC7B,EAAC"}
|
|
@@ -39512,7 +39512,7 @@ var createCustomBuildJobs = function (context) {
|
|
|
39512
39512
|
}
|
|
39513
39513
|
} : undefined,
|
|
39514
39514
|
dockerBuild: {
|
|
39515
|
-
script: (0, docker_1.getDockerBuildDefaultScript)(((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
|
|
39515
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context, ((_d = buildConfig.docker) === null || _d === void 0 ? void 0 : _d.type) === "nginx" ? "ensureNginxDockerfile" : ""),
|
|
39516
39516
|
variables: {}
|
|
39517
39517
|
}
|
|
39518
39518
|
});
|
|
@@ -39697,6 +39697,37 @@ var __rest = this && this.__rest || function (s, e) {
|
|
|
39697
39697
|
}
|
|
39698
39698
|
return t;
|
|
39699
39699
|
};
|
|
39700
|
+
var __read = this && this.__read || function (o, n) {
|
|
39701
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
39702
|
+
if (!m) return o;
|
|
39703
|
+
var i = m.call(o),
|
|
39704
|
+
r,
|
|
39705
|
+
ar = [],
|
|
39706
|
+
e;
|
|
39707
|
+
try {
|
|
39708
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
39709
|
+
} catch (error) {
|
|
39710
|
+
e = {
|
|
39711
|
+
error: error
|
|
39712
|
+
};
|
|
39713
|
+
} finally {
|
|
39714
|
+
try {
|
|
39715
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
39716
|
+
} finally {
|
|
39717
|
+
if (e) throw e.error;
|
|
39718
|
+
}
|
|
39719
|
+
}
|
|
39720
|
+
return ar;
|
|
39721
|
+
};
|
|
39722
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
39723
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
39724
|
+
if (ar || !(i in from)) {
|
|
39725
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
39726
|
+
ar[i] = from[i];
|
|
39727
|
+
}
|
|
39728
|
+
}
|
|
39729
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
39730
|
+
};
|
|
39700
39731
|
var __importDefault = this && this.__importDefault || function (mod) {
|
|
39701
39732
|
return mod && mod.__esModule ? mod : {
|
|
39702
39733
|
"default": mod
|
|
@@ -39709,6 +39740,8 @@ var deploy_1 = __nccwpck_require__(223);
|
|
|
39709
39740
|
var runner_1 = __nccwpck_require__(5071);
|
|
39710
39741
|
var fs_1 = __nccwpck_require__(7147);
|
|
39711
39742
|
var path_1 = __importDefault(__nccwpck_require__(1017));
|
|
39743
|
+
var artifactsRegistry_1 = __nccwpck_require__(8159);
|
|
39744
|
+
var gcloudServiceAccountLoginCommands_1 = __nccwpck_require__(2607);
|
|
39712
39745
|
var DOCKER_RUNNER_BUILD_VARIABLES = {
|
|
39713
39746
|
KUBERNETES_CPU_REQUEST: "0.5",
|
|
39714
39747
|
KUBERNETES_CPU_LIMIT: "1",
|
|
@@ -39716,14 +39749,18 @@ var DOCKER_RUNNER_BUILD_VARIABLES = {
|
|
|
39716
39749
|
KUBERNETES_MEMORY_LIMIT: "2Gi"
|
|
39717
39750
|
};
|
|
39718
39751
|
var getDockerImageVariables = function (context) {
|
|
39719
|
-
return {
|
|
39752
|
+
return __assign(__assign({}, (0, deploy_1.isOfDeployType)(context.componentConfig.deploy, "google-cloudrun") ? {
|
|
39753
|
+
DOCKER_REGISTRY: (0, artifactsRegistry_1.getArtifactsRegistryHost)(context),
|
|
39754
|
+
DOCKER_REGISTRY_IMAGE_PATH: (0, artifactsRegistry_1.getArtifactsRegistryImageName)(context)
|
|
39755
|
+
} : {
|
|
39720
39756
|
DOCKER_REGISTRY: "$CI_REGISTRY",
|
|
39721
|
-
DOCKER_REGISTRY_IMAGE_PATH: "$CI_REGISTRY_IMAGE"
|
|
39757
|
+
DOCKER_REGISTRY_IMAGE_PATH: "$CI_REGISTRY_IMAGE"
|
|
39758
|
+
}), {
|
|
39722
39759
|
DOCKER_CACHE_IMAGE: "$DOCKER_REGISTRY_IMAGE_PATH/caches/" + context.componentName,
|
|
39723
39760
|
DOCKER_IMAGE_NAME: context.environment.shortName + "/" + context.componentName,
|
|
39724
39761
|
DOCKER_IMAGE: "$DOCKER_REGISTRY_IMAGE_PATH/$DOCKER_IMAGE_NAME",
|
|
39725
39762
|
DOCKER_IMAGE_TAG: "$CI_COMMIT_SHA"
|
|
39726
|
-
};
|
|
39763
|
+
});
|
|
39727
39764
|
};
|
|
39728
39765
|
exports.getDockerImageVariables = getDockerImageVariables;
|
|
39729
39766
|
/**
|
|
@@ -39778,9 +39815,12 @@ var createDockerBuildJobBase = function (context, _a) {
|
|
|
39778
39815
|
}, def);
|
|
39779
39816
|
};
|
|
39780
39817
|
exports.createDockerBuildJobBase = createDockerBuildJobBase;
|
|
39781
|
-
|
|
39782
|
-
|
|
39783
|
-
|
|
39818
|
+
var gitlabDockerLogin = function (context) {
|
|
39819
|
+
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"];
|
|
39820
|
+
};
|
|
39821
|
+
exports.gitlabDockerLogin = gitlabDockerLogin;
|
|
39822
|
+
var getDockerBuildDefaultScript = function (context, ensureDockerFileScript) {
|
|
39823
|
+
return __spreadArray(__spreadArray([ensureDockerFileScript], __read((0, exports.gitlabDockerLogin)(context)), false), ["docker version", "docker build --network host --cache-from $DOCKER_CACHE_IMAGE --tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG -f $APP_DIR/Dockerfile . --build-arg BUILDKIT_INLINE_CACHE=1", "docker push $DOCKER_IMAGE:$DOCKER_IMAGE_TAG", "docker tag $DOCKER_IMAGE:$DOCKER_IMAGE_TAG $DOCKER_CACHE_IMAGE", "docker push $DOCKER_CACHE_IMAGE"], false).filter(Boolean);
|
|
39784
39824
|
};
|
|
39785
39825
|
exports.getDockerBuildDefaultScript = getDockerBuildDefaultScript;
|
|
39786
39826
|
var hasDockerfile = function (context) {
|
|
@@ -39959,7 +39999,7 @@ var createNodeBuildJobs = function (context) {
|
|
|
39959
39999
|
jobTags: buildConfig.jobTags
|
|
39960
40000
|
} : undefined,
|
|
39961
40001
|
dockerBuild: {
|
|
39962
|
-
script: (0, docker_1.getDockerBuildDefaultScript)(buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "ensureNginxDockerfile" : "ensureNodeDockerfile"),
|
|
40002
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context, buildConfig.type === "node-static" || buildConfig.type === "storybook" ? "ensureNginxDockerfile" : "ensureNodeDockerfile"),
|
|
39963
40003
|
cache: __spreadArray([], __read((0, cache_1.getYarnCache)(context, "pull")), false),
|
|
39964
40004
|
variables: {
|
|
39965
40005
|
// only required for non static
|
|
@@ -40221,7 +40261,7 @@ var createMeteorBuildJobs = function (context) {
|
|
|
40221
40261
|
}
|
|
40222
40262
|
} : undefined,
|
|
40223
40263
|
dockerBuild: {
|
|
40224
|
-
script: (0, docker_1.getDockerBuildDefaultScript)("ensureMeteorDockerfile"),
|
|
40264
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context, "ensureMeteorDockerfile"),
|
|
40225
40265
|
variables: {
|
|
40226
40266
|
METEOR_INSTALL_SCRIPTS: buildConfig.installScripts ? "true" : ""
|
|
40227
40267
|
}
|
|
@@ -40453,6 +40493,15 @@ var __read = this && this.__read || function (o, n) {
|
|
|
40453
40493
|
}
|
|
40454
40494
|
return ar;
|
|
40455
40495
|
};
|
|
40496
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
40497
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40498
|
+
if (ar || !(i in from)) {
|
|
40499
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
40500
|
+
ar[i] = from[i];
|
|
40501
|
+
}
|
|
40502
|
+
}
|
|
40503
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
40504
|
+
};
|
|
40456
40505
|
exports.__esModule = true;
|
|
40457
40506
|
exports.createRailsBuildJobs = void 0;
|
|
40458
40507
|
var base_1 = __nccwpck_require__(8035);
|
|
@@ -40469,7 +40518,7 @@ var createRailsBuildJobs = function (context) {
|
|
|
40469
40518
|
return (0, base_1.createBuildJobs)(context, {
|
|
40470
40519
|
appBuild: undefined,
|
|
40471
40520
|
dockerBuild: {
|
|
40472
|
-
script: (0, docker_1.getDockerBuildDefaultScript)(),
|
|
40521
|
+
script: (0, docker_1.getDockerBuildDefaultScript)(context),
|
|
40473
40522
|
variables: {}
|
|
40474
40523
|
}
|
|
40475
40524
|
});
|
|
@@ -40486,9 +40535,9 @@ var createRailsBuildJobs = function (context) {
|
|
|
40486
40535
|
dockerBuild: {
|
|
40487
40536
|
variables: __assign(__assign({}, context.environment.jobOnlyVars.build.envVars), context.componentConfig.build.extraVars),
|
|
40488
40537
|
// custom script
|
|
40489
|
-
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",
|
|
40538
|
+
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",
|
|
40490
40539
|
// replace private git ssh gem sources with https to make bundler with credentials via env var work
|
|
40491
|
-
"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 : "")]
|
|
40540
|
+
"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)
|
|
40492
40541
|
}
|
|
40493
40542
|
});
|
|
40494
40543
|
};
|
|
@@ -40871,7 +40920,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
40871
40920
|
|
|
40872
40921
|
exports.__esModule = true;
|
|
40873
40922
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
40874
|
-
exports.PIPELINE_IMAGE_TAG = "fix-
|
|
40923
|
+
exports.PIPELINE_IMAGE_TAG = "fix-cloud-run-ar-only-415e668a" || 0;
|
|
40875
40924
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
40876
40925
|
|
|
40877
40926
|
/***/ }),
|
|
@@ -42435,11 +42484,19 @@ var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
|
42435
42484
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
42436
42485
|
};
|
|
42437
42486
|
exports.__esModule = true;
|
|
42438
|
-
exports.getDeleteUnusedImagesCommands = exports.
|
|
42439
|
-
var docker_1 = __nccwpck_require__(3219);
|
|
42487
|
+
exports.getDeleteUnusedImagesCommands = exports.getArtifactsRegistryImage = exports.getArtifactsRegistryImageName = exports.getArtifactsRegistryHost = void 0;
|
|
42440
42488
|
var gitlab_1 = __nccwpck_require__(4997);
|
|
42441
42489
|
var types_1 = __nccwpck_require__(3109);
|
|
42442
42490
|
var removeFirstLinesFromCommandOutput_1 = __nccwpck_require__(7547);
|
|
42491
|
+
var getArtifactsRegistryHost = function (_a) {
|
|
42492
|
+
var deploy = _a.componentConfig.deploy;
|
|
42493
|
+
if (!(0, types_1.isOfDeployType)(deploy, "google-cloudrun")) {
|
|
42494
|
+
// should not happen
|
|
42495
|
+
throw new Error("deploy config is wrong");
|
|
42496
|
+
}
|
|
42497
|
+
return "".concat(deploy.region, "-docker.pkg.dev");
|
|
42498
|
+
};
|
|
42499
|
+
exports.getArtifactsRegistryHost = getArtifactsRegistryHost;
|
|
42443
42500
|
/**
|
|
42444
42501
|
*
|
|
42445
42502
|
* 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
|
|
@@ -42458,7 +42515,7 @@ var getArtifactsRegistryImageName = function (context, lecacyReviewImageName) {
|
|
|
42458
42515
|
throw new Error("lecacyReviewImageName is only allowed for review app");
|
|
42459
42516
|
}
|
|
42460
42517
|
var fullAppName = "".concat(context.fullConfig.customerName, "-").concat(context.fullConfig.appName);
|
|
42461
|
-
var dockerUrl = "".concat(
|
|
42518
|
+
var dockerUrl = "".concat((0, exports.getArtifactsRegistryHost)(context), "/").concat(deployConfig.projectId, "/catladder-deploy/").concat(fullAppName);
|
|
42462
42519
|
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);
|
|
42463
42520
|
return gcloudImagePath.join("/");
|
|
42464
42521
|
};
|
|
@@ -42467,19 +42524,6 @@ var getArtifactsRegistryImage = function (context) {
|
|
|
42467
42524
|
return "".concat((0, exports.getArtifactsRegistryImageName)(context), ":$DOCKER_IMAGE_TAG");
|
|
42468
42525
|
};
|
|
42469
42526
|
exports.getArtifactsRegistryImage = getArtifactsRegistryImage;
|
|
42470
|
-
/**
|
|
42471
|
-
* commands to pull the image from the default registry and pushes it to google artifact registry. We might build and push directly to google artifact registry in the future
|
|
42472
|
-
*/
|
|
42473
|
-
var getPushToArtifactsRegistryCommands = function (context) {
|
|
42474
|
-
var deployConfig = context.componentConfig.deploy;
|
|
42475
|
-
if (!(0, types_1.isOfDeployType)(deployConfig, "google-cloudrun")) {
|
|
42476
|
-
// should not happen
|
|
42477
|
-
throw new Error("deploy config is wrong");
|
|
42478
|
-
}
|
|
42479
|
-
var fullImageName = (0, exports.getArtifactsRegistryImageName)(context);
|
|
42480
|
-
return [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(fullImageName, ":$DOCKER_IMAGE_TAG"), "docker push ".concat(fullImageName, ":$DOCKER_IMAGE_TAG")];
|
|
42481
|
-
};
|
|
42482
|
-
exports.getPushToArtifactsRegistryCommands = getPushToArtifactsRegistryCommands;
|
|
42483
42527
|
var getDeleteImageCommands = function (fullImageName, keepNewest) {
|
|
42484
42528
|
if (keepNewest === void 0) {
|
|
42485
42529
|
keepNewest = 0;
|
|
@@ -42860,7 +42904,7 @@ var createGoogleCloudRunDeployJobs = function (context) {
|
|
|
42860
42904
|
"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)];
|
|
42861
42905
|
});
|
|
42862
42906
|
};
|
|
42863
|
-
var deployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray(
|
|
42907
|
+
var deployScripts = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read((0, gitlab_1.collapseableSection)("prepare", "Prepare...")(__spreadArray(__spreadArray([], __read((0, gcloudServiceAccountLoginCommands_1.gcloudServiceAccountLoginCommands)(context)), false), __read(setExtraVarsScripts(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
|
|
42864
42908
|
: []), 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) {
|
|
42865
42909
|
var _b = __read(_a, 2),
|
|
42866
42910
|
name = _b[0],
|
|
@@ -43365,6 +43409,37 @@ var __assign = this && this.__assign || function () {
|
|
|
43365
43409
|
};
|
|
43366
43410
|
return __assign.apply(this, arguments);
|
|
43367
43411
|
};
|
|
43412
|
+
var __read = this && this.__read || function (o, n) {
|
|
43413
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
43414
|
+
if (!m) return o;
|
|
43415
|
+
var i = m.call(o),
|
|
43416
|
+
r,
|
|
43417
|
+
ar = [],
|
|
43418
|
+
e;
|
|
43419
|
+
try {
|
|
43420
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
43421
|
+
} catch (error) {
|
|
43422
|
+
e = {
|
|
43423
|
+
error: error
|
|
43424
|
+
};
|
|
43425
|
+
} finally {
|
|
43426
|
+
try {
|
|
43427
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
43428
|
+
} finally {
|
|
43429
|
+
if (e) throw e.error;
|
|
43430
|
+
}
|
|
43431
|
+
}
|
|
43432
|
+
return ar;
|
|
43433
|
+
};
|
|
43434
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
43435
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
43436
|
+
if (ar || !(i in from)) {
|
|
43437
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
43438
|
+
ar[i] = from[i];
|
|
43439
|
+
}
|
|
43440
|
+
}
|
|
43441
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
43442
|
+
};
|
|
43368
43443
|
exports.__esModule = true;
|
|
43369
43444
|
exports.createDockerTagDeployJobs = void 0;
|
|
43370
43445
|
var docker_1 = __nccwpck_require__(3219);
|
|
@@ -43382,7 +43457,7 @@ var createDockerTagDeployJobs = function (context) {
|
|
|
43382
43457
|
var tag = deployConfig.tag;
|
|
43383
43458
|
return (0, base_1.createDeployementJobs)(context, {
|
|
43384
43459
|
deploy: __assign(__assign({}, (0, docker_1.getDockerJobBaseProps)(context)), {
|
|
43385
|
-
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, "\"")]
|
|
43460
|
+
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)
|
|
43386
43461
|
})
|
|
43387
43462
|
});
|
|
43388
43463
|
};
|
|
@@ -44915,7 +44990,8 @@ var createChildPipeline = function (type, trigger, config) {
|
|
|
44915
44990
|
_a = {
|
|
44916
44991
|
image: (0, runner_1.getRunnerImage)("jobs-default"),
|
|
44917
44992
|
variables: {
|
|
44918
|
-
FF_USE_FASTZIP: "true"
|
|
44993
|
+
FF_USE_FASTZIP: "true",
|
|
44994
|
+
GIT_DEPTH: 1
|
|
44919
44995
|
},
|
|
44920
44996
|
workflow: {
|
|
44921
44997
|
rules: rules_1.RULES_ALWAYS
|