@vaharoni/devops 1.1.12 → 1.2.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/dist/cli/core/affected.d.ts +9 -0
- package/dist/cli/core/affected.d.ts.map +1 -0
- package/dist/cli/{affected.js → core/affected.js} +4 -6
- package/dist/cli/core/cloudrun.d.ts +9 -0
- package/dist/cli/core/cloudrun.d.ts.map +1 -0
- package/dist/cli/{cloudrun.js → core/cloudrun.js} +3 -5
- package/dist/cli/core/console.d.ts +9 -0
- package/dist/cli/core/console.d.ts.map +1 -0
- package/dist/cli/{console.js → core/console.js} +5 -7
- package/dist/cli/core/constant.d.ts +9 -0
- package/dist/cli/core/constant.d.ts.map +1 -0
- package/dist/cli/{constant.js → core/constant.js} +3 -5
- package/dist/cli/core/env.d.ts +9 -0
- package/dist/cli/core/env.d.ts.map +1 -0
- package/dist/cli/{env.js → core/env.js} +4 -6
- package/dist/cli/core/exec.d.ts +9 -0
- package/dist/cli/core/exec.d.ts.map +1 -0
- package/dist/cli/{exec.js → core/exec.js} +5 -7
- package/dist/cli/core/image.d.ts +9 -0
- package/dist/cli/core/image.d.ts.map +1 -0
- package/dist/cli/{image.js → core/image.js} +6 -8
- package/dist/cli/core/index.d.ts +16 -0
- package/dist/cli/core/index.d.ts.map +1 -0
- package/dist/cli/core/index.js +15 -0
- package/dist/cli/core/init.d.ts +9 -0
- package/dist/cli/core/init.d.ts.map +1 -0
- package/dist/cli/{init.js → core/init.js} +3 -5
- package/dist/cli/core/job.d.ts +9 -0
- package/dist/cli/core/job.d.ts.map +1 -0
- package/dist/cli/{job.js → core/job.js} +7 -9
- package/dist/cli/core/namespace.d.ts +9 -0
- package/dist/cli/core/namespace.d.ts.map +1 -0
- package/dist/cli/{namespace.js → core/namespace.js} +4 -7
- package/dist/cli/core/prep-build.d.ts +10 -0
- package/dist/cli/core/prep-build.d.ts.map +1 -0
- package/dist/cli/{prep-build.js → core/prep-build.js} +6 -8
- package/dist/cli/core/registry.d.ts +9 -0
- package/dist/cli/core/registry.d.ts.map +1 -0
- package/dist/cli/{registry.js → core/registry.js} +5 -7
- package/dist/cli/core/run-many.d.ts +10 -0
- package/dist/cli/core/run-many.d.ts.map +1 -0
- package/dist/cli/{run-many.js → core/run-many.js} +3 -5
- package/dist/cli/core/run.d.ts +9 -0
- package/dist/cli/core/run.d.ts.map +1 -0
- package/dist/cli/{run.js → core/run.js} +6 -8
- package/dist/cli/core/test.d.ts +9 -0
- package/dist/cli/core/test.d.ts.map +1 -0
- package/dist/cli/{test.js → core/test.js} +2 -4
- package/dist/cli/exec.sh +21 -0
- package/dist/cli/extensions/dml.d.ts +9 -0
- package/dist/cli/extensions/dml.d.ts.map +1 -0
- package/dist/cli/{dml.js → extensions/dml.js} +2 -4
- package/dist/cli/extensions/index.d.ts +9 -0
- package/dist/cli/extensions/index.d.ts.map +1 -0
- package/dist/cli/extensions/index.js +8 -0
- package/dist/cli/extensions/internal-curl.d.ts +10 -0
- package/dist/cli/extensions/internal-curl.d.ts.map +1 -0
- package/dist/cli/{internal-curl.js → extensions/internal-curl.js} +3 -5
- package/dist/cli/extensions/jwt.d.ts +9 -0
- package/dist/cli/extensions/jwt.d.ts.map +1 -0
- package/dist/cli/{jwt.js → extensions/jwt.js} +3 -5
- package/dist/cli/extensions/prisma.d.ts +9 -0
- package/dist/cli/extensions/prisma.d.ts.map +1 -0
- package/dist/cli/{prisma.js → extensions/prisma.js} +4 -6
- package/dist/cli/extensions/redis-bitnami.d.ts +11 -0
- package/dist/cli/extensions/redis-bitnami.d.ts.map +1 -0
- package/dist/cli/{redis.js → extensions/redis-bitnami.js} +4 -6
- package/dist/cli/extensions/redis-ha.d.ts +11 -0
- package/dist/cli/extensions/redis-ha.d.ts.map +1 -0
- package/dist/cli/extensions/redis-ha.js +51 -0
- package/dist/cli/extensions/stackgres.d.ts +10 -0
- package/dist/cli/extensions/stackgres.d.ts.map +1 -0
- package/dist/cli/{db.js → extensions/stackgres.js} +3 -5
- package/dist/cli/extensions/template.d.ts +9 -0
- package/dist/cli/extensions/template.d.ts.map +1 -0
- package/dist/cli/{template.js → extensions/template.js} +7 -9
- package/dist/devops.js +84 -62
- package/dist/libs/{k8s-redis.d.ts → k8s-redis-bitnami.d.ts} +1 -1
- package/dist/libs/k8s-redis-bitnami.d.ts.map +1 -0
- package/dist/libs/k8s-redis-ha.d.ts +3 -0
- package/dist/libs/k8s-redis-ha.d.ts.map +1 -0
- package/dist/libs/k8s-redis-ha.js +15 -0
- package/dist/plugins.d.ts +4 -0
- package/dist/plugins.d.ts.map +1 -0
- package/dist/plugins.js +7 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/package.json +12 -2
- package/src/cli/{affected.ts → core/affected.ts} +4 -6
- package/src/cli/{cloudrun.ts → core/cloudrun.ts} +3 -5
- package/src/cli/{console.ts → core/console.ts} +5 -7
- package/src/cli/{constant.ts → core/constant.ts} +3 -5
- package/src/cli/{env.ts → core/env.ts} +4 -6
- package/src/cli/{exec.ts → core/exec.ts} +5 -7
- package/src/cli/{image.ts → core/image.ts} +6 -8
- package/src/cli/core/index.ts +15 -0
- package/src/cli/{init.ts → core/init.ts} +4 -6
- package/src/cli/{job.ts → core/job.ts} +7 -9
- package/src/cli/{namespace.ts → core/namespace.ts} +4 -8
- package/src/cli/{prep-build.ts → core/prep-build.ts} +6 -8
- package/src/cli/{registry.ts → core/registry.ts} +5 -7
- package/src/cli/{run-many.ts → core/run-many.ts} +3 -5
- package/src/cli/{run.ts → core/run.ts} +6 -8
- package/src/cli/{test.ts → core/test.ts} +2 -4
- package/src/cli/{dml.ts → extensions/dml.ts} +2 -4
- package/src/cli/extensions/index.ts +8 -0
- package/src/cli/{internal-curl.ts → extensions/internal-curl.ts} +3 -5
- package/src/cli/{jwt.ts → extensions/jwt.ts} +3 -5
- package/src/cli/{prisma.ts → extensions/prisma.ts} +4 -6
- package/src/cli/{redis.ts → extensions/redis-bitnami.ts} +4 -6
- package/src/cli/extensions/redis-ha.ts +57 -0
- package/src/cli/{db.ts → extensions/stackgres.ts} +3 -5
- package/src/cli/{template.ts → extensions/template.ts} +7 -9
- package/src/devops.ts +100 -64
- package/src/libs/k8s-redis-ha.ts +16 -0
- package/src/plugins.ts +8 -0
- package/src/types/index.ts +1 -0
- package/dist/cli/affected.d.ts +0 -11
- package/dist/cli/affected.d.ts.map +0 -1
- package/dist/cli/cloudrun.d.ts +0 -11
- package/dist/cli/cloudrun.d.ts.map +0 -1
- package/dist/cli/console.d.ts +0 -11
- package/dist/cli/console.d.ts.map +0 -1
- package/dist/cli/constant.d.ts +0 -11
- package/dist/cli/constant.d.ts.map +0 -1
- package/dist/cli/db.d.ts +0 -11
- package/dist/cli/db.d.ts.map +0 -1
- package/dist/cli/dml.d.ts +0 -11
- package/dist/cli/dml.d.ts.map +0 -1
- package/dist/cli/env.d.ts +0 -11
- package/dist/cli/env.d.ts.map +0 -1
- package/dist/cli/exec.d.ts +0 -11
- package/dist/cli/exec.d.ts.map +0 -1
- package/dist/cli/image.d.ts +0 -11
- package/dist/cli/image.d.ts.map +0 -1
- package/dist/cli/init.d.ts +0 -11
- package/dist/cli/init.d.ts.map +0 -1
- package/dist/cli/internal-curl.d.ts +0 -11
- package/dist/cli/internal-curl.d.ts.map +0 -1
- package/dist/cli/job.d.ts +0 -11
- package/dist/cli/job.d.ts.map +0 -1
- package/dist/cli/jwt.d.ts +0 -11
- package/dist/cli/jwt.d.ts.map +0 -1
- package/dist/cli/namespace.d.ts +0 -11
- package/dist/cli/namespace.d.ts.map +0 -1
- package/dist/cli/prep-build.d.ts +0 -11
- package/dist/cli/prep-build.d.ts.map +0 -1
- package/dist/cli/prisma.d.ts +0 -11
- package/dist/cli/prisma.d.ts.map +0 -1
- package/dist/cli/redis.d.ts +0 -11
- package/dist/cli/redis.d.ts.map +0 -1
- package/dist/cli/registry.d.ts +0 -11
- package/dist/cli/registry.d.ts.map +0 -1
- package/dist/cli/run-many.d.ts +0 -11
- package/dist/cli/run-many.d.ts.map +0 -1
- package/dist/cli/run.d.ts +0 -11
- package/dist/cli/run.d.ts.map +0 -1
- package/dist/cli/template.d.ts +0 -11
- package/dist/cli/template.d.ts.map +0 -1
- package/dist/cli/test.d.ts +0 -11
- package/dist/cli/test.d.ts.map +0 -1
- package/dist/libs/k8s-redis.d.ts.map +0 -1
- /package/dist/libs/{k8s-redis.js → k8s-redis-bitnami.js} +0 -0
- /package/src/libs/{k8s-redis.ts → k8s-redis-bitnami.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CLICommandParser, printUsageAndExit, StrongParams } from "
|
|
2
|
-
import { buildDev, deploy } from "
|
|
1
|
+
import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
|
|
2
|
+
import { buildDev, deploy } from "../../libs/cloudrun-helpers";
|
|
3
3
|
|
|
4
4
|
const oneLiner =
|
|
5
5
|
"Supports cloudrun images";
|
|
@@ -128,6 +128,4 @@ async function run(cmdObj: CLICommandParser) {
|
|
|
128
128
|
handler(params);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
export
|
|
132
|
-
cloudrun: { oneLiner, keyExamples, run },
|
|
133
|
-
};
|
|
131
|
+
export const cloudrun = { oneLiner, keyExamples, run };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getConst } from "
|
|
1
|
+
import { getConst } from "../../libs/config";
|
|
2
2
|
import {
|
|
3
3
|
envToNamespace,
|
|
4
4
|
imageDebugName,
|
|
5
|
-
} from "
|
|
6
|
-
import { kubectlCommand } from "
|
|
7
|
-
import { CLICommandParser, printUsageAndExit } from "
|
|
5
|
+
} from "../../libs/k8s-constants";
|
|
6
|
+
import { kubectlCommand } from "../../libs/k8s-helpers";
|
|
7
|
+
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
8
8
|
|
|
9
9
|
const oneLiner = "Get a shell into the debug pod of an image";
|
|
10
10
|
const keyExamples = `
|
|
@@ -41,6 +41,4 @@ function run(cmdObj: CLICommandParser) {
|
|
|
41
41
|
.spawn();
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export
|
|
45
|
-
console: { oneLiner, keyExamples, run },
|
|
46
|
-
};
|
|
44
|
+
export const console = { oneLiner, keyExamples, run };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { getConst } from "
|
|
2
|
-
import { CLICommandParser, printUsageAndExit } from "
|
|
1
|
+
import { getConst } from "../../libs/config";
|
|
2
|
+
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
3
3
|
|
|
4
4
|
const oneLiner = "Prints to stdout a constant from constant.yaml";
|
|
5
5
|
const keyExamples = `$ devops constant infra`;
|
|
@@ -20,6 +20,4 @@ async function run(cmdObj: CLICommandParser) {
|
|
|
20
20
|
console.log(getConst(constant as any));
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
export
|
|
24
|
-
constant: { oneLiner, keyExamples, run },
|
|
25
|
-
};
|
|
23
|
+
export const constant = { oneLiner, keyExamples, run };
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
deleteMonorepoSecret,
|
|
4
4
|
getMonorepoSecretStr,
|
|
5
5
|
setMonorepoSecret,
|
|
6
|
-
} from "
|
|
7
|
-
import { CombinedEnvValidator } from "
|
|
6
|
+
} from "../../libs/k8s-secrets-manager";
|
|
7
|
+
import { CombinedEnvValidator } from "../../libs/validate-env";
|
|
8
8
|
import {
|
|
9
9
|
CLICommandParser,
|
|
10
10
|
dotEnvFilesForEnv,
|
|
11
11
|
printUsageAndExit,
|
|
12
|
-
} from "
|
|
12
|
+
} from "../common";
|
|
13
13
|
|
|
14
14
|
const oneLiner = "Commands to manipulate env variables";
|
|
15
15
|
const keyExamples = `
|
|
@@ -82,6 +82,4 @@ function run(cmdObj: CLICommandParser) {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
export
|
|
86
|
-
env: { oneLiner, keyExamples, run },
|
|
87
|
-
};
|
|
85
|
+
export const env = { oneLiner, keyExamples, run };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CLICommandParser, CommandExecutor, printUsageAndExit } from "
|
|
1
|
+
import { CLICommandParser, CommandExecutor, printUsageAndExit } from "../common";
|
|
2
2
|
import url from "url";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import { getWorkspace } from "
|
|
4
|
+
import { getWorkspace } from "../../libs/discovery";
|
|
5
5
|
|
|
6
6
|
const __file__ = url.fileURLToPath(import.meta.url);
|
|
7
|
-
const
|
|
8
|
-
const execShPath = path.join(
|
|
7
|
+
const __cli__ = path.join(path.dirname(__file__), "../..", "cli");
|
|
8
|
+
const execShPath = path.join(__cli__, "exec.sh");
|
|
9
9
|
|
|
10
10
|
const oneLiner =
|
|
11
11
|
"Executes a command after injecting env variables, either globally or in a workspace";
|
|
@@ -52,6 +52,4 @@ function run(cmdObj: CLICommandParser) {
|
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
export
|
|
56
|
-
exec: { oneLiner, keyExamples, run },
|
|
57
|
-
};
|
|
55
|
+
export const exec = { oneLiner, keyExamples, run };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { deleteImageVersion, getImageVersion, getWorkspaceScale, resetWorkspaceScale, setImageVersion, setWorkspaceScale } from "
|
|
2
|
-
import { CLICommandParser, printUsageAndExit, StrongParams } from "
|
|
3
|
-
import { generateImageDeployments } from "
|
|
4
|
-
import { applyHandler } from "
|
|
5
|
-
import { getImageType } from "
|
|
1
|
+
import { deleteImageVersion, getImageVersion, getWorkspaceScale, resetWorkspaceScale, setImageVersion, setWorkspaceScale } from "../../libs/k8s-image-config";
|
|
2
|
+
import { CLICommandParser, printUsageAndExit, StrongParams } from "../../../src/cli/common";
|
|
3
|
+
import { generateImageDeployments } from "../../libs/k8s-generate";
|
|
4
|
+
import { applyHandler } from "../../libs/k8s-helpers";
|
|
5
|
+
import { getImageType } from "../../libs/config";
|
|
6
6
|
|
|
7
7
|
const oneLiner = "Applies image-related manifests, retrieves or set the version deployed, and scales deployments of applications";
|
|
8
8
|
const keyExamples = `
|
|
@@ -206,6 +206,4 @@ function run(cmdObj: CLICommandParser) {
|
|
|
206
206
|
handler(params);
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
export
|
|
210
|
-
image: { oneLiner, keyExamples, run },
|
|
211
|
-
};
|
|
209
|
+
export const image = { oneLiner, keyExamples, run };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from "./run";
|
|
2
|
+
export * from "./run-many";
|
|
3
|
+
export * from "./exec";
|
|
4
|
+
export * from "./affected";
|
|
5
|
+
export * from "./cloudrun";
|
|
6
|
+
export * from "./console";
|
|
7
|
+
export * from "./constant";
|
|
8
|
+
export * from "./env";
|
|
9
|
+
export * from "./image";
|
|
10
|
+
export * from "./init";
|
|
11
|
+
export * from "./job";
|
|
12
|
+
export * from "./namespace";
|
|
13
|
+
export * from "./prep-build";
|
|
14
|
+
export * from "./registry";
|
|
15
|
+
export * from "./test";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import inquirer from "inquirer";
|
|
2
|
-
import { InitGenerator, type InitGeneratorFileInfo } from "
|
|
3
|
-
import { CLICommandParser, printUsageAndExit } from "
|
|
2
|
+
import { InitGenerator, type InitGeneratorFileInfo } from "../../libs/init-generator";
|
|
3
|
+
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import fs from 'fs-extra';
|
|
6
|
-
import type { ConstFileSchema } from "
|
|
6
|
+
import type { ConstFileSchema } from "../../types";
|
|
7
7
|
|
|
8
8
|
const oneLiner =
|
|
9
9
|
"Initializes the devops utility by copying template files to the current folder";
|
|
@@ -24,9 +24,7 @@ async function run(cmdObj: CLICommandParser) {
|
|
|
24
24
|
createFiles();
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export
|
|
28
|
-
init: { oneLiner, keyExamples, run },
|
|
29
|
-
};
|
|
27
|
+
export const init = { oneLiner, keyExamples, run };
|
|
30
28
|
|
|
31
29
|
async function createFiles() {
|
|
32
30
|
const tc = new InitGenerator();
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
|
-
} from "
|
|
3
|
-
import { CLICommandParser, printUsageAndExit, StrongParams } from "
|
|
4
|
-
import { generateDbMigrateJob } from "
|
|
5
|
-
import { applyHandler } from "
|
|
6
|
-
import { k8sJobWaiter, printJobStatuses } from "
|
|
7
|
-
import { dbMigrateJobName } from "
|
|
2
|
+
} from "../../libs/k8s-image-config";
|
|
3
|
+
import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
|
|
4
|
+
import { generateDbMigrateJob } from "../../libs/k8s-generate";
|
|
5
|
+
import { applyHandler } from "../../libs/k8s-helpers";
|
|
6
|
+
import { k8sJobWaiter, printJobStatuses } from "../../libs/k8s-job-waiter";
|
|
7
|
+
import { dbMigrateJobName } from "../../libs/k8s-constants";
|
|
8
8
|
|
|
9
9
|
const oneLiner = "Creates a k8s job and waits for it to run";
|
|
10
10
|
const keyExamples = `
|
|
@@ -75,6 +75,4 @@ function run(cmdObj: CLICommandParser) {
|
|
|
75
75
|
handler(params);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
export
|
|
79
|
-
job: { oneLiner, keyExamples, run },
|
|
80
|
-
};
|
|
78
|
+
export const job = { oneLiner, keyExamples, run };
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
} from "../libs/k8s-image-config";
|
|
3
|
-
import { CLICommandParser, printUsageAndExit, StrongParams } from "../../src/cli/common";
|
|
1
|
+
import { CLICommandParser, printUsageAndExit, StrongParams } from "../../../src/cli/common";
|
|
4
2
|
import {
|
|
5
3
|
copySecretHarborToNamespace,
|
|
6
4
|
patchServiceAccountImagePullSecret,
|
|
7
|
-
} from "
|
|
8
|
-
import { checkEnvSetup, createEmptyEnvSecret, createNamespace, deleteNamespace, patchBaseSecret } from "
|
|
5
|
+
} from "../../../src/libs/hetzner/reg-secret";
|
|
6
|
+
import { checkEnvSetup, createEmptyEnvSecret, createNamespace, deleteNamespace, patchBaseSecret } from "../../libs/k8s-namespace";
|
|
9
7
|
|
|
10
8
|
const oneLiner = "Creates the basic prerequisites for a monorepo";
|
|
11
9
|
const keyExamples = `
|
|
@@ -73,6 +71,4 @@ function run(cmdObj: CLICommandParser) {
|
|
|
73
71
|
handler(params);
|
|
74
72
|
}
|
|
75
73
|
|
|
76
|
-
export
|
|
77
|
-
namespace: { oneLiner, keyExamples, run },
|
|
78
|
-
};
|
|
74
|
+
export const namespace = { oneLiner, keyExamples, run };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import fs from "fs-extra";
|
|
2
2
|
import os from "os";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import { CLICommandParser, printUsageAndExit } from "
|
|
5
|
-
import { getImageData, getTemplateData } from "
|
|
6
|
-
import { getMonorepoSecretStr } from "
|
|
7
|
-
import { getImageDescendentData } from "
|
|
8
|
-
import { isLocalOrRemoteEnv } from "
|
|
4
|
+
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
5
|
+
import { getImageData, getTemplateData } from "../../libs/config";
|
|
6
|
+
import { getMonorepoSecretStr } from "../../libs/k8s-secrets-manager";
|
|
7
|
+
import { getImageDescendentData } from "../../libs/discovery/images";
|
|
8
|
+
import { isLocalOrRemoteEnv } from "../../libs/k8s-constants";
|
|
9
9
|
import chalk from "chalk";
|
|
10
10
|
|
|
11
11
|
const oneLiner =
|
|
@@ -119,6 +119,4 @@ async function run(cmdObj: CLICommandParser) {
|
|
|
119
119
|
console.log(destFolder);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
export
|
|
123
|
-
"prep-build": { oneLiner, keyExamples, run },
|
|
124
|
-
};
|
|
122
|
+
export const prepBuild = { command: 'prep-build', oneLiner, keyExamples, run };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { getConst
|
|
2
|
-
import { prune } from "
|
|
1
|
+
import { getConst } from "../../libs/config";
|
|
2
|
+
import { prune } from "../../libs/digital-ocean/container-reg";
|
|
3
3
|
import {
|
|
4
4
|
containerRegistryPath,
|
|
5
5
|
containerRegistryImageName,
|
|
6
6
|
containerRegistryRepoPath,
|
|
7
|
-
} from "
|
|
8
|
-
import { CLICommandParser, StrongParams, printUsageAndExit } from "
|
|
7
|
+
} from "../../libs/k8s-constants";
|
|
8
|
+
import { CLICommandParser, StrongParams, printUsageAndExit } from "../common";
|
|
9
9
|
|
|
10
10
|
const oneLiner = "Manage container repositories";
|
|
11
11
|
const keyExamples = `
|
|
@@ -81,6 +81,4 @@ function run(cmdObj: CLICommandParser) {
|
|
|
81
81
|
handler(params);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
export
|
|
85
|
-
registry: { oneLiner, keyExamples, run },
|
|
86
|
-
};
|
|
84
|
+
export const registry = { oneLiner, keyExamples, run };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { workspaceDirectoryForLanguage } from "
|
|
2
|
-
import { CLICommandParser, printUsageAndExit } from "
|
|
1
|
+
import { workspaceDirectoryForLanguage } from "../../libs/discovery";
|
|
2
|
+
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
3
3
|
import concurrently, {
|
|
4
4
|
type ConcurrentlyCommandInput,
|
|
5
5
|
type ConcurrentlyOptions,
|
|
@@ -56,6 +56,4 @@ async function run(cmdObj: CLICommandParser) {
|
|
|
56
56
|
});
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export
|
|
60
|
-
"run-many": { oneLiner, keyExamples, run },
|
|
61
|
-
};
|
|
59
|
+
export const runMany = { command: 'run-many', oneLiner, keyExamples, run };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { CLICommandParser, printUsageAndExit } from "
|
|
1
|
+
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
2
2
|
import url from "url";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import { getWorkspace } from "
|
|
4
|
+
import { getWorkspace } from "../../libs/discovery";
|
|
5
5
|
|
|
6
6
|
const __file__ = url.fileURLToPath(import.meta.url);
|
|
7
|
-
const
|
|
8
|
-
const execShPath = path.join(
|
|
7
|
+
const __cli__ = path.join(path.dirname(__file__), "../..", "cli");
|
|
8
|
+
const execShPath = path.join(__cli__, "exec.sh");
|
|
9
9
|
|
|
10
10
|
const oneLiner =
|
|
11
11
|
"Runs a script defined in package.json after injecting env variables";
|
|
@@ -25,7 +25,7 @@ EXAMPLES
|
|
|
25
25
|
${keyExamples}
|
|
26
26
|
`;
|
|
27
27
|
|
|
28
|
-
async function
|
|
28
|
+
async function runFn(cmdObj: CLICommandParser) {
|
|
29
29
|
if (cmdObj.help || cmdObj.args.length === 0) printUsageAndExit(usage);
|
|
30
30
|
const [workspace, script] = cmdObj.args[0].split(":");
|
|
31
31
|
if (!workspace || !script) printUsageAndExit(usage);
|
|
@@ -41,6 +41,4 @@ async function run(cmdObj: CLICommandParser) {
|
|
|
41
41
|
.spawn();
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export
|
|
45
|
-
run: { oneLiner, keyExamples, run },
|
|
46
|
-
};
|
|
44
|
+
export const run = { oneLiner, keyExamples, run: runFn };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CLICommandParser, CommandExecutor, printUsageAndExit } from "
|
|
1
|
+
import { CLICommandParser, CommandExecutor, printUsageAndExit } from "../common";
|
|
2
2
|
|
|
3
3
|
const oneLiner = "Runs tests in all projects or one specific project";
|
|
4
4
|
const keyExamples = `
|
|
@@ -25,6 +25,4 @@ function run(cmdObj: CLICommandParser) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export
|
|
29
|
-
test: { oneLiner, keyExamples, run },
|
|
30
|
-
};
|
|
28
|
+
export const test = { oneLiner, keyExamples, run };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
|
-
import { CLICommandParser, printUsageAndExit } from "
|
|
2
|
+
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
3
3
|
|
|
4
4
|
const oneLiner = "Utilities to manage and run DML scripts in the db project";
|
|
5
5
|
const keyExamples = `
|
|
@@ -121,6 +121,4 @@ function run(cmdObj: CLICommandParser) {
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
|
|
124
|
-
export
|
|
125
|
-
dml: { oneLiner, keyExamples, run },
|
|
126
|
-
};
|
|
124
|
+
export const dml = { oneLiner, keyExamples, run };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InternalToken } from "
|
|
2
|
-
import { CLICommandParser, printUsageAndExit } from "
|
|
1
|
+
import { InternalToken } from "../../app-support/crypto";
|
|
2
|
+
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
3
3
|
|
|
4
4
|
const oneLiner =
|
|
5
5
|
"Runs a curl command bearing an internal jwt-like token to allow verifying internal communication within the namespace";
|
|
@@ -43,6 +43,4 @@ async function run(cmdObj: CLICommandParser) {
|
|
|
43
43
|
cmdObj.executorFromEnv(`curl -H "Authorization: Bearer ${token}" ${rest.join(" ")}`).exec();
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export
|
|
47
|
-
'internal-curl': { oneLiner, keyExamples, run },
|
|
48
|
-
};
|
|
46
|
+
export const internalCurl = { command: 'internal-curl', oneLiner, keyExamples, run };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { InternalToken } from "
|
|
2
|
-
import { CLICommandParser, printUsageAndExit } from "
|
|
1
|
+
import { InternalToken } from "../../app-support/crypto";
|
|
2
|
+
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
3
3
|
|
|
4
4
|
const oneLiner =
|
|
5
5
|
"Returns a JWT-like token to allow verifying internal communication within the namespace";
|
|
@@ -27,6 +27,4 @@ async function run(cmdObj: CLICommandParser) {
|
|
|
27
27
|
console.log(new InternalToken(subject).generate());
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export
|
|
31
|
-
jwt: { oneLiner, keyExamples, run },
|
|
32
|
-
};
|
|
30
|
+
export const jwt = { oneLiner, keyExamples, run };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { CLICommandParser
|
|
1
|
+
import { CLICommandParser } from "../common";
|
|
2
2
|
import url from "url";
|
|
3
3
|
import path from "path";
|
|
4
4
|
|
|
5
5
|
const __file__ = url.fileURLToPath(import.meta.url);
|
|
6
|
-
const
|
|
7
|
-
const execShPath = path.join(
|
|
6
|
+
const __cli__ = path.join(path.dirname(__file__), "../..", "cli");
|
|
7
|
+
const execShPath = path.join(__cli__, "exec.sh");
|
|
8
8
|
|
|
9
9
|
const oneLiner = "Runs prisma commands in the db project after injecting the environment variables";
|
|
10
10
|
const keyExamples = `$ devops prisma migrate dev`;
|
|
@@ -28,6 +28,4 @@ async function run(cmdObj: CLICommandParser) {
|
|
|
28
28
|
).spawn()
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
export
|
|
32
|
-
prisma: { oneLiner, keyExamples, run },
|
|
33
|
-
};
|
|
31
|
+
export const prisma = { oneLiner, keyExamples, run };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
|
-
import { establishRedisTunnel, getRedisList, getRedisPassword } from "
|
|
3
|
-
import { CLICommandParser, printUsageAndExit, StrongParams } from "
|
|
2
|
+
import { establishRedisTunnel, getRedisList, getRedisPassword } from "../../libs/k8s-redis-bitnami";
|
|
3
|
+
import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
|
|
4
4
|
|
|
5
5
|
const oneLiner =
|
|
6
|
-
"Utilities to help accessing production and staging redis";
|
|
6
|
+
"Utilities to help accessing production and staging redis installation from Bitnami";
|
|
7
7
|
const keyExamples = `
|
|
8
8
|
$ devops redis list
|
|
9
9
|
$ devops redis password redis-staging
|
|
@@ -78,6 +78,4 @@ function run(cmdObj: CLICommandParser) {
|
|
|
78
78
|
handler(params);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
export
|
|
82
|
-
redis: { oneLiner, keyExamples, run },
|
|
83
|
-
};
|
|
81
|
+
export const redisBitnami = { name: 'redis-bitnami', command: 'redis', oneLiner, keyExamples, run };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
|
|
2
|
+
import { establishRedisTunnel, getRedisList } from "../../libs/k8s-redis-ha";
|
|
3
|
+
|
|
4
|
+
const oneLiner =
|
|
5
|
+
"Utilities to help accessing production and staging redis installation from redis-ha";
|
|
6
|
+
const keyExamples = `
|
|
7
|
+
$ devops redis list
|
|
8
|
+
$ devops redis tunnel redis-staging
|
|
9
|
+
`.trim();
|
|
10
|
+
|
|
11
|
+
const usage = `
|
|
12
|
+
${oneLiner}
|
|
13
|
+
|
|
14
|
+
COMMANDS
|
|
15
|
+
list Lists the available redis installations
|
|
16
|
+
tunnel <namespace> [-p <port>] Sets up a tunnel to the remote Redis instance so you can access the DB from your local machine on port 9379 by default
|
|
17
|
+
|
|
18
|
+
NOTES
|
|
19
|
+
This command assumes the namespace and the helm release name are the same.
|
|
20
|
+
The --env flag should not be used with these commands, as the Redis namespaces follow different conventions than the monorepo env.
|
|
21
|
+
|
|
22
|
+
EXAMPLES
|
|
23
|
+
${keyExamples}
|
|
24
|
+
`;
|
|
25
|
+
|
|
26
|
+
const handlers = {
|
|
27
|
+
list: () => {
|
|
28
|
+
const res = getRedisList();
|
|
29
|
+
console.log(res);
|
|
30
|
+
},
|
|
31
|
+
tunnel: (opts: StrongParams) => {
|
|
32
|
+
const namespace = opts.required("namespace");
|
|
33
|
+
const port = opts.optional("port") ?? '9379';
|
|
34
|
+
establishRedisTunnel(namespace, port);
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
function run(cmdObj: CLICommandParser) {
|
|
39
|
+
if (cmdObj.help || cmdObj.args.length < 1) printUsageAndExit(usage);
|
|
40
|
+
const parsed = cmdObj.parseOptions({ params: ["-p"] });
|
|
41
|
+
|
|
42
|
+
const [command, namespace] = parsed.args;
|
|
43
|
+
const port = parsed.options["-p"];
|
|
44
|
+
// @ts-expect-error left as an exercise for the reader
|
|
45
|
+
const handler = handlers[command];
|
|
46
|
+
if (!handler) {
|
|
47
|
+
console.error(`Unknown command: ${command}`);
|
|
48
|
+
printUsageAndExit(usage);
|
|
49
|
+
}
|
|
50
|
+
const params = new StrongParams(usage, {
|
|
51
|
+
namespace,
|
|
52
|
+
port,
|
|
53
|
+
});
|
|
54
|
+
handler(params);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export const redisHa = { name: 'redis-ha', command: 'redis', oneLiner, keyExamples, run };
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
getDbBackups,
|
|
7
7
|
getDbList,
|
|
8
8
|
getDbPasswords,
|
|
9
|
-
} from "
|
|
10
|
-
import { CLICommandParser, printUsageAndExit, StrongParams } from "
|
|
9
|
+
} from "../../libs/k8s-db";
|
|
10
|
+
import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
|
|
11
11
|
|
|
12
12
|
const oneLiner =
|
|
13
13
|
"Utilities to help day to day operations of production and staging databases";
|
|
@@ -128,6 +128,4 @@ function run(cmdObj: CLICommandParser) {
|
|
|
128
128
|
handler(params);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
export
|
|
132
|
-
db: { oneLiner, keyExamples, run },
|
|
133
|
-
};
|
|
131
|
+
export const stackgres = { command: 'db', oneLiner, keyExamples, run };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
-
} from "
|
|
3
|
-
import { CLICommandParser, printUsageAndExit, StrongParams } from "
|
|
4
|
-
import { generateDbMigrateJob, generateDebugDeployment, generateWorkspaceDeployment, ImageContextGenerator } from "
|
|
2
|
+
} from "../../libs/k8s-image-config";
|
|
3
|
+
import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
|
|
4
|
+
import { generateDbMigrateJob, generateDebugDeployment, generateWorkspaceDeployment, ImageContextGenerator } from "../../libs/k8s-generate";
|
|
5
5
|
import chalk from "chalk";
|
|
6
|
-
import { getWorkspace } from "
|
|
7
|
-
import { getWorkspaceImages } from "
|
|
8
|
-
import { getImageData, getImageNames } from "
|
|
6
|
+
import { getWorkspace } from "../../libs/discovery";
|
|
7
|
+
import { getWorkspaceImages } from "../../libs/discovery/images";
|
|
8
|
+
import { getImageData, getImageNames } from "../../libs/config";
|
|
9
9
|
|
|
10
10
|
const SUPPORTED_CONTEXT_TYPES = ['deployment', 'db-migrate', 'debug'];
|
|
11
11
|
|
|
@@ -164,6 +164,4 @@ function run(cmdObj: CLICommandParser) {
|
|
|
164
164
|
handler(params);
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
export
|
|
168
|
-
template: { oneLiner, keyExamples, run },
|
|
169
|
-
};
|
|
167
|
+
export const template = { oneLiner, keyExamples, run };
|