@catladder/cli 1.0.0 → 1.0.4
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/package.json +4 -11
- package/src/apps/cli/cli.ts +0 -2
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +9 -5
- package/src/apps/cli/verify/migration/fromv2.ts +1 -2
- package/dist/apps/catenv/catenv.d.ts +0 -2
- package/dist/apps/catenv/catenv.js +0 -135
- package/dist/apps/catenv/catenv.js.map +0 -1
- package/dist/apps/cli/cli.d.ts +0 -2
- package/dist/apps/cli/cli.js +0 -81
- package/dist/apps/cli/cli.js.map +0 -1
- package/dist/apps/cli/commands/general/index.d.ts +0 -4
- package/dist/apps/cli/commands/general/index.js +0 -274
- package/dist/apps/cli/commands/general/index.js.map +0 -1
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.d.ts +0 -3
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.js +0 -56
- package/dist/apps/cli/commands/general/namespaceAutoCompletion.js.map +0 -1
- package/dist/apps/cli/commands/general/portForward.d.ts +0 -3
- package/dist/apps/cli/commands/general/portForward.js +0 -98
- package/dist/apps/cli/commands/general/portForward.js.map +0 -1
- package/dist/apps/cli/commands/mongodb/index.d.ts +0 -3
- package/dist/apps/cli/commands/mongodb/index.js +0 -53
- package/dist/apps/cli/commands/mongodb/index.js.map +0 -1
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +0 -3
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +0 -190
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +0 -1
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +0 -3
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js +0 -96
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.js.map +0 -1
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +0 -3
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js +0 -105
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.js.map +0 -1
- package/dist/apps/cli/commands/mongodb/utils/index.d.ts +0 -13
- package/dist/apps/cli/commands/mongodb/utils/index.js +0 -167
- package/dist/apps/cli/commands/mongodb/utils/index.js.map +0 -1
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +0 -128
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +0 -1
- package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandConfigSecrets.js +0 -254
- package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +0 -1
- package/dist/apps/cli/commands/project/commandCopyDB.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandCopyDB.js +0 -102
- package/dist/apps/cli/commands/project/commandCopyDB.js.map +0 -1
- package/dist/apps/cli/commands/project/commandDeletePods.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandDeletePods.js +0 -119
- package/dist/apps/cli/commands/project/commandDeletePods.js.map +0 -1
- package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandDeleteProject.js +0 -97
- package/dist/apps/cli/commands/project/commandDeleteProject.js.map +0 -1
- package/dist/apps/cli/commands/project/commandEnvVars.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandEnvVars.js +0 -74
- package/dist/apps/cli/commands/project/commandEnvVars.js.map +0 -1
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js +0 -58
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.js.map +0 -1
- package/dist/apps/cli/commands/project/commandGetShell.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandGetShell.js +0 -92
- package/dist/apps/cli/commands/project/commandGetShell.js.map +0 -1
- package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandGitlabCi.js +0 -185
- package/dist/apps/cli/commands/project/commandGitlabCi.js.map +0 -1
- package/dist/apps/cli/commands/project/commandInitGitlab.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandInitGitlab.js +0 -245
- package/dist/apps/cli/commands/project/commandInitGitlab.js.map +0 -1
- package/dist/apps/cli/commands/project/commandInitProject.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandInitProject.js +0 -345
- package/dist/apps/cli/commands/project/commandInitProject.js.map +0 -1
- package/dist/apps/cli/commands/project/commandListPods.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandListPods.js +0 -78
- package/dist/apps/cli/commands/project/commandListPods.js.map +0 -1
- package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +0 -7
- package/dist/apps/cli/commands/project/commandMigrateHelm3.js +0 -113
- package/dist/apps/cli/commands/project/commandMigrateHelm3.js.map +0 -1
- package/dist/apps/cli/commands/project/commandNamespace.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandNamespace.js +0 -70
- package/dist/apps/cli/commands/project/commandNamespace.js.map +0 -1
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.js +0 -83
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.js.map +0 -1
- package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandOpenDashboard.js +0 -92
- package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +0 -1
- package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandOpenEnv.js +0 -80
- package/dist/apps/cli/commands/project/commandOpenEnv.js.map +0 -1
- package/dist/apps/cli/commands/project/commandOpenGit.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandOpenGit.js +0 -56
- package/dist/apps/cli/commands/project/commandOpenGit.js.map +0 -1
- package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandOpenGrafana.js +0 -83
- package/dist/apps/cli/commands/project/commandOpenGrafana.js.map +0 -1
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +0 -99
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +0 -1
- package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandOpenLogs.js +0 -87
- package/dist/apps/cli/commands/project/commandOpenLogs.js.map +0 -1
- package/dist/apps/cli/commands/project/commandPauseProject.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandPauseProject.js +0 -97
- package/dist/apps/cli/commands/project/commandPauseProject.js.map +0 -1
- package/dist/apps/cli/commands/project/commandPortForward.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandPortForward.js +0 -106
- package/dist/apps/cli/commands/project/commandPortForward.js.map +0 -1
- package/dist/apps/cli/commands/project/commandReloadConfig.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandReloadConfig.js +0 -62
- package/dist/apps/cli/commands/project/commandReloadConfig.js.map +0 -1
- package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +0 -3
- package/dist/apps/cli/commands/project/commandTriggerCronjob.js +0 -144
- package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +0 -1
- package/dist/apps/cli/commands/project/index.d.ts +0 -3
- package/dist/apps/cli/commands/project/index.js +0 -97
- package/dist/apps/cli/commands/project/index.js.map +0 -1
- package/dist/apps/cli/commands/project/utils/autocompletions.d.ts +0 -3
- package/dist/apps/cli/commands/project/utils/autocompletions.js +0 -96
- package/dist/apps/cli/commands/project/utils/autocompletions.js.map +0 -1
- package/dist/apps/cli/commands/project/utils/ensureCluster.d.ts +0 -1
- package/dist/apps/cli/commands/project/utils/ensureCluster.js +0 -84
- package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +0 -1
- package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +0 -1
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js +0 -92
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +0 -1
- package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +0 -2
- package/dist/apps/cli/commands/project/utils/showProjectBanner.js +0 -58
- package/dist/apps/cli/commands/project/utils/showProjectBanner.js.map +0 -1
- package/dist/apps/cli/commands/shared/index.d.ts +0 -2
- package/dist/apps/cli/commands/shared/index.js +0 -72
- package/dist/apps/cli/commands/shared/index.js.map +0 -1
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +0 -3
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +0 -131
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +0 -1
- package/dist/apps/cli/config/writeConfig.d.ts +0 -5
- package/dist/apps/cli/config/writeConfig.js +0 -104
- package/dist/apps/cli/config/writeConfig.js.map +0 -1
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.d.ts +0 -1
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.js +0 -69
- package/dist/apps/cli/utils/getGoogleAuthUserNumber.js.map +0 -1
- package/dist/apps/cli/verify/index.d.ts +0 -2
- package/dist/apps/cli/verify/index.js +0 -90
- package/dist/apps/cli/verify/index.js.map +0 -1
- package/dist/apps/cli/verify/migration/fromv2.d.ts +0 -3
- package/dist/apps/cli/verify/migration/fromv2.js +0 -322
- package/dist/apps/cli/verify/migration/fromv2.js.map +0 -1
- package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +0 -4
- package/dist/apps/cli/verify/migration/migrateSecrets.js +0 -88
- package/dist/apps/cli/verify/migration/migrateSecrets.js.map +0 -1
- package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +0 -17
- package/dist/apps/cli/verify/migration/oldGitlabCi.js +0 -26
- package/dist/apps/cli/verify/migration/oldGitlabCi.js.map +0 -1
- package/dist/catenv.d.ts +0 -1
- package/dist/catenv.js +0 -8
- package/dist/catenv.js.map +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -13
- package/dist/cli.js.map +0 -1
- package/dist/config/clusters.d.ts +0 -14
- package/dist/config/clusters.js +0 -72
- package/dist/config/clusters.js.map +0 -1
- package/dist/config/constants.d.ts +0 -4
- package/dist/config/constants.js +0 -8
- package/dist/config/constants.js.map +0 -1
- package/dist/config/getProjectConfig.d.ts +0 -21
- package/dist/config/getProjectConfig.js +0 -212
- package/dist/config/getProjectConfig.js.map +0 -1
- package/dist/k8sApi/index.d.ts +0 -5
- package/dist/k8sApi/index.js +0 -11
- package/dist/k8sApi/index.js.map +0 -1
- package/dist/packageInfos.d.ts +0 -2
- package/dist/packageInfos.js +0 -6
- package/dist/packageInfos.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
- package/dist/types/types.d.ts +0 -18
- package/dist/types/types.js +0 -3
- package/dist/types/types.js.map +0 -1
- package/dist/utils/cluster.d.ts +0 -12
- package/dist/utils/cluster.js +0 -100
- package/dist/utils/cluster.js.map +0 -1
- package/dist/utils/dashboardToken.d.ts +0 -2
- package/dist/utils/dashboardToken.js +0 -89
- package/dist/utils/dashboardToken.js.map +0 -1
- package/dist/utils/editAsFile.d.ts +0 -1
- package/dist/utils/editAsFile.js +0 -85
- package/dist/utils/editAsFile.js.map +0 -1
- package/dist/utils/files.d.ts +0 -2
- package/dist/utils/files.js +0 -83
- package/dist/utils/files.js.map +0 -1
- package/dist/utils/formatEnvVars.d.ts +0 -2
- package/dist/utils/formatEnvVars.js +0 -10
- package/dist/utils/formatEnvVars.js.map +0 -1
- package/dist/utils/getEditor.d.ts +0 -4
- package/dist/utils/getEditor.js +0 -70
- package/dist/utils/getEditor.js.map +0 -1
- package/dist/utils/gitlab.d.ts +0 -21
- package/dist/utils/gitlab.js +0 -258
- package/dist/utils/gitlab.js.map +0 -1
- package/dist/utils/log.d.ts +0 -1
- package/dist/utils/log.js +0 -14
- package/dist/utils/log.js.map +0 -1
- package/dist/utils/passwordstore/index.d.ts +0 -8
- package/dist/utils/passwordstore/index.js +0 -378
- package/dist/utils/passwordstore/index.js.map +0 -1
- package/dist/utils/portForward.d.ts +0 -4
- package/dist/utils/portForward.js +0 -116
- package/dist/utils/portForward.js.map +0 -1
- package/dist/utils/preferences/index.d.ts +0 -3
- package/dist/utils/preferences/index.js +0 -119
- package/dist/utils/preferences/index.js.map +0 -1
- package/dist/utils/projects/index.d.ts +0 -8
- package/dist/utils/projects/index.js +0 -150
- package/dist/utils/projects/index.js.map +0 -1
- package/dist/utils/promise.d.ts +0 -2
- package/dist/utils/promise.js +0 -62
- package/dist/utils/promise.js.map +0 -1
- package/dist/utils/shell.d.ts +0 -1
- package/dist/utils/shell.js +0 -81
- package/dist/utils/shell.js.map +0 -1
- package/src/types/git-repo-name.d.ts +0 -1
- package/src/types/yawn-yaml.d.ts +0 -1
- package/src/utils/dashboardToken.ts +0 -20
|
@@ -1,245 +0,0 @@
|
|
|
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
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
39
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
40
|
-
if (ar || !(i in from)) {
|
|
41
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
42
|
-
ar[i] = from[i];
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
46
|
-
};
|
|
47
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
48
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
49
|
-
};
|
|
50
|
-
exports.__esModule = true;
|
|
51
|
-
var pipeline_1 = require("@catladder/pipeline");
|
|
52
|
-
var open_1 = __importDefault(require("open"));
|
|
53
|
-
var getProjectConfig_1 = require("../../../../config/getProjectConfig");
|
|
54
|
-
var cluster_1 = require("../../../../utils/cluster");
|
|
55
|
-
var gitlab_1 = require("../../../../utils/gitlab");
|
|
56
|
-
var passwordstore_1 = require("../../../../utils/passwordstore");
|
|
57
|
-
var projects_1 = require("../../../../utils/projects");
|
|
58
|
-
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
59
|
-
return __generator(this, function (_a) {
|
|
60
|
-
return [2 /*return*/, vorpal
|
|
61
|
-
.command("project-init-gitlab", "Initializes the gitlab repo, e.g. connects the cluster to it")
|
|
62
|
-
.action(function () {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
64
|
-
var _a, projectId, projectWebUrl, existingGitlabClusters, existingClusters, allContext, allDeployments, configuredClusterNames, configuredClusters, missingClusters, _i, missingClusters_1, cluster, shouldContinue, _b, api_url, passCredentials, token, ca_cert, postResult, _c, _d, message, variables, understood, GL_TOKEN, deploy_tokens;
|
|
65
|
-
var _e, _f;
|
|
66
|
-
var _this = this;
|
|
67
|
-
return __generator(this, function (_g) {
|
|
68
|
-
switch (_g.label) {
|
|
69
|
-
case 0: return [4 /*yield*/, (0, gitlab_1.getProjectInfo)(this)];
|
|
70
|
-
case 1:
|
|
71
|
-
_a = _g.sent(), projectId = _a.id, projectWebUrl = _a.web_url;
|
|
72
|
-
return [4 /*yield*/, (0, gitlab_1.doGitlabRequest)(this, "projects/".concat(projectId, "/clusters"))];
|
|
73
|
-
case 2:
|
|
74
|
-
existingGitlabClusters = _g.sent();
|
|
75
|
-
existingClusters = existingGitlabClusters.map(function (c) {
|
|
76
|
-
var found = (0, cluster_1.getClusterByFullName)(c.name);
|
|
77
|
-
return {
|
|
78
|
-
name: found ? found.name : null,
|
|
79
|
-
fullName: c.name
|
|
80
|
-
};
|
|
81
|
-
});
|
|
82
|
-
if (existingClusters.length === 0) {
|
|
83
|
-
this.log("");
|
|
84
|
-
this.log("there is no cluster on the current project?");
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
this.log("there are already these clusters on the gitlab: ");
|
|
88
|
-
this.log("");
|
|
89
|
-
existingClusters.forEach(function (cluster) {
|
|
90
|
-
return _this.log(" - ".concat(cluster.name || "unknown", " (").concat(cluster.fullName, ")"));
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
this.log("");
|
|
94
|
-
this.log("your project specifies the following clusters:");
|
|
95
|
-
this.log("");
|
|
96
|
-
return [4 /*yield*/, (0, getProjectConfig_1.getAllPipelineContexts)()];
|
|
97
|
-
case 3:
|
|
98
|
-
allContext = _g.sent();
|
|
99
|
-
allDeployments = allContext.map(function (c) { return c.componentConfig.deploy; });
|
|
100
|
-
configuredClusterNames = allDeployments.reduce(function (acc, c) {
|
|
101
|
-
if ((0, pipeline_1.isOfDeployType)(c, "kubernetes") &&
|
|
102
|
-
!acc.includes(c.cluster || "production")) {
|
|
103
|
-
return __spreadArray(__spreadArray([], acc, true), [c.cluster || "production"], false);
|
|
104
|
-
}
|
|
105
|
-
return acc;
|
|
106
|
-
}, []);
|
|
107
|
-
configuredClusters = configuredClusterNames.map(function (c) { return ({
|
|
108
|
-
name: c,
|
|
109
|
-
config: (0, cluster_1.getClusterByName)(c)
|
|
110
|
-
}); });
|
|
111
|
-
configuredClusters.forEach(function (cluster) {
|
|
112
|
-
return _this.log(" - ".concat(cluster.name || "unknown", " (").concat(cluster.config.fullName, ")"));
|
|
113
|
-
});
|
|
114
|
-
this.log("");
|
|
115
|
-
missingClusters = configuredClusters.filter(function (c) { return !existingClusters.some(function (exist) { return exist.name === c.name; }); });
|
|
116
|
-
this.log("");
|
|
117
|
-
this.log("These clusters are not configured yet on gitlab:");
|
|
118
|
-
this.log("");
|
|
119
|
-
missingClusters.forEach(function (cluster) {
|
|
120
|
-
return _this.log(" - ".concat(cluster.name || "unknown", " (").concat(cluster.config.fullName, ")"));
|
|
121
|
-
});
|
|
122
|
-
this.log("");
|
|
123
|
-
_i = 0, missingClusters_1 = missingClusters;
|
|
124
|
-
_g.label = 4;
|
|
125
|
-
case 4:
|
|
126
|
-
if (!(_i < missingClusters_1.length)) return [3 /*break*/, 11];
|
|
127
|
-
cluster = missingClusters_1[_i];
|
|
128
|
-
this.log("".concat(cluster, " (").concat(cluster.config.fullName, ")"));
|
|
129
|
-
this.log("");
|
|
130
|
-
return [4 /*yield*/, this.prompt({
|
|
131
|
-
type: "confirm",
|
|
132
|
-
name: "shouldContinue",
|
|
133
|
-
message: "Should I add the this cluster ? 🤔 "
|
|
134
|
-
})];
|
|
135
|
-
case 5:
|
|
136
|
-
shouldContinue = (_g.sent()).shouldContinue;
|
|
137
|
-
this.log("");
|
|
138
|
-
if (!shouldContinue) return [3 /*break*/, 10];
|
|
139
|
-
_b = cluster.config, api_url = _b.api_url, passCredentials = _b.passCredentials;
|
|
140
|
-
if (!api_url) {
|
|
141
|
-
throw new Error("no api_url on this cluster!");
|
|
142
|
-
}
|
|
143
|
-
if (!passCredentials) {
|
|
144
|
-
throw new Error("no passCredentials on this cluster!");
|
|
145
|
-
}
|
|
146
|
-
return [4 /*yield*/, (0, passwordstore_1.readPass)(passCredentials.token)];
|
|
147
|
-
case 6:
|
|
148
|
-
token = _g.sent();
|
|
149
|
-
return [4 /*yield*/, (0, passwordstore_1.readPass)(passCredentials.ca_cert)];
|
|
150
|
-
case 7:
|
|
151
|
-
ca_cert = _g.sent();
|
|
152
|
-
_c = gitlab_1.doGitlabRequest;
|
|
153
|
-
_d = [this, "projects/".concat(projectId, "/clusters/user")];
|
|
154
|
-
_e = {
|
|
155
|
-
name: cluster.config.fullName,
|
|
156
|
-
managed: false
|
|
157
|
-
};
|
|
158
|
-
_f = {
|
|
159
|
-
api_url: api_url,
|
|
160
|
-
ca_cert: ca_cert,
|
|
161
|
-
token: token
|
|
162
|
-
};
|
|
163
|
-
return [4 /*yield*/, (0, projects_1.getProjectNamespace)("prod")];
|
|
164
|
-
case 8: return [4 /*yield*/, _c.apply(void 0, _d.concat([(_e.platform_kubernetes_attributes = (_f.namespace = _g.sent(),
|
|
165
|
-
_f),
|
|
166
|
-
_e)]))];
|
|
167
|
-
case 9:
|
|
168
|
-
postResult = _g.sent();
|
|
169
|
-
message = postResult.message;
|
|
170
|
-
if (message) {
|
|
171
|
-
this.log("Message from gitlab: ".concat(message));
|
|
172
|
-
}
|
|
173
|
-
_g.label = 10;
|
|
174
|
-
case 10:
|
|
175
|
-
_i++;
|
|
176
|
-
return [3 /*break*/, 4];
|
|
177
|
-
case 11: return [4 /*yield*/, (0, gitlab_1.doGitlabRequest)(this, "projects/".concat(projectId, "/variables"))];
|
|
178
|
-
case 12:
|
|
179
|
-
variables = _g.sent();
|
|
180
|
-
if (!!variables.find(function (v) { return v.key === "GL_TOKEN"; })) return [3 /*break*/, 16];
|
|
181
|
-
this.log("I need add a GL_TOKEN to the project, so that semantic release will work\n");
|
|
182
|
-
this.log("👉 Please please create a project access token in gitlab and copy its value into clipboard\n\n - name: something like 'semantic-release'\n - expires: leave empty\n - scopes: api, read_repository");
|
|
183
|
-
this.log("\n");
|
|
184
|
-
return [4 /*yield*/, this.prompt({
|
|
185
|
-
"default": true,
|
|
186
|
-
message: "Understood and open gitlab now? 🤔",
|
|
187
|
-
name: "understood",
|
|
188
|
-
type: "confirm"
|
|
189
|
-
})];
|
|
190
|
-
case 13:
|
|
191
|
-
understood = (_g.sent()).understood;
|
|
192
|
-
if (!understood) {
|
|
193
|
-
this.log("continuing anyway...");
|
|
194
|
-
}
|
|
195
|
-
(0, open_1["default"])("".concat(projectWebUrl, "/-/settings/access_tokens"));
|
|
196
|
-
this.log("\n");
|
|
197
|
-
this.log("Enter your copied token now: ");
|
|
198
|
-
this.log("\n");
|
|
199
|
-
return [4 /*yield*/, this.prompt({
|
|
200
|
-
type: "password",
|
|
201
|
-
name: "GL_TOKEN",
|
|
202
|
-
message: "Access Token: "
|
|
203
|
-
})];
|
|
204
|
-
case 14:
|
|
205
|
-
GL_TOKEN = (_g.sent()).GL_TOKEN;
|
|
206
|
-
return [4 /*yield*/, (0, gitlab_1.doGitlabRequest)(this, "projects/".concat(projectId, "/variables"), {
|
|
207
|
-
key: "GL_TOKEN",
|
|
208
|
-
value: GL_TOKEN
|
|
209
|
-
})];
|
|
210
|
-
case 15:
|
|
211
|
-
_g.sent();
|
|
212
|
-
_g.label = 16;
|
|
213
|
-
case 16: return [4 /*yield*/, (0, gitlab_1.doGitlabRequest)(this, "projects/".concat(projectId, "/deploy_tokens"))];
|
|
214
|
-
case 17:
|
|
215
|
-
deploy_tokens = _g.sent();
|
|
216
|
-
if (!!deploy_tokens.find(function (v) { return v.name === "gitlab-deploy-token"; })) return [3 /*break*/, 19];
|
|
217
|
-
this.log("I will setup the 'GitLab Deploy Token', so Kubernetes can pull images from this project.");
|
|
218
|
-
return [4 /*yield*/, (0, gitlab_1.doGitlabRequest)(this, "projects/".concat(projectId, "/deploy_tokens"), {
|
|
219
|
-
id: projectId,
|
|
220
|
-
name: "gitlab-deploy-token",
|
|
221
|
-
scopes: ["read_registry"]
|
|
222
|
-
})];
|
|
223
|
-
case 18:
|
|
224
|
-
_g.sent();
|
|
225
|
-
_g.label = 19;
|
|
226
|
-
case 19:
|
|
227
|
-
this.log("gitlab is ready! 🥂");
|
|
228
|
-
this.log("\n");
|
|
229
|
-
this.log("do not forget to make sure that:");
|
|
230
|
-
[
|
|
231
|
-
"you have __health route in place",
|
|
232
|
-
"lint and test are defined",
|
|
233
|
-
"eat your vegetables",
|
|
234
|
-
"be awesome 🤩",
|
|
235
|
-
].forEach(function (tip) { return _this.log(" - ".concat(tip)); });
|
|
236
|
-
this.log("\n");
|
|
237
|
-
this.log("\n");
|
|
238
|
-
return [2 /*return*/];
|
|
239
|
-
}
|
|
240
|
-
});
|
|
241
|
-
});
|
|
242
|
-
})];
|
|
243
|
-
});
|
|
244
|
-
}); });
|
|
245
|
-
//# sourceMappingURL=commandInitGitlab.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commandInitGitlab.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/project/commandInitGitlab.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAqD;AACrD,8CAAwB;AAExB,wEAA6E;AAC7E,qDAGmC;AACnC,mDAA2E;AAC3E,iEAA2D;AAC3D,uDAAiE;AAEjE,sBAAe,UAAO,MAAc;;QAClC,sBAAA,MAAM;iBACH,OAAO,CACN,qBAAqB,EACrB,8DAA8D,CAC/D;iBACA,MAAM,CAAC;;;;;;;oCAC4C,qBAAM,IAAA,uBAAc,EACpE,IAAI,CACL,EAAA;;gCAFK,KAA4C,SAEjD,EAFW,SAAS,QAAA,EAAW,aAAa,aAAA;gCAGd,qBAAM,IAAA,wBAAe,EAClD,IAAI,EACJ,mBAAY,SAAS,cAAW,CACjC,EAAA;;gCAHK,sBAAsB,GAAG,SAG9B;gCAEK,gBAAgB,GAAG,sBAAsB,CAAC,GAAG,CACjD,UAAC,CAAmB;oCAClB,IAAM,KAAK,GAAG,IAAA,8BAAoB,EAAC,CAAC,CAAC,IAAI,CAAC,CAAC;oCAE3C,OAAO;wCACL,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI;wCAC/B,QAAQ,EAAE,CAAC,CAAC,IAAI;qCACjB,CAAC;gCACJ,CAAC,CACF,CAAC;gCAEF,IAAI,gBAAgB,CAAC,MAAM,KAAK,CAAC,EAAE;oCACjC,IAAI,CAAC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I,CACjB,UAAC,CAAmB,IAAK,OAAA,CAAC,CAAC,IAAI,KAAK,qBAAqB,EAAhC,CAAgC,CAC1D,EAFD,yBAEC;gCAED,IAAI,CAAC,GAAG,CACN,0FAA0F,CAC3F,CAAC;gCAEF,qBAAM,IAAA,wBAAe,EAAC,IAAI,EAAE,mBAAY,SAAS,mBAAgB,EAAE;wCACjE,EAAE,EAAE,SAAS;wCACb,IAAI,EAAE,qBAAqB;wCAC3B,MAAM,EAAE,CAAC,eAAe,CAAC;qCAC1B,CAAC,EAAA;;gCAJF,SAIE,CAAC;;;gCAEL,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;gCAChC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gCACf,IAAI,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;gCAC7C;oCACE,kCAAkC;oCAClC,2BAA2B;oCAC3B,qBAAqB;oCACrB,eAAe;iCAChB,CAAC,OAAO,CAAC,UAAC,GAAG,IAAK,OAAA,KAAI,CAAC,GAAG,CAAC,aAAM,GAAG,CAAE,CAAC,EAArB,CAAqB,CAAC,CAAC;gCAC1C,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;gCACf,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;;;;;aAChB,CAAC,EAAA;;KAAA,EAAC"}
|
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
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;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
50
|
-
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
51
|
-
if (ar || !(i in from)) {
|
|
52
|
-
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
53
|
-
ar[i] = from[i];
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
return to.concat(ar || Array.prototype.slice.call(from));
|
|
57
|
-
};
|
|
58
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
59
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
60
|
-
};
|
|
61
|
-
exports.__esModule = true;
|
|
62
|
-
var fs_extra_1 = require("fs-extra");
|
|
63
|
-
var js_yaml_1 = require("js-yaml");
|
|
64
|
-
var lodash_1 = require("lodash");
|
|
65
|
-
var path_1 = __importDefault(require("path"));
|
|
66
|
-
var projects_1 = require("../../../../utils/projects");
|
|
67
|
-
var transformVar = function (key) { return (0, lodash_1.toUpper)((0, lodash_1.snakeCase)(key)); };
|
|
68
|
-
var DEFAULT_VARIABLES = {
|
|
69
|
-
clusterName: "production"
|
|
70
|
-
};
|
|
71
|
-
// TODO: we should find a way how to fetch the variables of the inclues directly from gitlab
|
|
72
|
-
var DEFAULT_NODE_asdfAPPLICATION = {};
|
|
73
|
-
var DEFAULT_FILES_TO_CREATE = [
|
|
74
|
-
{
|
|
75
|
-
filename: ".envrc",
|
|
76
|
-
content: function () { return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_a) {
|
|
77
|
-
return [2 /*return*/, (0, fs_extra_1.readFile)(path_1["default"].resolve(__dirname, "../includes/envrc"), "utf8")];
|
|
78
|
-
}); }); }
|
|
79
|
-
},
|
|
80
|
-
];
|
|
81
|
-
/*
|
|
82
|
-
|
|
83
|
-
TODO: reimplement as PRESETS ?
|
|
84
|
-
const PLATFORMS: { [platformName: string]: PlatformDefinition } = {
|
|
85
|
-
nextJS: {
|
|
86
|
-
variables: {},
|
|
87
|
-
gitlabCiInclude: {
|
|
88
|
-
project: "catladder/gitlab-ci",
|
|
89
|
-
ref: "v1",
|
|
90
|
-
file: "node-kubernetes.yml",
|
|
91
|
-
},
|
|
92
|
-
values: {
|
|
93
|
-
application: DEFAULT_NODE_APPLICATION,
|
|
94
|
-
},
|
|
95
|
-
filesToCreate: [
|
|
96
|
-
{
|
|
97
|
-
content: "v14",
|
|
98
|
-
filename: ".nvmrc",
|
|
99
|
-
},
|
|
100
|
-
],
|
|
101
|
-
},
|
|
102
|
-
nestJS: {
|
|
103
|
-
variables: {},
|
|
104
|
-
gitlabCiInclude: {
|
|
105
|
-
project: "catladder/gitlab-ci",
|
|
106
|
-
ref: "v1",
|
|
107
|
-
file: "node-kubernetes.yml",
|
|
108
|
-
},
|
|
109
|
-
values: {
|
|
110
|
-
application: {
|
|
111
|
-
command: "yarn start:prod --port $(PORT)",
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
filesToCreate: [
|
|
115
|
-
{
|
|
116
|
-
content: "v14",
|
|
117
|
-
filename: ".nvmrc",
|
|
118
|
-
},
|
|
119
|
-
],
|
|
120
|
-
},
|
|
121
|
-
node: {
|
|
122
|
-
variables: {},
|
|
123
|
-
gitlabCiInclude: {
|
|
124
|
-
project: "catladder/gitlab-ci",
|
|
125
|
-
ref: "v1",
|
|
126
|
-
file: "node-kubernetes.yml",
|
|
127
|
-
},
|
|
128
|
-
values: {
|
|
129
|
-
application: DEFAULT_NODE_APPLICATION,
|
|
130
|
-
},
|
|
131
|
-
filesToCreate: [
|
|
132
|
-
{
|
|
133
|
-
content: "v14",
|
|
134
|
-
filename: ".nvmrc",
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
},
|
|
138
|
-
staticJs: {
|
|
139
|
-
variables: {},
|
|
140
|
-
gitlabCiInclude: {
|
|
141
|
-
project: "catladder/gitlab-ci",
|
|
142
|
-
ref: "v1",
|
|
143
|
-
file: "static-js-kubernetes.yml",
|
|
144
|
-
},
|
|
145
|
-
values: {},
|
|
146
|
-
},
|
|
147
|
-
meteor: {
|
|
148
|
-
variables: {},
|
|
149
|
-
gitlabCiInclude: {
|
|
150
|
-
project: "gitlab-ci/meteor-kubernetes",
|
|
151
|
-
ref: "v1",
|
|
152
|
-
file: "meteor-kubernetes.yml",
|
|
153
|
-
},
|
|
154
|
-
values: {},
|
|
155
|
-
},
|
|
156
|
-
rails: {
|
|
157
|
-
variables: {},
|
|
158
|
-
gitlabCiInclude: {
|
|
159
|
-
project: "catladder/gitlab-ci",
|
|
160
|
-
ref: "v1",
|
|
161
|
-
file: "rails-kubernetes.yml",
|
|
162
|
-
},
|
|
163
|
-
values: {
|
|
164
|
-
env: {
|
|
165
|
-
public: {
|
|
166
|
-
RAILS_ENV: "production",
|
|
167
|
-
PORT: 8080,
|
|
168
|
-
},
|
|
169
|
-
secret: {
|
|
170
|
-
POSTGRESQL_PASSWORD: "app-secrets",
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
application: {
|
|
174
|
-
command: ["/cnb/process/web"],
|
|
175
|
-
livenessProbe: {
|
|
176
|
-
httpGet: {
|
|
177
|
-
path: "/robots.txt",
|
|
178
|
-
httpHeaders: null,
|
|
179
|
-
},
|
|
180
|
-
},
|
|
181
|
-
readinessProbe: {
|
|
182
|
-
httpGet: {
|
|
183
|
-
path: "/robots.txt",
|
|
184
|
-
httpHeaders: null,
|
|
185
|
-
},
|
|
186
|
-
},
|
|
187
|
-
},
|
|
188
|
-
cloudsql: { enabled: true },
|
|
189
|
-
jobs: {
|
|
190
|
-
"db-prepare": {
|
|
191
|
-
hook: "post-install,post-upgrade",
|
|
192
|
-
command: "/cnb/lifecycle/launcher bundle exec rake db:prepare",
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
},
|
|
196
|
-
filesToCreate: [
|
|
197
|
-
{
|
|
198
|
-
filename: "values-review.yml",
|
|
199
|
-
content: async () =>
|
|
200
|
-
dump({
|
|
201
|
-
jobs: {
|
|
202
|
-
"db-prepare-seed": {
|
|
203
|
-
hook: "post-install",
|
|
204
|
-
command:
|
|
205
|
-
"/cnb/lifecycle/launcher bundle exec rake db:prepare db:seed",
|
|
206
|
-
},
|
|
207
|
-
"db-prepare": {
|
|
208
|
-
hook: "post-upgrade",
|
|
209
|
-
command: "/cnb/lifecycle/launcher bundle exec rake db:prepare",
|
|
210
|
-
},
|
|
211
|
-
},
|
|
212
|
-
}),
|
|
213
|
-
},
|
|
214
|
-
],
|
|
215
|
-
},
|
|
216
|
-
other: {
|
|
217
|
-
variables: {},
|
|
218
|
-
gitlabCiInclude: {
|
|
219
|
-
project: "catladder/gitlab-ci",
|
|
220
|
-
ref: "v1",
|
|
221
|
-
file: "panter-kubernetes-base.yml",
|
|
222
|
-
},
|
|
223
|
-
values: {},
|
|
224
|
-
},
|
|
225
|
-
};
|
|
226
|
-
|
|
227
|
-
*/
|
|
228
|
-
var PLATFORMS = {};
|
|
229
|
-
exports["default"] = (function (vorpal) { return __awaiter(void 0, void 0, void 0, function () {
|
|
230
|
-
return __generator(this, function (_a) {
|
|
231
|
-
return [2 /*return*/, vorpal
|
|
232
|
-
.command("project-init", "Inits a new project")
|
|
233
|
-
.action(function () {
|
|
234
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
235
|
-
var hasGitlabFile, questions, _a, customerName, appName, componentName, platform, _b, gitlabCiInclude, platformVariables, values, filesToCreate, allVariables, allFilesToCreate, transformedVariables, gitlabCiContentObj, gitlabCiContent, shouldContinue;
|
|
236
|
-
var _this = this;
|
|
237
|
-
return __generator(this, function (_c) {
|
|
238
|
-
switch (_c.label) {
|
|
239
|
-
case 0: throw new Error("needs reimplementation");
|
|
240
|
-
case 1:
|
|
241
|
-
hasGitlabFile = _c.sent();
|
|
242
|
-
if (!hasGitlabFile) return [3 /*break*/, 2];
|
|
243
|
-
this.log("there is already a gitlab-ci.yml file. Skipping");
|
|
244
|
-
return [3 /*break*/, 6];
|
|
245
|
-
case 2:
|
|
246
|
-
this.log("Alright. Let's do this! 😼");
|
|
247
|
-
this.log("");
|
|
248
|
-
questions = [
|
|
249
|
-
{
|
|
250
|
-
type: "input",
|
|
251
|
-
name: "customerName",
|
|
252
|
-
"default": "pan",
|
|
253
|
-
message: "Which customer?"
|
|
254
|
-
},
|
|
255
|
-
{
|
|
256
|
-
type: "input",
|
|
257
|
-
name: "appName",
|
|
258
|
-
message: "What is the app's name?"
|
|
259
|
-
},
|
|
260
|
-
{
|
|
261
|
-
type: "input",
|
|
262
|
-
name: "componentName",
|
|
263
|
-
"default": "web",
|
|
264
|
-
message: "And the componentName?\n(in multi-app projects, you have to chose a different componentName for each app, e.g. frontend and backend)\n\n"
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
type: "list",
|
|
268
|
-
name: "platform",
|
|
269
|
-
choices: Object.keys(PLATFORMS),
|
|
270
|
-
message: "What is your app platform?"
|
|
271
|
-
},
|
|
272
|
-
].map(function (q) { return (__assign(__assign({}, q), { validate: Boolean, message: "".concat(q.message, " ") })); });
|
|
273
|
-
return [4 /*yield*/, this.prompt(questions)];
|
|
274
|
-
case 3:
|
|
275
|
-
_a = _c.sent(), customerName = _a.customerName, appName = _a.appName, componentName = _a.componentName, platform = _a.platform;
|
|
276
|
-
_b = PLATFORMS[platform], gitlabCiInclude = _b.gitlabCiInclude, platformVariables = _b.variables, values = _b.values, filesToCreate = _b.filesToCreate;
|
|
277
|
-
allVariables = __assign(__assign({ customerName: customerName, appName: appName, componentName: componentName }, DEFAULT_VARIABLES), platformVariables);
|
|
278
|
-
allFilesToCreate = __spreadArray(__spreadArray([], DEFAULT_FILES_TO_CREATE, true), (filesToCreate !== null && filesToCreate !== void 0 ? filesToCreate : []), true);
|
|
279
|
-
transformedVariables = (0, lodash_1.mapKeys)(allVariables, function (value, key) {
|
|
280
|
-
return transformVar(key);
|
|
281
|
-
});
|
|
282
|
-
gitlabCiContentObj = {
|
|
283
|
-
include: [gitlabCiInclude],
|
|
284
|
-
variables: transformedVariables
|
|
285
|
-
};
|
|
286
|
-
gitlabCiContent = (0, js_yaml_1.dump)(gitlabCiContentObj);
|
|
287
|
-
return [4 /*yield*/, (0, fs_extra_1.writeFile)(".gitlab-ci.yml", gitlabCiContent)];
|
|
288
|
-
case 4:
|
|
289
|
-
_c.sent();
|
|
290
|
-
allFilesToCreate.forEach(function (_a) {
|
|
291
|
-
var filename = _a.filename, content = _a.content;
|
|
292
|
-
return __awaiter(_this, void 0, void 0, function () {
|
|
293
|
-
var theContent, _b;
|
|
294
|
-
return __generator(this, function (_c) {
|
|
295
|
-
switch (_c.label) {
|
|
296
|
-
case 0:
|
|
297
|
-
if (!(typeof content === "function")) return [3 /*break*/, 2];
|
|
298
|
-
return [4 /*yield*/, content()];
|
|
299
|
-
case 1:
|
|
300
|
-
_b = _c.sent();
|
|
301
|
-
return [3 /*break*/, 3];
|
|
302
|
-
case 2:
|
|
303
|
-
_b = content;
|
|
304
|
-
_c.label = 3;
|
|
305
|
-
case 3:
|
|
306
|
-
theContent = _b;
|
|
307
|
-
return [4 /*yield*/, (0, fs_extra_1.writeFile)(filename, theContent)];
|
|
308
|
-
case 4:
|
|
309
|
-
_c.sent();
|
|
310
|
-
return [2 /*return*/];
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
});
|
|
314
|
-
});
|
|
315
|
-
return [4 /*yield*/, (0, fs_extra_1.writeFile)("values.yml", (0, js_yaml_1.dump)(values))];
|
|
316
|
-
case 5:
|
|
317
|
-
_c.sent();
|
|
318
|
-
this.log("");
|
|
319
|
-
this.log("gitlab-ci created! 💪😻");
|
|
320
|
-
this.log("feel free to adjust it to your needs!");
|
|
321
|
-
this.log("");
|
|
322
|
-
this.log("we also create an .envrc for you which works with direnv");
|
|
323
|
-
this.log("");
|
|
324
|
-
_c.label = 6;
|
|
325
|
-
case 6: return [4 /*yield*/, this.prompt({
|
|
326
|
-
"default": true,
|
|
327
|
-
message: "should we continue with setting up your gitlab? 🤔 (connecting cluster and stuff)",
|
|
328
|
-
name: "shouldContinue",
|
|
329
|
-
type: "confirm"
|
|
330
|
-
})];
|
|
331
|
-
case 7:
|
|
332
|
-
shouldContinue = (_c.sent()).shouldContinue;
|
|
333
|
-
if (!shouldContinue) return [3 /*break*/, 9];
|
|
334
|
-
return [4 /*yield*/, vorpal.execSync("project-init-gitlab")];
|
|
335
|
-
case 8:
|
|
336
|
-
_c.sent();
|
|
337
|
-
_c.label = 9;
|
|
338
|
-
case 9: return [2 /*return*/];
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
});
|
|
342
|
-
})];
|
|
343
|
-
});
|
|
344
|
-
}); });
|
|
345
|
-
//# sourceMappingURL=commandInitProject.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"commandInitProject.js","sourceRoot":"","sources":["../../../../../src/apps/cli/commands/project/commandInitProject.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAA+C;AAC/C,mCAA+B;AAC/B,iCAAqD;AACrD,8CAAwB;AAExB,uDAA6D;AAE7D,IAAM,YAAY,GAAG,UAAC,GAAW,IAAK,OAAA,IAAA,gBAAO,EAAC,IAAA,kBAAS,EAAC,GAAG,CAAC,CAAC,EAAvB,CAAuB,CAAC;AAoB9D,IAAM,iBAAiB,GAAG;IACxB,WAAW,EAAE,YAAY;CAC1B,CAAC;AACF,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