@catladder/cli 1.40.4 → 1.41.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.
- package/bin/catenv +1 -1
- package/bin/catenv-dev +3 -0
- package/bin/catladder +1 -1
- package/bin/catladder-dev +3 -0
- package/dist/apps/cli/commands/general/index.d.ts +1 -1
- package/dist/apps/cli/commands/general/portForward.d.ts +1 -1
- package/dist/apps/cli/commands/mongodb/index.d.ts +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.d.ts +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js +2 -1
- package/dist/apps/cli/commands/mongodb/projectMongoDestroyMember.js.map +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoGetShell.d.ts +1 -1
- package/dist/apps/cli/commands/mongodb/projectMongoPortForward.d.ts +1 -1
- package/dist/apps/cli/commands/mongodb/utils/index.js +2 -1
- package/dist/apps/cli/commands/mongodb/utils/index.js.map +1 -1
- package/dist/apps/cli/commands/project/commandCloudSqlProxy.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandConfigSecrets.d.ts +2 -1
- package/dist/apps/cli/commands/project/commandConfigSecrets.js.map +1 -1
- package/dist/apps/cli/commands/project/commandCopyDB.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandDeletePods.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandDeletePods.js +2 -1
- package/dist/apps/cli/commands/project/commandDeletePods.js.map +1 -1
- package/dist/apps/cli/commands/project/commandDeleteProject.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandEnvVars.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandGetMyTotalWorktime.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandGetShell.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandGetShell.js +2 -1
- package/dist/apps/cli/commands/project/commandGetShell.js.map +1 -1
- package/dist/apps/cli/commands/project/commandGitlabCi.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandGitlabCi.js.map +1 -1
- package/dist/apps/cli/commands/project/commandInitProject.old.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandListPods.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandListPods.js +2 -2
- package/dist/apps/cli/commands/project/commandListPods.js.map +1 -1
- package/dist/apps/cli/commands/project/commandMigrateHelm3.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandNamespace.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenCostDashboard.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenDashboard.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenEnv.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenGit.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenGrafana.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js +2 -1
- package/dist/apps/cli/commands/project/commandOpenGrafanaPod.js.map +1 -1
- package/dist/apps/cli/commands/project/commandOpenLogs.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandPauseProject.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandPortForward.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandPortForward.js +2 -1
- package/dist/apps/cli/commands/project/commandPortForward.js.map +1 -1
- package/dist/apps/cli/commands/project/commandSetup.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandTriggerCronjob.d.ts +1 -1
- package/dist/apps/cli/commands/project/commandTriggerCronjob.js.map +1 -1
- package/dist/apps/cli/commands/project/index.d.ts +1 -1
- package/dist/apps/cli/commands/project/setup/index.d.ts +1 -1
- package/dist/apps/cli/commands/project/setup/setupAccessTokens.d.ts +1 -1
- package/dist/apps/cli/commands/project/setup/setupContext.d.ts +2 -2
- package/dist/apps/cli/commands/project/setup/setupContext.js.map +1 -1
- package/dist/apps/cli/commands/project/setup/setupKubernetes.d.ts +2 -2
- package/dist/apps/cli/commands/project/setup/setupKubernetes.js.map +1 -1
- package/dist/apps/cli/commands/project/utils/ensureNamespace.d.ts +1 -1
- package/dist/apps/cli/commands/project/utils/ensureNamespace.js.map +1 -1
- package/dist/apps/cli/commands/project/utils/showProjectBanner.d.ts +1 -1
- package/dist/apps/cli/commands/shared/index.d.ts +1 -1
- package/dist/apps/cli/commands/theStuffThatReallyMatters/index.d.ts +1 -1
- package/dist/apps/cli/config/writeConfig.d.ts +2 -2
- package/dist/apps/cli/verify/index.d.ts +1 -1
- package/dist/apps/cli/verify/migration/fromv2.d.ts +1 -1
- package/dist/apps/cli/verify/migration/fromv2.js.map +1 -1
- package/dist/apps/cli/verify/migration/migrateSecrets.d.ts +3 -3
- package/dist/apps/cli/verify/migration/migrateSecrets.js.map +1 -1
- package/dist/apps/cli/verify/migration/oldGitlabCi.d.ts +1 -1
- package/dist/bundles/catenv/index.js +15 -0
- package/dist/bundles/catenv/xdg-open +1066 -0
- package/dist/bundles/cli/clipboard_i686.exe +0 -0
- package/dist/bundles/cli/clipboard_x86_64.exe +0 -0
- package/dist/bundles/cli/exec-child.js +39 -0
- package/dist/bundles/cli/index.js +574 -0
- package/dist/bundles/cli/xdg-open +1066 -0
- package/dist/bundles/cli/xsel +0 -0
- package/dist/catenv.js +2 -3
- package/dist/catenv.js.map +1 -1
- package/dist/config/getProjectConfig.d.ts +3 -6
- package/dist/config/getProjectConfig.js +10 -6
- package/dist/config/getProjectConfig.js.map +1 -1
- package/dist/config/parseChoice.d.ts +4 -0
- package/dist/config/parseChoice.js +9 -0
- package/dist/config/parseChoice.js.map +1 -0
- package/dist/kubernetes/index.d.ts +3 -0
- package/dist/kubernetes/index.js +88 -0
- package/dist/kubernetes/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/gitlab.d.ts +1 -1
- package/dist/utils/projects/index.d.ts +0 -3
- package/dist/utils/projects/index.js +1 -47
- package/dist/utils/projects/index.js.map +1 -1
- package/package.json +25 -22
- package/scripts/bundle +4 -0
- package/src/apps/catenv/catenv.ts +1 -1
- package/src/apps/cli/commands/general/index.ts +1 -1
- package/src/apps/cli/commands/general/portForward.ts +1 -1
- package/src/apps/cli/commands/mongodb/index.ts +1 -1
- package/src/apps/cli/commands/mongodb/projectMongoDestroyMember.ts +3 -5
- package/src/apps/cli/commands/mongodb/projectMongoGetShell.ts +1 -1
- package/src/apps/cli/commands/mongodb/projectMongoPortForward.ts +1 -1
- package/src/apps/cli/commands/mongodb/utils/index.ts +2 -4
- package/src/apps/cli/commands/project/commandCloudSqlProxy.ts +1 -1
- package/src/apps/cli/commands/project/commandConfigSecrets.ts +2 -1
- package/src/apps/cli/commands/project/commandCopyDB.ts +1 -1
- package/src/apps/cli/commands/project/commandDeletePods.ts +3 -5
- package/src/apps/cli/commands/project/commandDeleteProject.ts +1 -1
- package/src/apps/cli/commands/project/commandEnvVars.ts +1 -1
- package/src/apps/cli/commands/project/commandGetMyTotalWorktime.ts +1 -1
- package/src/apps/cli/commands/project/commandGetShell.ts +3 -5
- package/src/apps/cli/commands/project/commandGitlabCi.ts +2 -1
- package/src/apps/cli/commands/project/commandInitProject.old.ts +1 -1
- package/src/apps/cli/commands/project/commandListPods.ts +2 -2
- package/src/apps/cli/commands/project/commandMigrateHelm3.ts +1 -1
- package/src/apps/cli/commands/project/commandNamespace.ts +1 -1
- package/src/apps/cli/commands/project/commandOpenCostDashboard.ts +1 -1
- package/src/apps/cli/commands/project/commandOpenDashboard.ts +1 -1
- package/src/apps/cli/commands/project/commandOpenEnv.ts +1 -1
- package/src/apps/cli/commands/project/commandOpenGit.ts +1 -1
- package/src/apps/cli/commands/project/commandOpenGrafana.ts +1 -1
- package/src/apps/cli/commands/project/commandOpenGrafanaPod.ts +3 -5
- package/src/apps/cli/commands/project/commandOpenLogs.ts +1 -1
- package/src/apps/cli/commands/project/commandPauseProject.ts +1 -1
- package/src/apps/cli/commands/project/commandPortForward.ts +3 -5
- package/src/apps/cli/commands/project/commandSetup.ts +1 -1
- package/src/apps/cli/commands/project/commandTriggerCronjob.ts +3 -2
- package/src/apps/cli/commands/project/index.ts +1 -1
- package/src/apps/cli/commands/project/setup/index.ts +1 -1
- package/src/apps/cli/commands/project/setup/setupAccessTokens.ts +1 -1
- package/src/apps/cli/commands/project/setup/setupContext.ts +3 -2
- package/src/apps/cli/commands/project/setup/setupKubernetes.ts +3 -2
- package/src/apps/cli/commands/project/utils/ensureNamespace.ts +4 -2
- package/src/apps/cli/commands/project/utils/showProjectBanner.ts +1 -1
- package/src/apps/cli/commands/shared/index.ts +1 -1
- package/src/apps/cli/commands/theStuffThatReallyMatters/index.ts +1 -1
- package/src/apps/cli/config/writeConfig.ts +2 -2
- package/src/apps/cli/verify/index.ts +1 -1
- package/src/apps/cli/verify/migration/fromv2.ts +4 -7
- package/src/apps/cli/verify/migration/migrateSecrets.ts +4 -3
- package/src/apps/cli/verify/migration/oldGitlabCi.ts +1 -1
- package/src/catenv.ts +1 -3
- package/src/config/getProjectConfig.ts +6 -8
- package/src/config/parseChoice.ts +4 -0
- package/src/kubernetes/index.ts +27 -0
- package/src/utils/gitlab.ts +1 -1
- package/src/utils/projects/index.ts +1 -25
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Config
|
|
1
|
+
import type { Config } from "@catladder/pipeline";
|
|
2
|
+
import { getEnvironment } from "@catladder/pipeline";
|
|
2
3
|
import { load } from "js-yaml";
|
|
3
4
|
import { pick } from "lodash";
|
|
4
|
-
import { CommandInstance } from "vorpal";
|
|
5
|
+
import type { CommandInstance } from "vorpal";
|
|
5
6
|
import { upsertAllVariables } from "../../../../utils/gitlab";
|
|
6
7
|
import { readPass, trashItem } from "../../../../utils/passwordstore";
|
|
7
|
-
import { LEGACY_ENVS } from "./fromv2";
|
|
8
|
+
import type { LEGACY_ENVS } from "./fromv2";
|
|
8
9
|
|
|
9
10
|
const getPassPath = (newConfig: Config, env: string) => {
|
|
10
11
|
return `${newConfig.customerName}/${newConfig.appName}/${env}/secrets.yml`;
|
package/src/catenv.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import catenv from "./apps/catenv/catenv";
|
|
2
2
|
|
|
3
|
-
import { parseChoice } from "./config/
|
|
3
|
+
import { parseChoice } from "./config/parseChoice";
|
|
4
4
|
|
|
5
5
|
const choice = process.argv[2] ? parseChoice(process.argv[2]) : null;
|
|
6
6
|
|
|
7
|
-
console.log(process.argv, choice);
|
|
8
|
-
|
|
9
7
|
catenv(choice).then(() => {
|
|
10
8
|
// we have to exit manually, because we have some file watches
|
|
11
9
|
process.exit();
|
|
@@ -1,19 +1,22 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
Config} from "@catladder/pipeline";
|
|
1
3
|
import {
|
|
2
4
|
readConfigSync,
|
|
3
5
|
getAllEnvs,
|
|
4
6
|
getEnvironment as _getEnvironment,
|
|
5
7
|
createContext,
|
|
6
|
-
getSecretVarName
|
|
7
|
-
Config,
|
|
8
|
+
getSecretVarName
|
|
8
9
|
} from "@catladder/pipeline";
|
|
9
10
|
|
|
10
|
-
import { CommandInstance } from "vorpal";
|
|
11
|
+
import type { CommandInstance } from "vorpal";
|
|
11
12
|
import { getAllVariables, getVariableValueByRawName } from "../utils/gitlab";
|
|
12
13
|
|
|
13
14
|
import { getGitRoot } from "../utils/projects";
|
|
14
15
|
import { readYaml } from "../utils/files";
|
|
15
16
|
import { watch } from "fs";
|
|
16
17
|
|
|
18
|
+
export { parseChoice } from "./parseChoice";
|
|
19
|
+
|
|
17
20
|
let currentConfig: Config = null;
|
|
18
21
|
|
|
19
22
|
// reload the config on change
|
|
@@ -59,11 +62,6 @@ export const getProjectComponents = async () => {
|
|
|
59
62
|
return Object.keys(config.components);
|
|
60
63
|
};
|
|
61
64
|
|
|
62
|
-
export const parseChoice = (envComponent: string) => {
|
|
63
|
-
const [env, componentName] = envComponent.split(":").map((x) => x || null);
|
|
64
|
-
return { env, componentName };
|
|
65
|
-
};
|
|
66
|
-
|
|
67
65
|
export const getPipelineContextByChoice = async (
|
|
68
66
|
env: string,
|
|
69
67
|
componentName: string
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { parseChoice } from "../config/parseChoice";
|
|
2
|
+
import { getk8sApi } from "../k8sApi";
|
|
3
|
+
import { getProjectNamespace } from "../utils/projects";
|
|
4
|
+
|
|
5
|
+
export const getProjectPods = async (envComponent: string) => {
|
|
6
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
7
|
+
const k8sApi = getk8sApi();
|
|
8
|
+
const res = await k8sApi.listNamespacedPod(namespace);
|
|
9
|
+
|
|
10
|
+
const { componentName } = parseChoice(envComponent);
|
|
11
|
+
return res.body.items.filter((item) =>
|
|
12
|
+
componentName ? item.metadata?.name?.includes(componentName + "-") : true
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export const getProjectPvcs = async (envComponent: string) => {
|
|
17
|
+
const namespace = await getProjectNamespace(envComponent);
|
|
18
|
+
const k8sApi = getk8sApi();
|
|
19
|
+
const res = await k8sApi.listNamespacedPersistentVolumeClaim(namespace);
|
|
20
|
+
|
|
21
|
+
return res.body.items;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export const getProjectPodNames = async (envComponent: string) => {
|
|
25
|
+
const pods = await getProjectPods(envComponent);
|
|
26
|
+
return pods.map((n) => n.metadata.name);
|
|
27
|
+
};
|
package/src/utils/gitlab.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { has, isObject, times } from "lodash";
|
|
|
4
4
|
import memoizee from "memoizee";
|
|
5
5
|
import fetch from "node-fetch";
|
|
6
6
|
import open from "open";
|
|
7
|
-
import { CommandInstance } from "vorpal";
|
|
7
|
+
import type { CommandInstance } from "vorpal";
|
|
8
8
|
import { getPreference, hasPreference, setPreference } from "./preferences";
|
|
9
9
|
|
|
10
10
|
const TOKEN_KEY = "gitlab-personal-access-token";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { join } from "path";
|
|
2
2
|
import { getProjectConfig, parseChoice } from "../../config/getProjectConfig";
|
|
3
|
-
|
|
3
|
+
|
|
4
4
|
import { readFileOrError } from "../files";
|
|
5
5
|
import { exec } from "child-process-promise";
|
|
6
6
|
|
|
@@ -29,27 +29,3 @@ export const getProjectNamespace = async (envComponent: string) => {
|
|
|
29
29
|
const config = await getProjectConfig();
|
|
30
30
|
return `${config.customerName}-${config.appName}-${env}`;
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
export const getProjectPods = async (envComponent: string) => {
|
|
34
|
-
const namespace = await getProjectNamespace(envComponent);
|
|
35
|
-
const k8sApi = getk8sApi();
|
|
36
|
-
const res = await k8sApi.listNamespacedPod(namespace);
|
|
37
|
-
|
|
38
|
-
const { componentName } = parseChoice(envComponent);
|
|
39
|
-
return res.body.items.filter((item) =>
|
|
40
|
-
componentName ? item.metadata?.name?.includes(componentName + "-") : true
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export const getProjectPvcs = async (envComponent: string) => {
|
|
45
|
-
const namespace = await getProjectNamespace(envComponent);
|
|
46
|
-
const k8sApi = getk8sApi();
|
|
47
|
-
const res = await k8sApi.listNamespacedPersistentVolumeClaim(namespace);
|
|
48
|
-
|
|
49
|
-
return res.body.items;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
export const getProjectPodNames = async (envComponent: string) => {
|
|
53
|
-
const pods = await getProjectPods(envComponent);
|
|
54
|
-
return pods.map((n) => n.metadata.name);
|
|
55
|
-
};
|