@vaharoni/devops 1.1.12 → 1.2.1
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 +10 -0
- package/dist/cli/core/console.d.ts.map +1 -0
- package/dist/cli/core/console.js +50 -0
- 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} +8 -10
- package/dist/devops.js +84 -62
- package/dist/libs/k8s-generate.d.ts +1 -1
- package/dist/libs/k8s-generate.d.ts.map +1 -1
- package/dist/libs/k8s-generate.js +15 -14
- 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/core/console.ts +59 -0
- 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} +8 -10
- package/src/devops.ts +100 -64
- package/src/libs/k8s-generate.ts +15 -14
- package/src/libs/k8s-redis-ha.ts +16 -0
- package/src/plugins.ts +8 -0
- package/src/target-templates/lang-variants-common/typescript/.devops/manifests/deployment-debug.yaml.hb +36 -39
- 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/console.js +0 -35
- 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/src/cli/console.ts +0 -46
- /package/dist/libs/{k8s-redis.js → k8s-redis-bitnami.js} +0 -0
- /package/src/libs/{k8s-redis.ts → k8s-redis-bitnami.ts} +0 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CLICommandParser } from "../common";
|
|
2
|
+
declare function run(cmdObj: CLICommandParser): Promise<void>;
|
|
3
|
+
export declare const affected: {
|
|
4
|
+
oneLiner: string;
|
|
5
|
+
keyExamples: string;
|
|
6
|
+
run: typeof run;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=affected.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affected.d.ts","sourceRoot":"","sources":["../../../src/cli/core/affected.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAmC,MAAM,WAAW,CAAC;AAoD9E,iBAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,iBAoD1C;AAED,eAAO,MAAM,QAAQ;;;;CAAiC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { findImagesAffected, findImagesWithAffectedWorkspace, isImageAffected, isWorkspaceAffected, } from "
|
|
2
|
-
import { getImageData } from "
|
|
3
|
-
import { CLICommandParser, printUsageAndExit, StrongParams } from "
|
|
1
|
+
import { findImagesAffected, findImagesWithAffectedWorkspace, isImageAffected, isWorkspaceAffected, } from "../../libs/affected-entities";
|
|
2
|
+
import { getImageData } from "../../libs/config";
|
|
3
|
+
import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
|
|
4
4
|
const oneLiner = "Command to check whether an image or a workspace is affected by certain commit(s)";
|
|
5
5
|
const keyExamples = `
|
|
6
6
|
$ devops affected list-images
|
|
@@ -98,6 +98,4 @@ async function run(cmdObj) {
|
|
|
98
98
|
printUsageAndExit(usage);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
export
|
|
102
|
-
affected: { oneLiner, keyExamples, run },
|
|
103
|
-
};
|
|
101
|
+
export const affected = { oneLiner, keyExamples, run };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CLICommandParser } from "../common";
|
|
2
|
+
declare function run(cmdObj: CLICommandParser): Promise<void>;
|
|
3
|
+
export declare const cloudrun: {
|
|
4
|
+
oneLiner: string;
|
|
5
|
+
keyExamples: string;
|
|
6
|
+
run: typeof run;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=cloudrun.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cloudrun.d.ts","sourceRoot":"","sources":["../../../src/cli/core/cloudrun.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAmC,MAAM,WAAW,CAAC;AA6E9E,iBAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,iBAmD1C;AAED,eAAO,MAAM,QAAQ;;;;CAAiC,CAAC"}
|
|
@@ -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
|
const oneLiner = "Supports cloudrun images";
|
|
4
4
|
const keyExamples = `
|
|
5
5
|
$ devops cloudrun deploy cloudrun-image SHA --env staging --region us-east1 [--forward-env ENV1,ENV2 --allow-unauthenticated]
|
|
@@ -116,6 +116,4 @@ async function run(cmdObj) {
|
|
|
116
116
|
});
|
|
117
117
|
handler(params);
|
|
118
118
|
}
|
|
119
|
-
export
|
|
120
|
-
cloudrun: { oneLiner, keyExamples, run },
|
|
121
|
-
};
|
|
119
|
+
export const cloudrun = { oneLiner, keyExamples, run };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CLICommandParser } from "../common";
|
|
2
|
+
declare function run(cmdObj: CLICommandParser): void;
|
|
3
|
+
export declare const consoleCommand: {
|
|
4
|
+
command: string;
|
|
5
|
+
oneLiner: string;
|
|
6
|
+
keyExamples: string;
|
|
7
|
+
run: typeof run;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=console.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console.d.ts","sourceRoot":"","sources":["../../../src/cli/core/console.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAsC,MAAM,WAAW,CAAC;AAsBjF,iBAAS,GAAG,CAAC,MAAM,EAAE,gBAAgB,QA2BpC;AAMD,eAAO,MAAM,cAAc;;;;;CAAqD,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { generateDebugPod } from "../../libs/k8s-generate";
|
|
2
|
+
import { kubectlCommand } from "../../libs/k8s-helpers";
|
|
3
|
+
import { getImageVersion } from "../../libs/k8s-image-config";
|
|
4
|
+
import { CLICommandParser, CommandExecutor, printUsageAndExit } from "../common";
|
|
5
|
+
import yaml from "yaml";
|
|
6
|
+
const oneLiner = "Spin up a debug pod of the specified image and get a shell into it.";
|
|
7
|
+
const keyExamples = `
|
|
8
|
+
$ devops console main-node
|
|
9
|
+
`.trim();
|
|
10
|
+
const usage = `
|
|
11
|
+
${oneLiner}
|
|
12
|
+
|
|
13
|
+
USAGE
|
|
14
|
+
devops console <image> [--version <version>]
|
|
15
|
+
|
|
16
|
+
Options:
|
|
17
|
+
--version <version> The version (git SHA) of the image to use.
|
|
18
|
+
If not specified, the live version of the image (obtained using 'devops image version get <image>') is used.
|
|
19
|
+
|
|
20
|
+
EXAMPLES
|
|
21
|
+
${keyExamples}
|
|
22
|
+
`;
|
|
23
|
+
function run(cmdObj) {
|
|
24
|
+
if (cmdObj.help || cmdObj.args.length === 0)
|
|
25
|
+
printUsageAndExit(usage);
|
|
26
|
+
const parsed = cmdObj.parseOptions({ params: ["--version"] });
|
|
27
|
+
if (parsed.args.length !== 1)
|
|
28
|
+
printUsageAndExit(usage);
|
|
29
|
+
const image = parsed.args[0];
|
|
30
|
+
const version = parsed.options["--version"];
|
|
31
|
+
const gitSha = version ?? getImageVersion(cmdObj.env, image);
|
|
32
|
+
if (!gitSha) {
|
|
33
|
+
console.error(`No git SHA found for image ${image} in environment ${cmdObj.env}`);
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
const debugYaml = generateDebugPod(cmdObj.env, image, gitSha);
|
|
37
|
+
if (!debugYaml) {
|
|
38
|
+
console.error(`The image ${image} does not specify debug-template in images.yaml`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
const userName = new CommandExecutor(`kubectl auth whoami -o jsonpath='{.status.userInfo.username}'`).exec();
|
|
42
|
+
const debugManifestsJson = JSON.stringify(yaml.parse(debugYaml));
|
|
43
|
+
const randomId = Math.random().toString(36).substring(2, 10);
|
|
44
|
+
const podName = ['ephemeral-console', slugify(userName), slugify(image), randomId].filter(Boolean).join('-');
|
|
45
|
+
new CommandExecutor(kubectlCommand(`run ${podName} --restart=Never --rm -it --image=overridden --overrides='${debugManifestsJson}'`, { monorepoEnv: cmdObj.env })).spawn();
|
|
46
|
+
}
|
|
47
|
+
function slugify(str, maxLength = 20) {
|
|
48
|
+
return str.toLowerCase().trim().replace(/[^a-zA-Z0-9]/g, '-').replace(/-+/g, '-').replace(/^-|-$/g, '').slice(0, maxLength);
|
|
49
|
+
}
|
|
50
|
+
export const consoleCommand = { command: 'console', oneLiner, keyExamples, run };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CLICommandParser } from "../common";
|
|
2
|
+
declare function run(cmdObj: CLICommandParser): Promise<void>;
|
|
3
|
+
export declare const constant: {
|
|
4
|
+
oneLiner: string;
|
|
5
|
+
keyExamples: string;
|
|
6
|
+
run: typeof run;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constant.d.ts","sourceRoot":"","sources":["../../../src/cli/core/constant.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AAehE,iBAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,iBAI1C;AAED,eAAO,MAAM,QAAQ;;;;CAAiC,CAAC"}
|
|
@@ -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
|
const oneLiner = "Prints to stdout a constant from constant.yaml";
|
|
4
4
|
const keyExamples = `$ devops constant infra`;
|
|
5
5
|
const usage = `
|
|
@@ -17,6 +17,4 @@ async function run(cmdObj) {
|
|
|
17
17
|
const [constant] = cmdObj.args;
|
|
18
18
|
console.log(getConst(constant));
|
|
19
19
|
}
|
|
20
|
-
export
|
|
21
|
-
constant: { oneLiner, keyExamples, run },
|
|
22
|
-
};
|
|
20
|
+
export const constant = { oneLiner, keyExamples, run };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../../src/cli/core/env.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,gBAAgB,EAGjB,MAAM,WAAW,CAAC;AAwBnB,iBAAS,GAAG,CAAC,MAAM,EAAE,gBAAgB,QA+CpC;AAED,eAAO,MAAM,GAAG;;;;CAAiC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { globSync } from "glob";
|
|
2
|
-
import { deleteMonorepoSecret, getMonorepoSecretStr, setMonorepoSecret, } from "
|
|
3
|
-
import { CombinedEnvValidator } from "
|
|
4
|
-
import { CLICommandParser, dotEnvFilesForEnv, printUsageAndExit, } from "
|
|
2
|
+
import { deleteMonorepoSecret, getMonorepoSecretStr, setMonorepoSecret, } from "../../libs/k8s-secrets-manager";
|
|
3
|
+
import { CombinedEnvValidator } from "../../libs/validate-env";
|
|
4
|
+
import { CLICommandParser, dotEnvFilesForEnv, printUsageAndExit, } from "../common";
|
|
5
5
|
const oneLiner = "Commands to manipulate env variables";
|
|
6
6
|
const keyExamples = `
|
|
7
7
|
$ devops env get --env staging
|
|
@@ -62,6 +62,4 @@ function run(cmdObj) {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
export
|
|
66
|
-
env: { oneLiner, keyExamples, run },
|
|
67
|
-
};
|
|
65
|
+
export const env = { oneLiner, keyExamples, run };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exec.d.ts","sourceRoot":"","sources":["../../../src/cli/core/exec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAsC,MAAM,WAAW,CAAC;AA4BjF,iBAAS,GAAG,CAAC,MAAM,EAAE,gBAAgB,QAwBpC;AAED,eAAO,MAAM,IAAI;;;;CAAiC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
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
|
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
|
const oneLiner = "Executes a command after injecting env variables, either globally or in a workspace";
|
|
9
9
|
const keyExamples = `
|
|
10
10
|
$ devops exec tmp/test.sh
|
|
@@ -45,6 +45,4 @@ function run(cmdObj) {
|
|
|
45
45
|
executor.exec();
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
export
|
|
49
|
-
exec: { oneLiner, keyExamples, run },
|
|
50
|
-
};
|
|
48
|
+
export const exec = { oneLiner, keyExamples, run };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CLICommandParser } from "../../../src/cli/common";
|
|
2
|
+
declare function run(cmdObj: CLICommandParser): void;
|
|
3
|
+
export declare const image: {
|
|
4
|
+
oneLiner: string;
|
|
5
|
+
keyExamples: string;
|
|
6
|
+
run: typeof run;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../src/cli/core/image.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAmC,MAAM,yBAAyB,CAAC;AA6K5F,iBAAS,GAAG,CAAC,MAAM,EAAE,gBAAgB,QAgCpC;AAED,eAAO,MAAM,KAAK;;;;CAAiC,CAAC"}
|
|
@@ -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
|
const oneLiner = "Applies image-related manifests, retrieves or set the version deployed, and scales deployments of applications";
|
|
7
7
|
const keyExamples = `
|
|
8
8
|
$ devops image get type main-node
|
|
@@ -150,6 +150,4 @@ function run(cmdObj) {
|
|
|
150
150
|
});
|
|
151
151
|
handler(params);
|
|
152
152
|
}
|
|
153
|
-
export
|
|
154
|
-
image: { oneLiner, keyExamples, run },
|
|
155
|
-
};
|
|
153
|
+
export const image = { oneLiner, keyExamples, run };
|
|
@@ -0,0 +1,16 @@
|
|
|
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";
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC"}
|
|
@@ -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";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/cli/core/init.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AAmBhE,iBAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,iBAG1C;AAED,eAAO,MAAM,IAAI;;;;CAAiC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import inquirer from "inquirer";
|
|
2
|
-
import { InitGenerator } from "
|
|
3
|
-
import { CLICommandParser, printUsageAndExit } from "
|
|
2
|
+
import { InitGenerator } from "../../libs/init-generator";
|
|
3
|
+
import { CLICommandParser, printUsageAndExit } from "../common";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
import fs from 'fs-extra';
|
|
6
6
|
const oneLiner = "Initializes the devops utility by copying template files to the current folder";
|
|
@@ -19,9 +19,7 @@ async function run(cmdObj) {
|
|
|
19
19
|
printUsageAndExit(usage);
|
|
20
20
|
createFiles();
|
|
21
21
|
}
|
|
22
|
-
export
|
|
23
|
-
init: { oneLiner, keyExamples, run },
|
|
24
|
-
};
|
|
22
|
+
export const init = { oneLiner, keyExamples, run };
|
|
25
23
|
async function createFiles() {
|
|
26
24
|
const tc = new InitGenerator();
|
|
27
25
|
const userChoices = await getUserChoices(tc.projectName);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"job.d.ts","sourceRoot":"","sources":["../../../src/cli/core/job.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAmC,MAAM,WAAW,CAAC;AA6C9E,iBAAS,GAAG,CAAC,MAAM,EAAE,gBAAgB,QA4BpC;AAED,eAAO,MAAM,GAAG;;;;CAAiC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {} from "
|
|
2
|
-
import { CLICommandParser, printUsageAndExit, StrongParams } from "
|
|
3
|
-
import { generateDbMigrateJob } from "
|
|
4
|
-
import { applyHandler } from "
|
|
5
|
-
import { k8sJobWaiter, printJobStatuses } from "
|
|
6
|
-
import { dbMigrateJobName } from "
|
|
1
|
+
import {} from "../../libs/k8s-image-config";
|
|
2
|
+
import { CLICommandParser, printUsageAndExit, StrongParams } from "../common";
|
|
3
|
+
import { generateDbMigrateJob } from "../../libs/k8s-generate";
|
|
4
|
+
import { applyHandler } from "../../libs/k8s-helpers";
|
|
5
|
+
import { k8sJobWaiter, printJobStatuses } from "../../libs/k8s-job-waiter";
|
|
6
|
+
import { dbMigrateJobName } from "../../libs/k8s-constants";
|
|
7
7
|
const oneLiner = "Creates a k8s job and waits for it to run";
|
|
8
8
|
const keyExamples = `
|
|
9
9
|
$ devops job db-migrate gen main-node <sha> --env staging
|
|
@@ -62,6 +62,4 @@ function run(cmdObj) {
|
|
|
62
62
|
});
|
|
63
63
|
handler(params);
|
|
64
64
|
}
|
|
65
|
-
export
|
|
66
|
-
job: { oneLiner, keyExamples, run },
|
|
67
|
-
};
|
|
65
|
+
export const job = { oneLiner, keyExamples, run };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CLICommandParser } from "../../../src/cli/common";
|
|
2
|
+
declare function run(cmdObj: CLICommandParser): void;
|
|
3
|
+
export declare const namespace: {
|
|
4
|
+
oneLiner: string;
|
|
5
|
+
keyExamples: string;
|
|
6
|
+
run: typeof run;
|
|
7
|
+
};
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../src/cli/core/namespace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAmC,MAAM,yBAAyB,CAAC;AA0D5F,iBAAS,GAAG,CAAC,MAAM,EAAE,gBAAgB,QAapC;AAED,eAAO,MAAM,SAAS;;;;CAAiC,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {} from "
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { checkEnvSetup, createEmptyEnvSecret, createNamespace, deleteNamespace, patchBaseSecret } from "../libs/k8s-namespace";
|
|
1
|
+
import { CLICommandParser, printUsageAndExit, StrongParams } from "../../../src/cli/common";
|
|
2
|
+
import { copySecretHarborToNamespace, patchServiceAccountImagePullSecret, } from "../../../src/libs/hetzner/reg-secret";
|
|
3
|
+
import { checkEnvSetup, createEmptyEnvSecret, createNamespace, deleteNamespace, patchBaseSecret } from "../../libs/k8s-namespace";
|
|
5
4
|
const oneLiner = "Creates the basic prerequisites for a monorepo";
|
|
6
5
|
const keyExamples = `
|
|
7
6
|
$ devops namespace create --env staging
|
|
@@ -65,6 +64,4 @@ function run(cmdObj) {
|
|
|
65
64
|
});
|
|
66
65
|
handler(params);
|
|
67
66
|
}
|
|
68
|
-
export
|
|
69
|
-
namespace: { oneLiner, keyExamples, run },
|
|
70
|
-
};
|
|
67
|
+
export const namespace = { oneLiner, keyExamples, run };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CLICommandParser } from "../common";
|
|
2
|
+
declare function run(cmdObj: CLICommandParser): Promise<void>;
|
|
3
|
+
export declare const prepBuild: {
|
|
4
|
+
command: string;
|
|
5
|
+
oneLiner: string;
|
|
6
|
+
keyExamples: string;
|
|
7
|
+
run: typeof run;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=prep-build.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prep-build.d.ts","sourceRoot":"","sources":["../../../src/cli/core/prep-build.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AA0BhE,iBAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,iBA0F1C;AAED,eAAO,MAAM,SAAS;;;;;CAAwD,CAAC"}
|
|
@@ -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
|
const oneLiner = "Copies all dependencies of an image to a temporary folder in preparation for a Docker build";
|
|
11
11
|
const keyExamples = `
|
|
@@ -106,6 +106,4 @@ async function run(cmdObj) {
|
|
|
106
106
|
});
|
|
107
107
|
console.log(destFolder);
|
|
108
108
|
}
|
|
109
|
-
export
|
|
110
|
-
"prep-build": { oneLiner, keyExamples, run },
|
|
111
|
-
};
|
|
109
|
+
export const prepBuild = { command: 'prep-build', oneLiner, keyExamples, run };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/cli/core/registry.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,gBAAgB,EAAmC,MAAM,WAAW,CAAC;AA8D9E,iBAAS,GAAG,CAAC,MAAM,EAAE,gBAAgB,QAYpC;AAED,eAAO,MAAM,QAAQ;;;;CAAiC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getConst
|
|
2
|
-
import { prune } from "
|
|
3
|
-
import { containerRegistryPath, containerRegistryImageName, containerRegistryRepoPath, } from "
|
|
4
|
-
import { CLICommandParser, StrongParams, printUsageAndExit } from "
|
|
1
|
+
import { getConst } from "../../libs/config";
|
|
2
|
+
import { prune } from "../../libs/digital-ocean/container-reg";
|
|
3
|
+
import { containerRegistryPath, containerRegistryImageName, containerRegistryRepoPath, } from "../../libs/k8s-constants";
|
|
4
|
+
import { CLICommandParser, StrongParams, printUsageAndExit } from "../common";
|
|
5
5
|
const oneLiner = "Manage container repositories";
|
|
6
6
|
const keyExamples = `
|
|
7
7
|
$ devops registry server-url
|
|
@@ -63,6 +63,4 @@ function run(cmdObj) {
|
|
|
63
63
|
const params = new StrongParams(usage, { image, env: cmdObj.env, sha });
|
|
64
64
|
handler(params);
|
|
65
65
|
}
|
|
66
|
-
export
|
|
67
|
-
registry: { oneLiner, keyExamples, run },
|
|
68
|
-
};
|
|
66
|
+
export const registry = { oneLiner, keyExamples, run };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CLICommandParser } from "../common";
|
|
2
|
+
declare function run(cmdObj: CLICommandParser): Promise<void>;
|
|
3
|
+
export declare const runMany: {
|
|
4
|
+
command: string;
|
|
5
|
+
oneLiner: string;
|
|
6
|
+
keyExamples: string;
|
|
7
|
+
run: typeof run;
|
|
8
|
+
};
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=run-many.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-many.d.ts","sourceRoot":"","sources":["../../../src/cli/core/run-many.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AAyBhE,iBAAe,GAAG,CAAC,MAAM,EAAE,gBAAgB,iBA8B1C;AAED,eAAO,MAAM,OAAO;;;;;CAAsD,CAAC"}
|
|
@@ -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, {} from "concurrently";
|
|
4
4
|
const oneLiner = "Runs a script concurrently in all projects that define it in their package.json";
|
|
5
5
|
const keyExamples = `
|
|
@@ -45,6 +45,4 @@ async function run(cmdObj) {
|
|
|
45
45
|
process.exit(1);
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
-
export
|
|
49
|
-
"run-many": { oneLiner, keyExamples, run },
|
|
50
|
-
};
|
|
48
|
+
export const runMany = { command: 'run-many', oneLiner, keyExamples, run };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../src/cli/core/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAqB,MAAM,WAAW,CAAC;AA2BhE,iBAAe,KAAK,CAAC,MAAM,EAAE,gBAAgB,iBAc5C;AAED,eAAO,MAAM,GAAG;;;;CAAwC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
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
|
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
|
const oneLiner = "Runs a script defined in package.json after injecting env variables";
|
|
9
9
|
const keyExamples = `$ devops run project:test`;
|
|
10
10
|
const usage = `
|
|
@@ -20,7 +20,7 @@ NOTES
|
|
|
20
20
|
EXAMPLES
|
|
21
21
|
${keyExamples}
|
|
22
22
|
`;
|
|
23
|
-
async function
|
|
23
|
+
async function runFn(cmdObj) {
|
|
24
24
|
if (cmdObj.help || cmdObj.args.length === 0)
|
|
25
25
|
printUsageAndExit(usage);
|
|
26
26
|
const [workspace, script] = cmdObj.args[0].split(":");
|
|
@@ -32,6 +32,4 @@ async function run(cmdObj) {
|
|
|
32
32
|
.executorFromEnv(`${execShPath} ${rootPath} bun run ${script} ${remaining}`, { checkEnvYaml: true })
|
|
33
33
|
.spawn();
|
|
34
34
|
}
|
|
35
|
-
export
|
|
36
|
-
run: { oneLiner, keyExamples, run },
|
|
37
|
-
};
|
|
35
|
+
export const run = { oneLiner, keyExamples, run: runFn };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../../../src/cli/core/test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAsC,MAAM,WAAW,CAAC;AAejF,iBAAS,GAAG,CAAC,MAAM,EAAE,gBAAgB,QAUpC;AAED,eAAO,MAAM,IAAI;;;;CAAiC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CLICommandParser, CommandExecutor, printUsageAndExit } from "
|
|
1
|
+
import { CLICommandParser, CommandExecutor, printUsageAndExit } from "../common";
|
|
2
2
|
const oneLiner = "Runs tests in all projects or one specific project";
|
|
3
3
|
const keyExamples = `
|
|
4
4
|
$ devops test
|
|
@@ -23,6 +23,4 @@ function run(cmdObj) {
|
|
|
23
23
|
new CommandExecutor(`devops run-many test --env ${env}`).spawn();
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
export
|
|
27
|
-
test: { oneLiner, keyExamples, run },
|
|
28
|
-
};
|
|
26
|
+
export const test = { oneLiner, keyExamples, run };
|
package/dist/cli/exec.sh
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
# The following:
|
|
4
|
+
# run.sh some-dir some-command arg1 args
|
|
5
|
+
# Changes the current directory to some-dir and then runs the following command before returning to the original directory:
|
|
6
|
+
# some-command arg1 arg2
|
|
7
|
+
#
|
|
8
|
+
# We cannot use `cwd` in exec or spawn since dotenvx won't inject the env variables properly
|
|
9
|
+
|
|
10
|
+
# Change to the provided directory
|
|
11
|
+
pushd "$1" &> /dev/null || exit
|
|
12
|
+
|
|
13
|
+
# Execute the rest of the arguments
|
|
14
|
+
"${@:2}"
|
|
15
|
+
|
|
16
|
+
EXIT_CODE=$?
|
|
17
|
+
|
|
18
|
+
# Return to the previous directory
|
|
19
|
+
popd &> /dev/null
|
|
20
|
+
|
|
21
|
+
exit $EXIT_CODE
|