@vaharoni/devops 1.0.51 → 1.1.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/registry.js +2 -2
- package/dist/libs/k8s-constants.d.ts +1 -1
- package/dist/libs/k8s-constants.d.ts.map +1 -1
- package/dist/libs/k8s-constants.js +5 -5
- package/dist/types/index.d.ts +9 -9
- package/dist/types/index.js +3 -3
- package/package.json +1 -1
- package/src/cli/registry.ts +2 -2
- package/src/libs/k8s-constants.ts +5 -5
- package/src/target-templates/.devops/config/constants.yaml +2 -1
- package/src/target-templates/applications/example-python/src/example_python/scripts.py +1 -1
- package/src/types/index.ts +3 -3
package/dist/cli/registry.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { getConst, getImageData } from "../libs/config";
|
2
2
|
import { prune } from "../libs/digital-ocean/container-reg";
|
3
|
-
import { containerRegistryPath,
|
3
|
+
import { containerRegistryPath, containerRegistryImageName, containerRegistryRepoPath, } from "../libs/k8s-constants";
|
4
4
|
import { CLICommandParser, StrongParams, printUsageAndExit } from "./common";
|
5
5
|
const oneLiner = "Manage container repositories";
|
6
6
|
const keyExamples = `
|
@@ -36,7 +36,7 @@ const handlers = {
|
|
36
36
|
},
|
37
37
|
prune: (opts) => {
|
38
38
|
const regName = containerRegistryPath();
|
39
|
-
const repoName =
|
39
|
+
const repoName = containerRegistryImageName(opts.required("image"), opts.required("env"));
|
40
40
|
prune(regName, repoName);
|
41
41
|
},
|
42
42
|
};
|
@@ -4,7 +4,7 @@ export declare function envToNamespace(monorepoEnv?: string): string;
|
|
4
4
|
export declare function secretName(): string;
|
5
5
|
export declare function imageDebugName(image: string): string;
|
6
6
|
export declare function imageConfigMap(image: string): string;
|
7
|
-
export declare function
|
7
|
+
export declare function containerRegistryImageName(image: string, monorepoEnv: string): string;
|
8
8
|
export declare function containerRegistryPath(): string;
|
9
9
|
export declare function containerRegistryRepoPath(image: string, monorepoEnv: string, gitSha: string): string;
|
10
10
|
export declare function domainNameForEnv(image: string, monorepoEnv: string): string;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"k8s-constants.d.ts","sourceRoot":"","sources":["../../src/libs/k8s-constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,6BAA6B,CAAA;AAoBlE,wBAAgB,gBAAgB,aAE/B;AAYD,wBAAgB,cAAc,CAAC,WAAW,CAAC,EAAE,MAAM,UAGlD;AAED,wBAAgB,UAAU,WAEzB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,UAE3C;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,UAE3C;AAED,wBAAgB,
|
1
|
+
{"version":3,"file":"k8s-constants.d.ts","sourceRoot":"","sources":["../../src/libs/k8s-constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,wBAAwB,6BAA6B,CAAA;AAoBlE,wBAAgB,gBAAgB,aAE/B;AAYD,wBAAgB,cAAc,CAAC,WAAW,CAAC,EAAE,MAAM,UAGlD;AAED,wBAAgB,UAAU,WAEzB;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,UAE3C;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,UAE3C;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,UAG5E;AAED,wBAAgB,qBAAqB,WAEpC;AAED,wBAAgB,yBAAyB,CACvC,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,UAOf;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,UAIlE;AAED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,UAE9C"}
|
@@ -42,19 +42,19 @@ export function imageDebugName(image) {
|
|
42
42
|
export function imageConfigMap(image) {
|
43
43
|
return `image-config-${image}`;
|
44
44
|
}
|
45
|
-
export function
|
45
|
+
export function containerRegistryImageName(image, monorepoEnv) {
|
46
46
|
validateEnv(monorepoEnv);
|
47
47
|
return `${getConst("project-name")}-${monorepoEnv}-${image}`;
|
48
48
|
}
|
49
49
|
export function containerRegistryPath() {
|
50
|
-
return [getConst("registry-base-url"), getConst("registry-
|
50
|
+
return [getConst("registry-base-url"), getConst("registry-image-path-prefix", { ignoreIfInvalid: true })].filter(Boolean).join("/");
|
51
51
|
}
|
52
52
|
export function containerRegistryRepoPath(image, monorepoEnv, gitSha) {
|
53
53
|
return [
|
54
54
|
getConst("registry-base-url"),
|
55
|
-
getConst("registry-
|
56
|
-
[
|
57
|
-
].join("/");
|
55
|
+
getConst("registry-image-path-prefix", { ignoreIfInvalid: true }),
|
56
|
+
[containerRegistryImageName(image, monorepoEnv), gitSha].join(":"),
|
57
|
+
].filter(Boolean).join("/");
|
58
58
|
}
|
59
59
|
export function domainNameForEnv(image, monorepoEnv) {
|
60
60
|
const imageData = getImageData(image);
|
package/dist/types/index.d.ts
CHANGED
@@ -3,28 +3,28 @@ export declare const SUPPORTED_LANGUAGES: readonly ["python", "node"];
|
|
3
3
|
export type SupportedLanguages = typeof SUPPORTED_LANGUAGES[number];
|
4
4
|
export declare const constFileSchema: z.ZodObject<{
|
5
5
|
"project-name": z.ZodString;
|
6
|
-
infra: z.ZodEnum<["hetzner", "digitalocean"]>;
|
7
|
-
"image-versions-to-keep": z.ZodNumber
|
6
|
+
infra: z.ZodEnum<["hetzner", "digitalocean", "gcloud"]>;
|
7
|
+
"image-versions-to-keep": z.ZodOptional<z.ZodNumber>;
|
8
8
|
"registry-base-url": z.ZodString;
|
9
|
-
"registry-
|
9
|
+
"registry-image-path-prefix": z.ZodOptional<z.ZodString>;
|
10
10
|
"extra-remote-environments": z.ZodArray<z.ZodString, "many">;
|
11
11
|
"extra-local-environments": z.ZodArray<z.ZodString, "many">;
|
12
12
|
}, "strip", z.ZodTypeAny, {
|
13
13
|
"project-name": string;
|
14
|
-
infra: "hetzner" | "digitalocean";
|
15
|
-
"image-versions-to-keep": number;
|
14
|
+
infra: "hetzner" | "digitalocean" | "gcloud";
|
16
15
|
"registry-base-url": string;
|
17
|
-
"registry-name": string;
|
18
16
|
"extra-remote-environments": string[];
|
19
17
|
"extra-local-environments": string[];
|
18
|
+
"image-versions-to-keep"?: number | undefined;
|
19
|
+
"registry-image-path-prefix"?: string | undefined;
|
20
20
|
}, {
|
21
21
|
"project-name": string;
|
22
|
-
infra: "hetzner" | "digitalocean";
|
23
|
-
"image-versions-to-keep": number;
|
22
|
+
infra: "hetzner" | "digitalocean" | "gcloud";
|
24
23
|
"registry-base-url": string;
|
25
|
-
"registry-name": string;
|
26
24
|
"extra-remote-environments": string[];
|
27
25
|
"extra-local-environments": string[];
|
26
|
+
"image-versions-to-keep"?: number | undefined;
|
27
|
+
"registry-image-path-prefix"?: string | undefined;
|
28
28
|
}>;
|
29
29
|
export type ConstFileSchema = z.infer<typeof constFileSchema>;
|
30
30
|
declare const singleTemplateSchema: z.ZodObject<{
|
package/dist/types/index.js
CHANGED
@@ -3,10 +3,10 @@ export const SUPPORTED_LANGUAGES = ["python", "node"];
|
|
3
3
|
// Config files
|
4
4
|
export const constFileSchema = z.object({
|
5
5
|
"project-name": z.string(),
|
6
|
-
"infra": z.enum(["hetzner", "digitalocean"]),
|
7
|
-
"image-versions-to-keep": z.number(),
|
6
|
+
"infra": z.enum(["hetzner", "digitalocean", "gcloud"]),
|
7
|
+
"image-versions-to-keep": z.number().optional(),
|
8
8
|
"registry-base-url": z.string(),
|
9
|
-
"registry-
|
9
|
+
"registry-image-path-prefix": z.string().optional(),
|
10
10
|
"extra-remote-environments": z.array(z.string()),
|
11
11
|
"extra-local-environments": z.array(z.string()),
|
12
12
|
});
|
package/package.json
CHANGED
package/src/cli/registry.ts
CHANGED
@@ -2,7 +2,7 @@ import { getConst, getImageData } from "../libs/config";
|
|
2
2
|
import { prune } from "../libs/digital-ocean/container-reg";
|
3
3
|
import {
|
4
4
|
containerRegistryPath,
|
5
|
-
|
5
|
+
containerRegistryImageName,
|
6
6
|
containerRegistryRepoPath,
|
7
7
|
} from "../libs/k8s-constants";
|
8
8
|
import { CLICommandParser, StrongParams, printUsageAndExit } from "./common";
|
@@ -49,7 +49,7 @@ const handlers = {
|
|
49
49
|
},
|
50
50
|
prune: (opts: StrongParams) => {
|
51
51
|
const regName = containerRegistryPath();
|
52
|
-
const repoName =
|
52
|
+
const repoName = containerRegistryImageName(
|
53
53
|
opts.required("image"),
|
54
54
|
opts.required("env")
|
55
55
|
);
|
@@ -51,13 +51,13 @@ export function imageConfigMap(image: string) {
|
|
51
51
|
return `image-config-${image}`;
|
52
52
|
}
|
53
53
|
|
54
|
-
export function
|
54
|
+
export function containerRegistryImageName(image: string, monorepoEnv: string) {
|
55
55
|
validateEnv(monorepoEnv);
|
56
56
|
return `${getConst("project-name")}-${monorepoEnv}-${image}`;
|
57
57
|
}
|
58
58
|
|
59
59
|
export function containerRegistryPath() {
|
60
|
-
return [getConst("registry-base-url"), getConst("registry-
|
60
|
+
return [getConst("registry-base-url"), getConst("registry-image-path-prefix", { ignoreIfInvalid: true })].filter(Boolean).join("/");
|
61
61
|
}
|
62
62
|
|
63
63
|
export function containerRegistryRepoPath(
|
@@ -67,9 +67,9 @@ export function containerRegistryRepoPath(
|
|
67
67
|
) {
|
68
68
|
return [
|
69
69
|
getConst("registry-base-url"),
|
70
|
-
getConst("registry-
|
71
|
-
[
|
72
|
-
].join("/");
|
70
|
+
getConst("registry-image-path-prefix", { ignoreIfInvalid: true }),
|
71
|
+
[containerRegistryImageName(image, monorepoEnv), gitSha].join(":"),
|
72
|
+
].filter(Boolean).join("/");
|
73
73
|
}
|
74
74
|
|
75
75
|
export function domainNameForEnv(image: string, monorepoEnv: string) {
|
@@ -8,7 +8,8 @@ infra: hetzner
|
|
8
8
|
image-versions-to-keep: 5
|
9
9
|
|
10
10
|
registry-base-url: registry.staging.com
|
11
|
-
|
11
|
+
# What comes before <image-name>:<tag>. Can be empty.
|
12
|
+
registry-image-path-prefix: changeme
|
12
13
|
|
13
14
|
# production and staging are supported by default
|
14
15
|
extra-remote-environments: []
|
package/src/types/index.ts
CHANGED
@@ -7,10 +7,10 @@ export type SupportedLanguages = typeof SUPPORTED_LANGUAGES[number];
|
|
7
7
|
|
8
8
|
export const constFileSchema = z.object({
|
9
9
|
"project-name": z.string(),
|
10
|
-
"infra": z.enum(["hetzner", "digitalocean"]),
|
11
|
-
"image-versions-to-keep": z.number(),
|
10
|
+
"infra": z.enum(["hetzner", "digitalocean", "gcloud"]),
|
11
|
+
"image-versions-to-keep": z.number().optional(),
|
12
12
|
"registry-base-url": z.string(),
|
13
|
-
"registry-
|
13
|
+
"registry-image-path-prefix": z.string().optional(),
|
14
14
|
"extra-remote-environments": z.array(z.string()),
|
15
15
|
"extra-local-environments": z.array(z.string()),
|
16
16
|
})
|