@catladder/cli 0.0.0-main-c03ae42d → 0.0.0-main-209fcf0b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/apps/cli/cli.js +2 -0
- package/dist/apps/cli/cli.js.map +1 -1
- package/dist/apps/cli/commands/{project/commandCopyDB.d.ts → cloudSQL/commandRestoreDb.d.ts} +0 -0
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js +150 -0
- package/dist/apps/cli/commands/cloudSQL/commandRestoreDb.js.map +1 -0
- package/dist/apps/cli/commands/cloudSQL/index.d.ts +3 -0
- package/dist/apps/cli/commands/{project/commandCopyDB.js → cloudSQL/index.js} +9 -39
- package/dist/apps/cli/commands/cloudSQL/index.js.map +1 -0
- package/dist/apps/cli/commands/project/index.js +0 -2
- package/dist/apps/cli/commands/project/index.js.map +1 -1
- package/dist/apps/cli/verify/migration/oldGitlabCi.js +1 -1
- package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +1 -1
- package/dist/bundles/catenv/index.js +226 -3
- package/dist/bundles/cli/index.js +443 -93
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/apps/cli/cli.ts +2 -0
- package/src/apps/cli/commands/cloudSQL/commandRestoreDb.ts +132 -0
- package/src/apps/cli/commands/cloudSQL/index.ts +8 -0
- package/src/apps/cli/commands/project/index.ts +1 -2
- package/src/apps/cli/verify/migration/oldGitlabCi.ts +1 -1
- package/dist/apps/cli/commands/project/commandCopyDB.js.map +0 -1
- package/src/apps/cli/commands/project/commandCopyDB.ts +0 -92
|
@@ -52,6 +52,7 @@ var packageInfos_1 = __importDefault(__nccwpck_require__(71628));
|
|
|
52
52
|
var portForward_1 = __nccwpck_require__(34353);
|
|
53
53
|
var general_1 = __importDefault(__nccwpck_require__(3605));
|
|
54
54
|
var mongodb_1 = __importDefault(__nccwpck_require__(52934));
|
|
55
|
+
var cloudSQL_1 = __importDefault(__nccwpck_require__(6675));
|
|
55
56
|
var project_1 = __importDefault(__nccwpck_require__(44143));
|
|
56
57
|
var theStuffThatReallyMatters_1 = __importDefault(__nccwpck_require__(36265));
|
|
57
58
|
var verify_1 = __nccwpck_require__(98434);
|
|
@@ -76,6 +77,7 @@ exports["default"] = (function () { return __awaiter(void 0, void 0, void 0, fun
|
|
|
76
77
|
(0, verify_1.verify)(vorpal);
|
|
77
78
|
(0, general_1["default"])(vorpal);
|
|
78
79
|
(0, project_1["default"])(vorpal);
|
|
80
|
+
(0, cloudSQL_1["default"])(vorpal);
|
|
79
81
|
(0, mongodb_1["default"])(vorpal);
|
|
80
82
|
(0, theStuffThatReallyMatters_1["default"])(vorpal);
|
|
81
83
|
process.on("exit", function () {
|
|
@@ -89,6 +91,220 @@ exports["default"] = (function () { return __awaiter(void 0, void 0, void 0, fun
|
|
|
89
91
|
|
|
90
92
|
/***/ }),
|
|
91
93
|
|
|
94
|
+
/***/ 61833:
|
|
95
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
96
|
+
|
|
97
|
+
"use strict";
|
|
98
|
+
|
|
99
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
100
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
101
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
102
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
103
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
104
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
105
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
109
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
110
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
111
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
112
|
+
function step(op) {
|
|
113
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
114
|
+
while (_) try {
|
|
115
|
+
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;
|
|
116
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
117
|
+
switch (op[0]) {
|
|
118
|
+
case 0: case 1: t = op; break;
|
|
119
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
120
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
121
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
122
|
+
default:
|
|
123
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
124
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
125
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
126
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
127
|
+
if (t[2]) _.ops.pop();
|
|
128
|
+
_.trys.pop(); continue;
|
|
129
|
+
}
|
|
130
|
+
op = body.call(thisArg, _);
|
|
131
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
132
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
exports.__esModule = true;
|
|
136
|
+
var child_process_promise_1 = __nccwpck_require__(75763);
|
|
137
|
+
var createProxy = function (instance, port) { return __awaiter(void 0, void 0, void 0, function () {
|
|
138
|
+
var proxy, stop;
|
|
139
|
+
return __generator(this, function (_a) {
|
|
140
|
+
switch (_a.label) {
|
|
141
|
+
case 0:
|
|
142
|
+
proxy = (0, child_process_promise_1.spawn)("cloud_sql_proxy -instances ".concat(instance, "=tcp:").concat(port), [], { shell: "bash" });
|
|
143
|
+
// wait until it starts
|
|
144
|
+
return [4 /*yield*/, (0, child_process_promise_1.spawn)("echo -n \"Waiting for proxy\"\n until echo > /dev/tcp/localhost/".concat(port, "; do\n sleep 0.2\n echo -n \".\"\n done 2>/dev/null"), [], { shell: "bash" })];
|
|
145
|
+
case 1:
|
|
146
|
+
// wait until it starts
|
|
147
|
+
_a.sent();
|
|
148
|
+
stop = function () { return proxy.childProcess.kill(); };
|
|
149
|
+
process.on("beforeExit", stop);
|
|
150
|
+
return [2 /*return*/, {
|
|
151
|
+
stop: stop
|
|
152
|
+
}];
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
}); };
|
|
156
|
+
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
157
|
+
return __generator(this, function (_a) {
|
|
158
|
+
return [2 /*return*/, vorpal
|
|
159
|
+
.command("cloud-sql-restore-db", "restore a db from one source to another target")
|
|
160
|
+
.action(function restoreDb() {
|
|
161
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
162
|
+
var sourceInstance, SOURCE_INSTANCE_PORT, TARGET_INSTANCE_PORT, sourceProxy, sourcePassword, sourceDbName, targetInstance, targetProxy, targetPassword, targetDbName, shouldContinue, targetPSQL, copyDBScript;
|
|
163
|
+
return __generator(this, function (_a) {
|
|
164
|
+
switch (_a.label) {
|
|
165
|
+
case 0: return [4 /*yield*/, this.prompt({
|
|
166
|
+
type: "input",
|
|
167
|
+
name: "sourceInstance",
|
|
168
|
+
message: "Source instance (connection string)? 🤔 "
|
|
169
|
+
})];
|
|
170
|
+
case 1:
|
|
171
|
+
sourceInstance = (_a.sent()).sourceInstance;
|
|
172
|
+
SOURCE_INSTANCE_PORT = 54399;
|
|
173
|
+
TARGET_INSTANCE_PORT = 54499;
|
|
174
|
+
return [4 /*yield*/, createProxy(sourceInstance, SOURCE_INSTANCE_PORT)];
|
|
175
|
+
case 2:
|
|
176
|
+
sourceProxy = _a.sent();
|
|
177
|
+
return [4 /*yield*/, this.prompt({
|
|
178
|
+
type: "input",
|
|
179
|
+
name: "sourcePassword",
|
|
180
|
+
message: "Source Password? 🤔 "
|
|
181
|
+
})];
|
|
182
|
+
case 3:
|
|
183
|
+
sourcePassword = (_a.sent()).sourcePassword;
|
|
184
|
+
return [4 /*yield*/, this.prompt({
|
|
185
|
+
type: "input",
|
|
186
|
+
name: "sourceDbName",
|
|
187
|
+
message: "Source DB name? 🤔 "
|
|
188
|
+
})];
|
|
189
|
+
case 4:
|
|
190
|
+
sourceDbName = (_a.sent()).sourceDbName;
|
|
191
|
+
return [4 /*yield*/, this.prompt({
|
|
192
|
+
type: "input",
|
|
193
|
+
name: "targetInstance",
|
|
194
|
+
message: "Targe INSTANCE (connection string)? 🤔 "
|
|
195
|
+
})];
|
|
196
|
+
case 5:
|
|
197
|
+
targetInstance = (_a.sent()).targetInstance;
|
|
198
|
+
return [4 /*yield*/, createProxy(targetInstance, TARGET_INSTANCE_PORT)];
|
|
199
|
+
case 6:
|
|
200
|
+
targetProxy = _a.sent();
|
|
201
|
+
return [4 /*yield*/, this.prompt({
|
|
202
|
+
type: "input",
|
|
203
|
+
name: "targetPassword",
|
|
204
|
+
message: "Target Password? 🤔 "
|
|
205
|
+
})];
|
|
206
|
+
case 7:
|
|
207
|
+
targetPassword = (_a.sent()).targetPassword;
|
|
208
|
+
return [4 /*yield*/, this.prompt({
|
|
209
|
+
type: "input",
|
|
210
|
+
name: "targetDbName",
|
|
211
|
+
message: "Target DB name? 🤔 "
|
|
212
|
+
})];
|
|
213
|
+
case 8:
|
|
214
|
+
targetDbName = (_a.sent()).targetDbName;
|
|
215
|
+
return [4 /*yield*/, this.prompt({
|
|
216
|
+
type: "confirm",
|
|
217
|
+
name: "shouldContinue",
|
|
218
|
+
message: "This will drop ".concat(targetInstance, "/").concat(targetDbName, " and replace it with ").concat(sourceInstance, "/").concat(sourceDbName, ". Continue? \uD83E\uDD14 ")
|
|
219
|
+
})];
|
|
220
|
+
case 9:
|
|
221
|
+
shouldContinue = (_a.sent()).shouldContinue;
|
|
222
|
+
if (!shouldContinue) {
|
|
223
|
+
return [2 /*return*/];
|
|
224
|
+
}
|
|
225
|
+
targetPSQL = function (command) {
|
|
226
|
+
return "PGPASSWORD=".concat(targetPassword, " psql -p ").concat(TARGET_INSTANCE_PORT, " --host=localhost --user=postgres -q ").concat(command);
|
|
227
|
+
};
|
|
228
|
+
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://postgres:".concat(sourcePassword, "@localhost:").concat(SOURCE_INSTANCE_PORT, "/").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 ");
|
|
229
|
+
_a.label = 10;
|
|
230
|
+
case 10:
|
|
231
|
+
_a.trys.push([10, , 12, 13]);
|
|
232
|
+
return [4 /*yield*/, (0, child_process_promise_1.spawn)(copyDBScript, [], { shell: "bash", stdio: "inherit" })];
|
|
233
|
+
case 11:
|
|
234
|
+
_a.sent();
|
|
235
|
+
return [3 /*break*/, 13];
|
|
236
|
+
case 12:
|
|
237
|
+
sourceProxy.stop();
|
|
238
|
+
targetProxy.stop();
|
|
239
|
+
return [7 /*endfinally*/];
|
|
240
|
+
case 13: return [2 /*return*/];
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
})];
|
|
245
|
+
});
|
|
246
|
+
}); });
|
|
247
|
+
//# sourceMappingURL=commandRestoreDb.js.map
|
|
248
|
+
|
|
249
|
+
/***/ }),
|
|
250
|
+
|
|
251
|
+
/***/ 6675:
|
|
252
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
253
|
+
|
|
254
|
+
"use strict";
|
|
255
|
+
|
|
256
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
257
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
258
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
259
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
260
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
261
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
262
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
263
|
+
});
|
|
264
|
+
};
|
|
265
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
266
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
267
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
268
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
269
|
+
function step(op) {
|
|
270
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
271
|
+
while (_) try {
|
|
272
|
+
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;
|
|
273
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
274
|
+
switch (op[0]) {
|
|
275
|
+
case 0: case 1: t = op; break;
|
|
276
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
277
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
278
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
279
|
+
default:
|
|
280
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
281
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
282
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
283
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
284
|
+
if (t[2]) _.ops.pop();
|
|
285
|
+
_.trys.pop(); continue;
|
|
286
|
+
}
|
|
287
|
+
op = body.call(thisArg, _);
|
|
288
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
289
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
293
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
294
|
+
};
|
|
295
|
+
exports.__esModule = true;
|
|
296
|
+
//import commandInitProject from "./commandInitProject.old";
|
|
297
|
+
var commandRestoreDb_1 = __importDefault(__nccwpck_require__(61833));
|
|
298
|
+
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
299
|
+
return __generator(this, function (_a) {
|
|
300
|
+
(0, commandRestoreDb_1["default"])(vorpal);
|
|
301
|
+
return [2 /*return*/];
|
|
302
|
+
});
|
|
303
|
+
}); });
|
|
304
|
+
//# sourceMappingURL=index.js.map
|
|
305
|
+
|
|
306
|
+
/***/ }),
|
|
307
|
+
|
|
92
308
|
/***/ 3605:
|
|
93
309
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
94
310
|
|
|
@@ -1664,93 +1880,6 @@ var templateObject_1;
|
|
|
1664
1880
|
|
|
1665
1881
|
/***/ }),
|
|
1666
1882
|
|
|
1667
|
-
/***/ 45420:
|
|
1668
|
-
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
1669
|
-
|
|
1670
|
-
"use strict";
|
|
1671
|
-
|
|
1672
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1673
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1674
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1675
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1676
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1677
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1678
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1679
|
-
});
|
|
1680
|
-
};
|
|
1681
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
1682
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
1683
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
1684
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
1685
|
-
function step(op) {
|
|
1686
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
1687
|
-
while (_) try {
|
|
1688
|
-
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;
|
|
1689
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
1690
|
-
switch (op[0]) {
|
|
1691
|
-
case 0: case 1: t = op; break;
|
|
1692
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
1693
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
1694
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
1695
|
-
default:
|
|
1696
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
1697
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
1698
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
1699
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
1700
|
-
if (t[2]) _.ops.pop();
|
|
1701
|
-
_.trys.pop(); continue;
|
|
1702
|
-
}
|
|
1703
|
-
op = body.call(thisArg, _);
|
|
1704
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
1705
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
1706
|
-
}
|
|
1707
|
-
};
|
|
1708
|
-
exports.__esModule = true;
|
|
1709
|
-
var getProjectConfig_1 = __nccwpck_require__(24146);
|
|
1710
|
-
var autocompletions_1 = __nccwpck_require__(41373);
|
|
1711
|
-
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1712
|
-
var _a, _b;
|
|
1713
|
-
return __generator(this, function (_c) {
|
|
1714
|
-
switch (_c.label) {
|
|
1715
|
-
case 0:
|
|
1716
|
-
_b = (_a = vorpal
|
|
1717
|
-
.command("copy-db <envComponent>", "replace local db with the one from an env"))
|
|
1718
|
-
.autocomplete;
|
|
1719
|
-
return [4 /*yield*/, (0, autocompletions_1.envAndComponents)()];
|
|
1720
|
-
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])
|
|
1721
|
-
.action(function copyDB(_a) {
|
|
1722
|
-
var envComponent = _a.envComponent;
|
|
1723
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1724
|
-
var _b, env, componentName, _c, customerName, appName, shouldContinue;
|
|
1725
|
-
return __generator(this, function (_d) {
|
|
1726
|
-
switch (_d.label) {
|
|
1727
|
-
case 0:
|
|
1728
|
-
_b = (0, getProjectConfig_1.parseChoice)(envComponent), env = _b.env, componentName = _b.componentName;
|
|
1729
|
-
return [4 /*yield*/, (0, getProjectConfig_1.getProjectConfig)()];
|
|
1730
|
-
case 1:
|
|
1731
|
-
_c = _d.sent(), customerName = _c.customerName, appName = _c.appName;
|
|
1732
|
-
return [4 /*yield*/, this.prompt({
|
|
1733
|
-
type: "confirm",
|
|
1734
|
-
name: "shouldContinue",
|
|
1735
|
-
message: "This will drop your local database and replace it with the remote one. Continue? 🤔 "
|
|
1736
|
-
})];
|
|
1737
|
-
case 2:
|
|
1738
|
-
shouldContinue = (_d.sent()).shouldContinue;
|
|
1739
|
-
if (!shouldContinue) {
|
|
1740
|
-
return [2 /*return*/];
|
|
1741
|
-
}
|
|
1742
|
-
return [2 /*return*/];
|
|
1743
|
-
}
|
|
1744
|
-
});
|
|
1745
|
-
});
|
|
1746
|
-
})];
|
|
1747
|
-
}
|
|
1748
|
-
});
|
|
1749
|
-
}); });
|
|
1750
|
-
//# sourceMappingURL=commandCopyDB.js.map
|
|
1751
|
-
|
|
1752
|
-
/***/ }),
|
|
1753
|
-
|
|
1754
1883
|
/***/ 77042:
|
|
1755
1884
|
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
1756
1885
|
|
|
@@ -3889,7 +4018,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3889
4018
|
exports.__esModule = true;
|
|
3890
4019
|
var commandCloudSqlProxy_1 = __importDefault(__nccwpck_require__(23526));
|
|
3891
4020
|
var commandConfigSecrets_1 = __importDefault(__nccwpck_require__(80883));
|
|
3892
|
-
var commandCopyDB_1 = __importDefault(__nccwpck_require__(45420));
|
|
3893
4021
|
var commandDeletePods_1 = __importDefault(__nccwpck_require__(77042));
|
|
3894
4022
|
var commandDeleteProject_1 = __importDefault(__nccwpck_require__(75582));
|
|
3895
4023
|
var commandEnvVars_1 = __importDefault(__nccwpck_require__(31692));
|
|
@@ -3932,7 +4060,6 @@ exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void
|
|
|
3932
4060
|
(0, commandConfigSecrets_1["default"])(vorpal);
|
|
3933
4061
|
(0, commandSecretsClearBackups_1["default"])(vorpal);
|
|
3934
4062
|
(0, commandDeletePods_1["default"])(vorpal);
|
|
3935
|
-
(0, commandCopyDB_1["default"])(vorpal);
|
|
3936
4063
|
(0, commandGetShell_1["default"])(vorpal);
|
|
3937
4064
|
(0, commandPortForward_1["default"])(vorpal);
|
|
3938
4065
|
(0, commandGitlabCi_1["default"])(vorpal);
|
|
@@ -5845,7 +5972,7 @@ var detectBuildConfig = function (gitlabCi) {
|
|
|
5845
5972
|
return "meteor";
|
|
5846
5973
|
}
|
|
5847
5974
|
if (firstInclude.file === "rails-kubernetes.yml") {
|
|
5848
|
-
|
|
5975
|
+
return "rails";
|
|
5849
5976
|
}
|
|
5850
5977
|
};
|
|
5851
5978
|
exports.detectBuildConfig = detectBuildConfig;
|
|
@@ -350144,6 +350271,8 @@ var custom_1 = __nccwpck_require__(53437);
|
|
|
350144
350271
|
|
|
350145
350272
|
var node_1 = __nccwpck_require__(66994);
|
|
350146
350273
|
|
|
350274
|
+
var rails_1 = __nccwpck_require__(34665);
|
|
350275
|
+
|
|
350147
350276
|
__exportStar(__nccwpck_require__(71197), exports);
|
|
350148
350277
|
|
|
350149
350278
|
__exportStar(__nccwpck_require__(66994), exports);
|
|
@@ -350187,6 +350316,12 @@ exports.BUILD_TYPES = {
|
|
|
350187
350316
|
defaults: function () {
|
|
350188
350317
|
return {};
|
|
350189
350318
|
}
|
|
350319
|
+
},
|
|
350320
|
+
rails: {
|
|
350321
|
+
jobs: rails_1.createRailsJobs,
|
|
350322
|
+
defaults: function () {
|
|
350323
|
+
return {};
|
|
350324
|
+
}
|
|
350190
350325
|
}
|
|
350191
350326
|
};
|
|
350192
350327
|
|
|
@@ -350801,6 +350936,220 @@ exports.getYarnInstall = getYarnInstall;
|
|
|
350801
350936
|
|
|
350802
350937
|
/***/ }),
|
|
350803
350938
|
|
|
350939
|
+
/***/ 38597:
|
|
350940
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
350941
|
+
|
|
350942
|
+
"use strict";
|
|
350943
|
+
|
|
350944
|
+
|
|
350945
|
+
var __assign = this && this.__assign || function () {
|
|
350946
|
+
__assign = Object.assign || function (t) {
|
|
350947
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
350948
|
+
s = arguments[i];
|
|
350949
|
+
|
|
350950
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
350951
|
+
}
|
|
350952
|
+
|
|
350953
|
+
return t;
|
|
350954
|
+
};
|
|
350955
|
+
|
|
350956
|
+
return __assign.apply(this, arguments);
|
|
350957
|
+
};
|
|
350958
|
+
|
|
350959
|
+
exports.__esModule = true;
|
|
350960
|
+
exports.createRailsBuildJobs = void 0;
|
|
350961
|
+
|
|
350962
|
+
var docker_1 = __nccwpck_require__(33219);
|
|
350963
|
+
|
|
350964
|
+
var createRailsBuildJobs = function (context) {
|
|
350965
|
+
return [(0, docker_1.createDockerBuildJobBase)(context, {
|
|
350966
|
+
variables: __assign({
|
|
350967
|
+
CNB_BUILDER: "heroku/buildpacks:18",
|
|
350968
|
+
CNB_ENV_VARS: "BUNDLE_GIT__PANTER__CH",
|
|
350969
|
+
CNB_EXTRA_ARGS: "",
|
|
350970
|
+
CNB_PACK_VERSION: "0.20.0"
|
|
350971
|
+
}, context.componentConfig.build.extraVars),
|
|
350972
|
+
// custom script
|
|
350973
|
+
script: [docker_1.gitlabDockerLogin, "docker pull $DOCKER_CACHE_IMAGE || true", "wget --output-document=- https://github.com/buildpacks/pack/releases/download/v$CNB_PACK_VERSION/pack-v$CNB_PACK_VERSION-linux.tgz | tar -zx --directory /usr/local/bin pack", "chmod +x /usr/local/bin/pack", // replace private git ssh gem sources with https to make bundler with credentials via env var work
|
|
350974
|
+
// eslint-disable-next-line no-useless-escape
|
|
350975
|
+
"sed --in-place 's|git@([^:]*):|https://1/|g' Gemfile Gemfile.lock", "for v in $CNB_ENV_VARS; do env_args=\"$env_args --env $v\"; done", "pack build $DOCKER_IMAGE:$DOCKER_IMAGE_TAG --builder $CNB_BUILDER --publish --cache-image $DOCKER_CACHE_IMAGE $env_args $CNB_EXTRA_ARGS"]
|
|
350976
|
+
})];
|
|
350977
|
+
};
|
|
350978
|
+
|
|
350979
|
+
exports.createRailsBuildJobs = createRailsBuildJobs;
|
|
350980
|
+
|
|
350981
|
+
/***/ }),
|
|
350982
|
+
|
|
350983
|
+
/***/ 34665:
|
|
350984
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
350985
|
+
|
|
350986
|
+
"use strict";
|
|
350987
|
+
|
|
350988
|
+
|
|
350989
|
+
var __read = this && this.__read || function (o, n) {
|
|
350990
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
350991
|
+
if (!m) return o;
|
|
350992
|
+
var i = m.call(o),
|
|
350993
|
+
r,
|
|
350994
|
+
ar = [],
|
|
350995
|
+
e;
|
|
350996
|
+
|
|
350997
|
+
try {
|
|
350998
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
350999
|
+
} catch (error) {
|
|
351000
|
+
e = {
|
|
351001
|
+
error: error
|
|
351002
|
+
};
|
|
351003
|
+
} finally {
|
|
351004
|
+
try {
|
|
351005
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
351006
|
+
} finally {
|
|
351007
|
+
if (e) throw e.error;
|
|
351008
|
+
}
|
|
351009
|
+
}
|
|
351010
|
+
|
|
351011
|
+
return ar;
|
|
351012
|
+
};
|
|
351013
|
+
|
|
351014
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
351015
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
351016
|
+
if (ar || !(i in from)) {
|
|
351017
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
351018
|
+
ar[i] = from[i];
|
|
351019
|
+
}
|
|
351020
|
+
}
|
|
351021
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
351022
|
+
};
|
|
351023
|
+
|
|
351024
|
+
exports.__esModule = true;
|
|
351025
|
+
exports.createRailsJobs = void 0;
|
|
351026
|
+
|
|
351027
|
+
var build_1 = __nccwpck_require__(38597);
|
|
351028
|
+
|
|
351029
|
+
var test_1 = __nccwpck_require__(25444);
|
|
351030
|
+
|
|
351031
|
+
var createRailsJobs = function (context) {
|
|
351032
|
+
return __spreadArray(__spreadArray([], __read((0, test_1.createRailsTestJobs)(context)), false), __read((0, build_1.createRailsBuildJobs)(context)), false);
|
|
351033
|
+
};
|
|
351034
|
+
|
|
351035
|
+
exports.createRailsJobs = createRailsJobs;
|
|
351036
|
+
|
|
351037
|
+
/***/ }),
|
|
351038
|
+
|
|
351039
|
+
/***/ 25444:
|
|
351040
|
+
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
|
351041
|
+
|
|
351042
|
+
"use strict";
|
|
351043
|
+
|
|
351044
|
+
|
|
351045
|
+
var __assign = this && this.__assign || function () {
|
|
351046
|
+
__assign = Object.assign || function (t) {
|
|
351047
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
351048
|
+
s = arguments[i];
|
|
351049
|
+
|
|
351050
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
351051
|
+
}
|
|
351052
|
+
|
|
351053
|
+
return t;
|
|
351054
|
+
};
|
|
351055
|
+
|
|
351056
|
+
return __assign.apply(this, arguments);
|
|
351057
|
+
};
|
|
351058
|
+
|
|
351059
|
+
var __read = this && this.__read || function (o, n) {
|
|
351060
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
351061
|
+
if (!m) return o;
|
|
351062
|
+
var i = m.call(o),
|
|
351063
|
+
r,
|
|
351064
|
+
ar = [],
|
|
351065
|
+
e;
|
|
351066
|
+
|
|
351067
|
+
try {
|
|
351068
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
351069
|
+
} catch (error) {
|
|
351070
|
+
e = {
|
|
351071
|
+
error: error
|
|
351072
|
+
};
|
|
351073
|
+
} finally {
|
|
351074
|
+
try {
|
|
351075
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
351076
|
+
} finally {
|
|
351077
|
+
if (e) throw e.error;
|
|
351078
|
+
}
|
|
351079
|
+
}
|
|
351080
|
+
|
|
351081
|
+
return ar;
|
|
351082
|
+
};
|
|
351083
|
+
|
|
351084
|
+
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
|
|
351085
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
351086
|
+
if (ar || !(i in from)) {
|
|
351087
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
351088
|
+
ar[i] = from[i];
|
|
351089
|
+
}
|
|
351090
|
+
}
|
|
351091
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
351092
|
+
};
|
|
351093
|
+
|
|
351094
|
+
exports.__esModule = true;
|
|
351095
|
+
exports.createRailsTestJobs = void 0;
|
|
351096
|
+
|
|
351097
|
+
var utils_1 = __nccwpck_require__(37461);
|
|
351098
|
+
|
|
351099
|
+
var createRailsTestJobs = function (context) {
|
|
351100
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p; // don't run tests after release
|
|
351101
|
+
|
|
351102
|
+
|
|
351103
|
+
if (((_a = context.commitInfo) === null || _a === void 0 ? void 0 : _a.trigger) === "taggedRelease") {
|
|
351104
|
+
return [];
|
|
351105
|
+
}
|
|
351106
|
+
|
|
351107
|
+
var buildConfig = context.componentConfig.build;
|
|
351108
|
+
var base = {
|
|
351109
|
+
variables: (_b = buildConfig.extraVars) !== null && _b !== void 0 ? _b : {},
|
|
351110
|
+
stage: "test",
|
|
351111
|
+
needs: [],
|
|
351112
|
+
envMode: "none"
|
|
351113
|
+
};
|
|
351114
|
+
var defaultImage = "docker.io/ruby";
|
|
351115
|
+
var bundlerCacheDir = "tmp/cache";
|
|
351116
|
+
var bundlerInstall = ["bundle config set path '".concat(bundlerCacheDir, "'"), "bundle install -j $(nproc)"];
|
|
351117
|
+
var bundlerCache = {
|
|
351118
|
+
key: {
|
|
351119
|
+
files: ["Gemfile.lock"],
|
|
351120
|
+
prefix: "$CI_JOB_IMAGE"
|
|
351121
|
+
},
|
|
351122
|
+
paths: [bundlerCacheDir]
|
|
351123
|
+
};
|
|
351124
|
+
var auditJob = buildConfig.audit !== false ? __assign(__assign({
|
|
351125
|
+
name: "🛡 audit"
|
|
351126
|
+
}, base), {
|
|
351127
|
+
cache: undefined,
|
|
351128
|
+
image: (_d = (_c = buildConfig.audit) === null || _c === void 0 ? void 0 : _c.jobImage) !== null && _d !== void 0 ? _d : defaultImage,
|
|
351129
|
+
script: __spreadArray(["cd ".concat(context.componentConfig.dir)], __read((_f = (0, utils_1.ensureArray)((_e = buildConfig.audit) === null || _e === void 0 ? void 0 : _e.command)) !== null && _f !== void 0 ? _f : ["gem install bundler-audit", "bundle audit check"]), false),
|
|
351130
|
+
allow_failure: true
|
|
351131
|
+
}) : null;
|
|
351132
|
+
var lintJob = buildConfig.lint !== false ? __assign(__assign({
|
|
351133
|
+
name: "👮 lint"
|
|
351134
|
+
}, base), {
|
|
351135
|
+
cache: bundlerCache,
|
|
351136
|
+
image: (_h = (_g = buildConfig.lint) === null || _g === void 0 ? void 0 : _g.jobImage) !== null && _h !== void 0 ? _h : defaultImage,
|
|
351137
|
+
script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(bundlerInstall), false), __read((_k = (0, utils_1.ensureArray)((_j = buildConfig.lint) === null || _j === void 0 ? void 0 : _j.command)) !== null && _k !== void 0 ? _k : ["bundle exec rubocop"]), false)
|
|
351138
|
+
}) : null;
|
|
351139
|
+
var testJob = buildConfig.test !== false ? __assign(__assign({
|
|
351140
|
+
name: "🧪 test"
|
|
351141
|
+
}, base), {
|
|
351142
|
+
cache: bundlerCache,
|
|
351143
|
+
image: (_m = (_l = buildConfig.test) === null || _l === void 0 ? void 0 : _l.jobImage) !== null && _m !== void 0 ? _m : defaultImage,
|
|
351144
|
+
script: __spreadArray(__spreadArray(["cd ".concat(context.componentConfig.dir)], __read(bundlerInstall), false), __read((_p = (0, utils_1.ensureArray)((_o = buildConfig.test) === null || _o === void 0 ? void 0 : _o.command)) !== null && _p !== void 0 ? _p : ["bundle exec rspec"]), false)
|
|
351145
|
+
}) : null;
|
|
351146
|
+
return [auditJob, lintJob, testJob].filter(utils_1.notNil);
|
|
351147
|
+
};
|
|
351148
|
+
|
|
351149
|
+
exports.createRailsTestJobs = createRailsTestJobs;
|
|
351150
|
+
|
|
351151
|
+
/***/ }),
|
|
351152
|
+
|
|
350804
351153
|
/***/ 71197:
|
|
350805
351154
|
/***/ ((__unused_webpack_module, exports) => {
|
|
350806
351155
|
|
|
@@ -351025,7 +351374,7 @@ exports.readConfigSync = readConfigSync;
|
|
|
351025
351374
|
|
|
351026
351375
|
exports.__esModule = true;
|
|
351027
351376
|
exports.DOCKER_REGISTRY = exports.PIPELINE_IMAGE_TAG = void 0;
|
|
351028
|
-
exports.PIPELINE_IMAGE_TAG = "main-
|
|
351377
|
+
exports.PIPELINE_IMAGE_TAG = "main-209fcf0b" || 0;
|
|
351029
351378
|
exports.DOCKER_REGISTRY = "git.panter.ch:5001/catladder/catladder" || 0;
|
|
351030
351379
|
|
|
351031
351380
|
/***/ }),
|
|
@@ -351568,8 +351917,9 @@ var getEnvironmentVariables = function (config, componentName, env, commitInfo,
|
|
|
351568
351917
|
additionalEnvVars = deployConfigRaw ? deploy_1.DEPLOY_TYPES[deployConfigRaw.type].getAdditionalEnvVars(environmentContext) : {};
|
|
351569
351918
|
host = (_c = (_b = envConfigRaw === null || envConfigRaw === void 0 ? void 0 : envConfigRaw.host) !== null && _b !== void 0 ? _b : additionalEnvVars.HOST_CANONICAL) !== null && _c !== void 0 ? _c : "unknown-host.example.com";
|
|
351570
351919
|
url = "https://".concat(host);
|
|
351571
|
-
predefinedVariables = __assign(__assign(__assign({}, basePredefinedVariables), {
|
|
351572
|
-
HOST: host
|
|
351920
|
+
predefinedVariables = __assign(__assign(__assign(__assign({}, basePredefinedVariables), config.components[componentName].build.type === "rails" ? {} : {
|
|
351921
|
+
HOST: host
|
|
351922
|
+
}), {
|
|
351573
351923
|
ROOT_URL: url
|
|
351574
351924
|
}), additionalEnvVars);
|
|
351575
351925
|
}
|