@catladder/cli 1.1.0 → 1.3.0

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.
Files changed (71) hide show
  1. package/dist/apps/cli/commands/general/index.js +0 -66
  2. package/dist/apps/cli/commands/general/index.js.map +1 -1
  3. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js +15 -14
  4. package/dist/apps/cli/commands/project/commandCloudSqlProxy.js.map +1 -1
  5. package/dist/apps/cli/commands/project/commandCopyDB.js +3 -3
  6. package/dist/apps/cli/commands/project/commandCopyDB.js.map +1 -1
  7. package/dist/apps/cli/commands/project/commandInitGitlab.js +63 -172
  8. package/dist/apps/cli/commands/project/commandInitGitlab.js.map +1 -1
  9. package/dist/apps/cli/commands/project/commandOpenDashboard.js +7 -14
  10. package/dist/apps/cli/commands/project/commandOpenDashboard.js.map +1 -1
  11. package/dist/apps/cli/commands/project/commandOpenGit.js +7 -2
  12. package/dist/apps/cli/commands/project/commandOpenGit.js.map +1 -1
  13. package/dist/apps/cli/commands/project/commandOpenLogs.js +21 -21
  14. package/dist/apps/cli/commands/project/commandOpenLogs.js.map +1 -1
  15. package/dist/apps/cli/commands/project/utils/ensureCluster.js +1 -1
  16. package/dist/apps/cli/commands/project/utils/ensureCluster.js.map +1 -1
  17. package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +2 -1
  18. package/dist/apps/cli/commands/project/utils/ensureNamespace.js +50 -36
  19. package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
  20. package/dist/apps/cli/commands/shared/index.d.ts +3 -2
  21. package/dist/apps/cli/commands/shared/index.js +7 -9
  22. package/dist/apps/cli/commands/shared/index.js.map +1 -1
  23. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js +0 -30
  24. package/dist/apps/cli/commands/theStuffThatReallyMatters/index.js.map +1 -1
  25. package/dist/apps/cli/verify/migration/fromv2.js +9 -3
  26. package/dist/apps/cli/verify/migration/fromv2.js.map +1 -1
  27. package/dist/catenv.js +2 -0
  28. package/dist/catenv.js.map +1 -1
  29. package/dist/cli.js +2 -0
  30. package/dist/cli.js.map +1 -1
  31. package/dist/config/constants.d.ts +0 -1
  32. package/dist/config/constants.js +1 -2
  33. package/dist/config/constants.js.map +1 -1
  34. package/dist/config/getProjectConfig.js +3 -1
  35. package/dist/config/getProjectConfig.js.map +1 -1
  36. package/dist/k8sApi/index.d.ts +1 -0
  37. package/dist/k8sApi/index.js +6 -2
  38. package/dist/k8sApi/index.js.map +1 -1
  39. package/dist/tsconfig.tsbuildinfo +1 -1
  40. package/dist/utils/cluster.d.ts +2 -11
  41. package/dist/utils/cluster.js +13 -38
  42. package/dist/utils/cluster.js.map +1 -1
  43. package/dist/utils/gitlab.js +6 -2
  44. package/dist/utils/gitlab.js.map +1 -1
  45. package/dist/utils/projects/index.js +10 -6
  46. package/dist/utils/projects/index.js.map +1 -1
  47. package/package.json +5 -4
  48. package/src/apps/cli/commands/general/index.ts +1 -39
  49. package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +4 -5
  50. package/src/apps/cli/commands/project/commandCopyDB.ts +4 -5
  51. package/src/apps/cli/commands/project/commandInitGitlab.ts +119 -74
  52. package/src/apps/cli/commands/project/commandOpenDashboard.ts +10 -7
  53. package/src/apps/cli/commands/project/commandOpenGit.ts +2 -2
  54. package/src/apps/cli/commands/project/commandOpenLogs.ts +33 -4
  55. package/src/apps/cli/commands/project/utils/ensureCluster.ts +7 -2
  56. package/src/apps/cli/commands/project/utils/ensureNamespace.ts +43 -19
  57. package/src/apps/cli/commands/shared/index.ts +19 -16
  58. package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +0 -19
  59. package/src/apps/cli/verify/migration/fromv2.ts +7 -2
  60. package/src/catenv.ts +2 -1
  61. package/src/cli.ts +2 -1
  62. package/src/config/constants.ts +0 -1
  63. package/src/config/getProjectConfig.ts +5 -3
  64. package/src/k8sApi/index.ts +5 -1
  65. package/src/utils/cluster.ts +8 -28
  66. package/src/utils/gitlab.ts +5 -0
  67. package/src/utils/projects/index.ts +2 -3
  68. package/dist/config/clusters.d.ts +0 -14
  69. package/dist/config/clusters.js +0 -72
  70. package/dist/config/clusters.js.map +0 -1
  71. package/src/config/clusters.ts +0 -45
@@ -1,5 +1,5 @@
1
- import { exec } from "child-process-promise";
2
1
  import Vorpal from "vorpal";
2
+ import { $ } from "zx";
3
3
 
4
4
  export default async (vorpal: Vorpal) =>
5
5
  vorpal
@@ -8,5 +8,5 @@ export default async (vorpal: Vorpal) =>
8
8
  "open the repo on gitlab / github in your browser"
9
9
  )
10
10
  .action(async () => {
11
- await exec("npx git-open");
11
+ await $`npx git-open`;
12
12
  });
@@ -1,4 +1,8 @@
1
1
  import Vorpal from "vorpal";
2
+ import {
3
+ getPipelineContextByChoice,
4
+ parseChoice,
5
+ } from "../../../../config/getProjectConfig";
2
6
  import { getCurrentConnectedClusterName } from "../../../../utils/cluster";
3
7
  import { getProjectNamespace } from "../../../../utils/projects";
4
8
  import { getGoogleAuthUserNumber } from "../../utils/getGoogleAuthUserNumber";
@@ -14,10 +18,35 @@ export default async (vorpal: Vorpal) =>
14
18
  )
15
19
  .autocomplete(await envAndComponents())
16
20
  .action(async function ({ envComponent }) {
17
- await ensureCluster.call(this, envComponent);
18
- const clustername = await getCurrentConnectedClusterName();
19
- const namespace = await getProjectNamespace(envComponent);
21
+ const { env, componentName } = parseChoice(envComponent);
22
+ const { componentConfig, environment } = await getPipelineContextByChoice(
23
+ env,
24
+ componentName
25
+ );
26
+
27
+ if (
28
+ !componentConfig.deploy ||
29
+ componentConfig.deploy.type !== "kubernetes"
30
+ ) {
31
+ throw new Error(
32
+ "only kubernetes deployments are supported at the moment"
33
+ );
34
+ }
35
+
36
+ if (
37
+ !componentConfig.deploy.cluster ||
38
+ componentConfig.deploy.cluster.type !== "gcloud"
39
+ ) {
40
+ throw new Error("no gcloud custer configured");
41
+ }
42
+ // currently only supports kubernetes
43
+ const namespace = environment.envVars.KUBE_NAMESPACE;
44
+
20
45
  const authGoogleNumber = await getGoogleAuthUserNumber.call(this, vorpal);
21
46
 
22
- await openGoogleCloudLogs(authGoogleNumber, clustername, namespace);
47
+ await openGoogleCloudLogs(
48
+ componentConfig.deploy.cluster,
49
+ namespace,
50
+ authGoogleNumber
51
+ );
23
52
  });
@@ -1,4 +1,7 @@
1
- import { isOfDeployType } from "@catladder/pipeline";
1
+ import {
2
+ isOfDeployType,
3
+ getFullKubernetesClusterName,
4
+ } from "@catladder/pipeline";
2
5
  import {
3
6
  getPipelineContextByChoice,
4
7
  parseChoice,
@@ -13,7 +16,9 @@ export default async function (envComponent: string) {
13
16
  if (!isOfDeployType(context.componentConfig.deploy, "kubernetes")) {
14
17
  throw new Error("can't ensure cluster for non-kubernetes deployments");
15
18
  }
16
- const cluster = context.componentConfig.deploy.cluster || "production";
19
+ const cluster = getFullKubernetesClusterName(
20
+ context.componentConfig.deploy.cluster
21
+ );
17
22
  const connectedClusterName = await getCurrentConnectedClusterName();
18
23
 
19
24
  if (cluster !== connectedClusterName) {
@@ -1,31 +1,55 @@
1
+ import { Context, getKubernetesNamespace } from "@catladder/pipeline";
1
2
  import { V1Namespace, V1ObjectMeta } from "@kubernetes/client-node";
2
3
  import k8sApi from "../../../../../k8sApi";
3
- import { getProjectNamespace } from "../../../../../utils/projects/index";
4
4
 
5
- export default async function (envComponent: string) {
6
- const namespace = await getProjectNamespace(envComponent);
5
+ export default async function (context: Context) {
6
+ const namespace = getKubernetesNamespace(
7
+ context.fullConfig,
8
+ context.environment.shortName
9
+ );
10
+ const namespaceBody = new V1Namespace();
11
+ const metadata: V1ObjectMeta = {
12
+ name: namespace,
13
+ labels: {
14
+ customerName: context.fullConfig.customerName,
15
+ appName: context.fullConfig.appName,
16
+ environment: context.environment.shortName,
17
+ components: Object.keys(context.fullConfig.components).join("_"), // limited chars available...
18
+ buildTypes: Object.values(context.fullConfig.components)
19
+ .map((config) => config.build.type)
20
+ .join("_"), // limited chars available...
21
+ ...Object.fromEntries(
22
+ Object.entries(context.fullConfig.components).map(
23
+ ([componentName, config]) => [
24
+ "buildType_" + componentName,
25
+ config.build.type,
26
+ ]
27
+ )
28
+ ),
29
+ ...(context.fullConfig.meta?.labels ?? {}),
30
+ },
31
+ };
32
+
33
+ namespaceBody.metadata = metadata;
7
34
  try {
8
35
  await k8sApi.readNamespace(namespace);
36
+
37
+ await k8sApi.patchNamespace(
38
+ namespace,
39
+ namespaceBody,
40
+ undefined,
41
+ undefined,
42
+ undefined,
43
+ undefined,
44
+ { headers: { "content-type": "application/merge-patch+json" } } // see https://github.com/kubernetes-client/javascript/issues/443
45
+ ); // update meta data
9
46
  } catch (e) {
10
- if (e.response.body && e.response.body.reason === "NotFound") {
11
- this.log(`namespace '${namespace} does not exist. `);
12
- const { shouldContinue } = await this.prompt({
13
- type: "confirm",
14
- name: "shouldContinue",
15
- default: true,
16
- message: `Should I create namespace '${namespace}'?`,
17
- });
18
- if (!shouldContinue) {
19
- throw new Error("abort");
20
- }
21
- const namespaceBody = new V1Namespace();
22
- const metadata = {
23
- name: namespace,
24
- };
25
- namespaceBody.metadata = metadata as V1ObjectMeta;
47
+ if (e.response?.body?.reason === "NotFound") {
26
48
  await k8sApi.createNamespace(namespaceBody);
27
49
  } else {
50
+ console.error(e.response?.body);
28
51
  throw e;
29
52
  }
30
53
  }
54
+ return namespace;
31
55
  }
@@ -1,31 +1,34 @@
1
+ import { DeployConfigKubernetesCluster } from "@catladder/pipeline";
1
2
  import open from "open";
2
- import { GOOGLE_PROJECT } from "../../../../config/constants";
3
3
 
4
4
  export const openGoogleCloudLogs = async (
5
- googleAuthUserNumber = 0,
6
- clustername?: string,
7
- namespace?: string
5
+ cluster?: DeployConfigKubernetesCluster,
6
+ namespace?: string,
7
+ googleAuthUserNumber = 0
8
8
  ) => {
9
- const resource = clustername
10
- ? `k8s_container/cluster_name/${clustername}${
11
- namespace ? `/namespace_name/${namespace}` : ""
12
- }`
13
- : null;
9
+ const resource = `k8s_container/cluster_name/${cluster.name}${
10
+ namespace ? `/namespace_name/${namespace}` : ""
11
+ }`;
14
12
 
15
- const url = `https://console.cloud.google.com/logs/viewer?project=${GOOGLE_PROJECT}${
13
+ const url = `https://console.cloud.google.com/logs/viewer?project=${
14
+ cluster.projectId
15
+ }${
16
16
  resource ? `&resource=${encodeURIComponent(resource)}` : ""
17
17
  }&authuser=${googleAuthUserNumber}`;
18
18
  open(url);
19
19
  };
20
20
 
21
21
  export const openGoogleCloudKubernetesDashboard = async (
22
- googleAuthUserNumber = 0,
23
- clustername?: string,
24
- namespace?: string
22
+ cluster: DeployConfigKubernetesCluster,
23
+ namespace: string,
24
+ googleAuthUserNumber = 0
25
25
  ) => {
26
- const url = `https://console.cloud.google.com/kubernetes/workload?authuser=${googleAuthUserNumber}&project=${GOOGLE_PROJECT}&pageState=(%22savedViews%22:(%22c%22:%5B%22gke%2Feurope-west1-d%2F${clustername}%22%5D,${
27
- namespace ? `%22n%22:%5B%22${namespace}%22%5D` : ""
28
- }))`;
26
+ //gke_skynet-164509_europe-west1-d_production
27
+
28
+ const pageState = `pageState=("savedViews":("c":["gke/${cluster.region}/${cluster.name}"],"n":["${namespace}"],"i":"4e42e0b9cd6147f8a4fba7516752ec48"))`;
29
+ const url = `https://console.cloud.google.com/kubernetes/workload?authuser=${googleAuthUserNumber}&project=${
30
+ cluster.projectId
31
+ }&pageState=${encodeURIComponent(pageState)}`;
29
32
 
30
33
  open(url);
31
34
  };
@@ -14,26 +14,7 @@ export default async (vorpal: Vorpal) => {
14
14
  this.log(text);
15
15
  this.log("");
16
16
  });
17
- vorpal.command("pantobot", "the allknowing oracle").action(async function () {
18
- const { message } = await this.prompt({
19
- type: "string",
20
- name: "message",
21
17
 
22
- message: "Your question, unworthy?: ",
23
- });
24
- const result = await fetch(
25
- `https://paas.panter.cloud/api/pantobot/${message}`,
26
- {
27
- headers: {
28
- Accept: "text/plain",
29
- },
30
- }
31
- );
32
- const text = await result.text();
33
- this.log("");
34
- this.log(text);
35
- this.log("");
36
- });
37
18
  let starwarsPromise: any;
38
19
  vorpal
39
20
  .command("starwars", "Long time ago... in a galaxy far far away...")
@@ -87,7 +87,6 @@ export const migrateV2 = async (vorpal: Vorpal) => {
87
87
  APP_NAME,
88
88
  COMPONENT_NAME,
89
89
  APP_DIR = ".",
90
- CLUSTER_NAME,
91
90
  STAGING_ENABLED,
92
91
  } = gitlabCi.variables;
93
92
 
@@ -147,7 +146,13 @@ export const migrateV2 = async (vorpal: Vorpal) => {
147
146
  deploy: {
148
147
  type: "kubernetes",
149
148
  values: transformValues(baseValues),
150
- cluster: CLUSTER_NAME,
149
+ cluster: {
150
+ type: "gcloud",
151
+ name: "ch-production",
152
+ projectId: "skynet-swiss",
153
+ region: "europe-west6-a",
154
+ domainCanonical: "panter.swiss",
155
+ },
151
156
  },
152
157
  env: await LEGACY_ENVS.reduce<Promise<Env>>(
153
158
  async (acc, envName) => {
package/src/catenv.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  import catenv from "./apps/catenv/catenv";
2
-
2
+ import { $ } from "zx";
3
+ $.verbose = false;
3
4
  catenv();
package/src/cli.ts CHANGED
@@ -1,7 +1,8 @@
1
1
  import updateNotifier from "update-notifier";
2
2
  import cli from "./apps/cli/cli";
3
3
  import packageInfos from "./packageInfos";
4
-
4
+ import { $ } from "zx";
5
+ $.verbose = false;
5
6
  updateNotifier({
6
7
  pkg: packageInfos,
7
8
  }).notify();
@@ -1,5 +1,4 @@
1
1
  export const GRAFANA_PROXY_LOCAL_PORT = 9090;
2
2
  export const GRAFANA_PROXY_TARGET_PORT = 9090;
3
3
 
4
- export const GOOGLE_PROJECT = "skynet-164509";
5
4
  export const GOOGLE_CLOUD_SQL_PASS_PATH = "cloud-sql-proxy-credentials";
@@ -72,9 +72,11 @@ export const getAllComponentsWithAllEnvs = async () => {
72
72
 
73
73
  export const getAllPipelineContexts = async () => {
74
74
  return Promise.all(
75
- (await getAllComponentsWithAllEnvs()).map(({ env, componentName }) =>
76
- getPipelineContextByChoice(env, componentName)
77
- )
75
+ (await getAllComponentsWithAllEnvs())
76
+ .filter((c) => c.env !== "local")
77
+ .map(({ env, componentName }) =>
78
+ getPipelineContextByChoice(env, componentName)
79
+ )
78
80
  );
79
81
  };
80
82
 
@@ -7,7 +7,11 @@ import {
7
7
 
8
8
  const kc = new KubeConfig();
9
9
 
10
- kc.loadFromDefault();
10
+ export const reload = () => {
11
+ kc.loadFromDefault();
12
+ };
13
+
14
+ reload();
11
15
 
12
16
  const k8sApi = kc.makeApiClient(CoreV1Api);
13
17
 
@@ -1,34 +1,14 @@
1
- import { exec } from "child-process-promise";
2
- import { findKey } from "lodash";
3
- import clusters from "../config/clusters";
1
+ import { $ } from "zx";
2
+ import { reload } from "../k8sApi";
3
+
4
4
  export const getCurrentContext = async () =>
5
- (await exec("kubectl config current-context")).stdout.trim();
5
+ (await $`kubectl config current-context`).stdout.trim();
6
6
 
7
7
  export const getCurrentConnectedClusterName = async () => {
8
- const currentContext = await getCurrentContext();
9
- return findKey(clusters, { fullName: currentContext });
10
- };
11
-
12
- export const getClusterByFullName = (fullName: string) => {
13
- const found = Object.entries(getAllClusters()).find(
14
- ([, config]) => config.fullName === fullName
15
- );
16
- if (found) {
17
- return { name: found[0], cluster: found[1] };
18
- } else {
19
- return null;
20
- }
8
+ return await getCurrentContext();
21
9
  };
22
10
 
23
- export const getClusterByName = (name: string) => getAllClusters()[name];
24
-
25
- export const getAllClusters = () => {
26
- return clusters;
27
- };
28
-
29
- export const getAllClusterNames = () => Object.keys(clusters);
30
-
31
- export const connectToCluster = async (clusterName: string) => {
32
- const { connect } = getClusterByName(clusterName);
33
- await connect();
11
+ export const connectToCluster = async (fullname: string) => {
12
+ await $`kubectl config use-context ${fullname}`;
13
+ reload();
34
14
  };
@@ -125,6 +125,9 @@ export const getAllVariables = memoizee(
125
125
  { promise: true }
126
126
  );
127
127
 
128
+ const maskableRegex = new RegExp("^[a-zA-Z0-9_+=/@:.~-]{8,}$"); // SEE https://gitlab.com/gitlab-org/gitlab-foss/-/blob/master/spec/frontend/ci_variable_list/components/ci_variable_modal_spec.js#L20
129
+ const isMaskable = (value: string): boolean => maskableRegex.test(value);
130
+
128
131
  const createVariable = async (
129
132
  vorpal: CommandInstance,
130
133
  projectId: string,
@@ -134,6 +137,7 @@ const createVariable = async (
134
137
  return await doGitlabRequest(vorpal, `projects/${projectId}/variables`, {
135
138
  key,
136
139
  value,
140
+ masked: isMaskable(value),
137
141
  });
138
142
  };
139
143
 
@@ -148,6 +152,7 @@ const updateVariable = async (
148
152
  `projects/${projectId}/variables/${key}`,
149
153
  {
150
154
  value,
155
+ masked: isMaskable(value),
151
156
  },
152
157
  true
153
158
  );
@@ -1,12 +1,11 @@
1
- import { exec } from "child-process-promise";
2
-
1
+ import { $ } from "zx";
3
2
  import { join } from "path";
4
3
  import { getProjectConfig, parseChoice } from "../../config/getProjectConfig";
5
4
  import k8sApi from "../../k8sApi";
6
5
  import { readFileOrError } from "../files";
7
6
 
8
7
  export const getGitRoot = async (): Promise<string> => {
9
- return (await exec("git rev-parse --show-toplevel")).stdout?.trim();
8
+ return (await $`git rev-parse --show-toplevel`).stdout.trim();
10
9
  };
11
10
 
12
11
  export const getRootGitlabCiFile = async () => {
@@ -1,14 +0,0 @@
1
- export declare type Cluster = {
2
- fullName: string;
3
- passToken?: string;
4
- passCredentials?: {
5
- ca_cert: string;
6
- token: string;
7
- };
8
- api_url?: string;
9
- connect: () => Promise<any>;
10
- };
11
- declare const clusters: {
12
- [clustername: string]: Cluster;
13
- };
14
- export default clusters;
@@ -1,72 +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
- exports.__esModule = true;
39
- var child_process_promise_1 = require("child-process-promise");
40
- var clusters = {
41
- demo: {
42
- fullName: "gke_skynet-164509_europe-west1-d_demo",
43
- connect: function () { return __awaiter(void 0, void 0, void 0, function () {
44
- return __generator(this, function (_a) {
45
- return [2 /*return*/, (0, child_process_promise_1.exec)("gcloud container clusters get-credentials demo --zone europe-west1-d --project skynet-164509")];
46
- });
47
- }); }
48
- },
49
- production: {
50
- fullName: "gke_skynet-164509_europe-west1-d_production",
51
- passCredentials: {
52
- token: "syknet/clusters/production/token",
53
- ca_cert: "syknet/clusters/production/ca_cert"
54
- },
55
- api_url: "https://35.189.234.235",
56
- connect: function () { return __awaiter(void 0, void 0, void 0, function () {
57
- return __generator(this, function (_a) {
58
- return [2 /*return*/, (0, child_process_promise_1.exec)("gcloud container clusters get-credentials production --zone europe-west1-d --project skynet-164509")];
59
- });
60
- }); }
61
- },
62
- panterGitlab: {
63
- fullName: "gke_skynet-intern_europe-west6-a_swiss-cluster",
64
- connect: function () { return __awaiter(void 0, void 0, void 0, function () {
65
- return __generator(this, function (_a) {
66
- return [2 /*return*/, (0, child_process_promise_1.exec)("gcloud container clusters get-credentials --project skynet-intern swiss-cluster --region europe-west6-a")];
67
- });
68
- }); }
69
- }
70
- };
71
- exports["default"] = clusters;
72
- //# sourceMappingURL=clusters.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clusters.js","sourceRoot":"","sources":["../../src/config/clusters.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+DAA6C;AAa7C,IAAM,QAAQ,GAEV;IACF,IAAI,EAAE;QACJ,QAAQ,EAAE,uCAAuC;QACjD,OAAO,EAAE;;gBACP,sBAAA,IAAA,4BAAI,EACF,8FAA8F,CAC/F,EAAA;;aAAA;KACJ;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,6CAA6C;QACvD,eAAe,EAAE;YACf,KAAK,EAAE,kCAAkC;YACzC,OAAO,EAAE,oCAAoC;SAC9C;QAED,OAAO,EAAE,wBAAwB;QACjC,OAAO,EAAE;;gBACP,sBAAA,IAAA,4BAAI,EACF,oGAAoG,CACrG,EAAA;;aAAA;KACJ;IACD,YAAY,EAAE;QACZ,QAAQ,EAAE,gDAAgD;QAC1D,OAAO,EAAE;;gBACP,sBAAA,IAAA,4BAAI,EACF,yGAAyG,CAC1G,EAAA;;aAAA;KACJ;CACF,CAAC;AACF,qBAAe,QAAQ,CAAC"}
@@ -1,45 +0,0 @@
1
- import { exec } from "child-process-promise";
2
-
3
- export type Cluster = {
4
- fullName: string;
5
- passToken?: string;
6
- passCredentials?: {
7
- ca_cert: string;
8
- token: string;
9
- };
10
- api_url?: string;
11
- connect: () => Promise<any>;
12
- };
13
-
14
- const clusters: {
15
- [clustername: string]: Cluster;
16
- } = {
17
- demo: {
18
- fullName: "gke_skynet-164509_europe-west1-d_demo",
19
- connect: async () =>
20
- exec(
21
- "gcloud container clusters get-credentials demo --zone europe-west1-d --project skynet-164509"
22
- ),
23
- },
24
- production: {
25
- fullName: "gke_skynet-164509_europe-west1-d_production",
26
- passCredentials: {
27
- token: "syknet/clusters/production/token",
28
- ca_cert: "syknet/clusters/production/ca_cert",
29
- },
30
-
31
- api_url: "https://35.189.234.235",
32
- connect: async () =>
33
- exec(
34
- "gcloud container clusters get-credentials production --zone europe-west1-d --project skynet-164509"
35
- ),
36
- },
37
- panterGitlab: {
38
- fullName: "gke_skynet-intern_europe-west6-a_swiss-cluster",
39
- connect: async () =>
40
- exec(
41
- "gcloud container clusters get-credentials --project skynet-intern swiss-cluster --region europe-west6-a"
42
- ),
43
- },
44
- };
45
- export default clusters;