@vaharoni/devops 1.2.18 → 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.
@@ -9,7 +9,7 @@ import { z } from "zod";
9
9
  var SUPPORTED_LANGUAGES = ["python", "node"];
10
10
  var constFileSchema = z.object({
11
11
  "project-name": z.string(),
12
- "infra": z.enum(["hetzner", "digitalocean", "gcloud"]),
12
+ "registry-infra": z.enum(["digitalocean", "gcp", "harbor"]),
13
13
  "image-versions-to-keep": z.number().optional(),
14
14
  "registry-base-url": z.string(),
15
15
  "registry-image-path-prefix": z.string().optional(),
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getConst
3
- } from "./chunk-RZ46YYZZ.js";
3
+ } from "./chunk-HXGGJIAS.js";
4
4
 
5
5
  // src/app-support/crypto/aes.ts
6
6
  import crypto from "crypto";
@@ -2,7 +2,7 @@ import {
2
2
  getConst,
3
3
  getImageData,
4
4
  globEnvYamlFiles
5
- } from "./chunk-RZ46YYZZ.js";
5
+ } from "./chunk-HXGGJIAS.js";
6
6
 
7
7
  // src/cli/common.ts
8
8
  import chalk from "chalk";
package/dist/devops.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env bun
2
2
  import {
3
3
  InternalToken
4
- } from "./chunk-N7EX3HJH.js";
4
+ } from "./chunk-N2NFRGJO.js";
5
5
  import {
6
6
  CLICommandParser,
7
7
  CommandExecutor,
@@ -24,7 +24,7 @@ import {
24
24
  printUsageAndExit,
25
25
  secretName,
26
26
  upsertConfigMapCommand
27
- } from "./chunk-WKP7EQNU.js";
27
+ } from "./chunk-OFUEFG64.js";
28
28
  import {
29
29
  IGNORED_PATHS,
30
30
  __export,
@@ -36,7 +36,7 @@ import {
36
36
  getWorkspace,
37
37
  globEnvYamlFiles,
38
38
  workspaceDirectoryForLanguage
39
- } from "./chunk-RZ46YYZZ.js";
39
+ } from "./chunk-HXGGJIAS.js";
40
40
 
41
41
  // src/devops.ts
42
42
  import { globSync as globSync2 } from "glob";
@@ -1103,7 +1103,7 @@ var consoleCommand = { command: "console", oneLiner: oneLiner6, keyExamples: key
1103
1103
 
1104
1104
  // src/cli/core/constant.ts
1105
1105
  var oneLiner7 = "Prints to stdout a constant from constant.yaml";
1106
- var keyExamples7 = `$ devops constant infra`;
1106
+ var keyExamples7 = `$ devops constant registry-infra`;
1107
1107
  var usage7 = `
1108
1108
  ${oneLiner7}
1109
1109
 
@@ -1741,12 +1741,12 @@ async function createFiles() {
1741
1741
  }
1742
1742
  tc.enableSubtitution(".devops/config/images.yaml");
1743
1743
  tc.setMessageGenerator(".envrc", envrcMessage);
1744
- const gitIgnore = gitIgnoreContent(userChoices.infraVariant, userChoices.usePython);
1744
+ const gitIgnore = gitIgnoreContent(userChoices.infraPreset, userChoices.usePython);
1745
1745
  tc.addGeneratedFile(".gitignore", gitIgnore);
1746
1746
  tc.setMessageGenerator(".gitignore", gitignoreMessageGen(gitIgnore));
1747
- tc.addCopiedFolder(`infra-variants/${userChoices.infraVariant}`, ".");
1747
+ tc.addCopiedFolder(`infra-variants/${userChoices.infraPreset}`, ".");
1748
1748
  tc.enableSubtitution(".devops/config/constants.yaml");
1749
- if (userChoices.infraVariant === "hetzner") {
1749
+ if (userChoices.infraPreset === "hetzner") {
1750
1750
  tc.enableSubtitution(".devops/infra/hetzner/harbor-cert.yaml");
1751
1751
  tc.enableSubtitution(".devops/infra/hetzner/harbor-values.yaml");
1752
1752
  tc.enableSubtitution(".devops/infra/hetzner/hcloud-config.yaml");
@@ -1804,12 +1804,12 @@ function packageJsonMessage(usePrisma) {
1804
1804
  "applications/**"${prismaMessage}
1805
1805
  ],`)}`;
1806
1806
  }
1807
- function gitIgnoreContent(infraVariant, usePython) {
1807
+ function gitIgnoreContent(infraPreset, usePython) {
1808
1808
  const common = `**/.env*
1809
1809
  config/kubeconfig
1810
1810
  tmp/**
1811
1811
  !tmp/**/.gitkeep`;
1812
- const gcloud = infraVariant === "gcloud" ? "config/gke_gcloud_auth_plugin_cache" : null;
1812
+ const gcloud = infraPreset === "gcloud" ? "config/gke_gcloud_auth_plugin_cache" : null;
1813
1813
  const python = usePython ? `venv/
1814
1814
  **/__pycache__` : null;
1815
1815
  return [common, gcloud, python].filter(Boolean).join("\n");
@@ -1854,12 +1854,12 @@ function getUserChoices(projectName) {
1854
1854
  },
1855
1855
  {
1856
1856
  type: "list",
1857
- name: "infraVariant",
1858
- message: "Where does your cluster run?",
1857
+ name: "infraPreset",
1858
+ message: "Select your infrastructure preset:",
1859
1859
  choices: [
1860
- { name: "Google Cloud", value: "gcloud" },
1861
- { name: "Digital Ocean", value: "digitalocean" },
1862
- { name: "Hetzner", value: "hetzner" }
1860
+ { name: "Google Cloud (GKE + GCP Registry)", value: "gcloud" },
1861
+ { name: "Digital Ocean (DO K8s + DO Registry)", value: "digitalocean" },
1862
+ { name: "Hetzner (Hetzner K8s + Harbor)", value: "hetzner" }
1863
1863
  ]
1864
1864
  },
1865
1865
  {
@@ -1867,21 +1867,21 @@ function getUserChoices(projectName) {
1867
1867
  name: "gcloudProjectId",
1868
1868
  message: "Enter the GCP project ID (default: 'changeme')",
1869
1869
  default: "changeme",
1870
- when: (answers) => answers.infraVariant === "gcloud"
1870
+ when: (answers) => answers.infraPreset === "gcloud"
1871
1871
  },
1872
1872
  {
1873
1873
  type: "input",
1874
1874
  name: "registryImagePathPrefix",
1875
1875
  message: (answers) => `Enter your Digital Ocean container registry name (default: '${answers.projectName}')`,
1876
1876
  default: (answers) => answers.projectName,
1877
- when: (answers) => answers.infraVariant === "digitalocean"
1877
+ when: (answers) => answers.infraPreset === "digitalocean"
1878
1878
  },
1879
1879
  {
1880
1880
  type: "input",
1881
1881
  name: "registryBaseUrl",
1882
1882
  message: (answers) => `Enter your registry base URL (default: 'registry.${answers.stagingDomain}')`,
1883
1883
  default: (answers) => `registry.${answers.stagingDomain}`,
1884
- when: (answers) => answers.infraVariant === "hetzner"
1884
+ when: (answers) => answers.infraPreset === "hetzner"
1885
1885
  },
1886
1886
  {
1887
1887
  type: "confirm",
@@ -2069,8 +2069,8 @@ var job = { oneLiner: oneLiner11, keyExamples: keyExamples11, run: run11 };
2069
2069
 
2070
2070
  // src/libs/hetzner/reg-secret.ts
2071
2071
  function isApplicable() {
2072
- const infra = getConst("infra");
2073
- if (infra !== "hetzner") {
2072
+ const registryInfra = getConst("registry-infra");
2073
+ if (registryInfra !== "harbor") {
2074
2074
  console.warn(
2075
2075
  "Setting up registry permissions is only needed for Harbor in a Hetzner setup"
2076
2076
  );
@@ -2322,8 +2322,8 @@ function stargGarbageCollection(registryName) {
2322
2322
  new CommandExecutor(cmd).exec();
2323
2323
  }
2324
2324
  function prune(registryFullName, repoName, image2) {
2325
- const infra = getConst("infra");
2326
- if (infra !== "digitalocean") {
2325
+ const registryInfra = getConst("registry-infra");
2326
+ if (registryInfra !== "digitalocean") {
2327
2327
  console.warn(
2328
2328
  "Pruning is only supported for the DigitalOcean container registry"
2329
2329
  );
@@ -2375,7 +2375,7 @@ USAGE
2375
2375
  Prunes the repository of old images to enforce the "image-versions-to-keep" constant in config/constants.yaml:
2376
2376
  devops registry prune <image> --env <env>
2377
2377
 
2378
- This is only relevant when the "infra" constant is set to "digitalocean".
2378
+ This is only relevant when the "registry-infra" constant is set to "digitalocean".
2379
2379
 
2380
2380
  EXAMPLES
2381
2381
  ${keyExamples14}
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ declare const SUPPORTED_LANGUAGES: readonly ["python", "node"];
4
4
  type SupportedLanguages = typeof SUPPORTED_LANGUAGES[number];
5
5
  declare const constFileSchema: z.ZodObject<{
6
6
  "project-name": z.ZodString;
7
- infra: z.ZodEnum<["hetzner", "digitalocean", "gcloud"]>;
7
+ "registry-infra": z.ZodEnum<["digitalocean", "gcp", "harbor"]>;
8
8
  "image-versions-to-keep": z.ZodOptional<z.ZodNumber>;
9
9
  "registry-base-url": z.ZodString;
10
10
  "registry-image-path-prefix": z.ZodOptional<z.ZodString>;
@@ -14,7 +14,7 @@ declare const constFileSchema: z.ZodObject<{
14
14
  extensions: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
15
15
  }, "strip", z.ZodTypeAny, {
16
16
  "project-name": string;
17
- infra: "hetzner" | "digitalocean" | "gcloud";
17
+ "registry-infra": "digitalocean" | "gcp" | "harbor";
18
18
  "registry-base-url": string;
19
19
  "extra-remote-environments": string[];
20
20
  "extra-local-environments": string[];
@@ -24,7 +24,7 @@ declare const constFileSchema: z.ZodObject<{
24
24
  extensions?: string[] | undefined;
25
25
  }, {
26
26
  "project-name": string;
27
- infra: "hetzner" | "digitalocean" | "gcloud";
27
+ "registry-infra": "digitalocean" | "gcp" | "harbor";
28
28
  "registry-base-url": string;
29
29
  "extra-remote-environments": string[];
30
30
  "extra-local-environments": string[];
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  InternalToken,
3
3
  decryptAes256Gcm,
4
4
  encryptAes256Gcm
5
- } from "./chunk-N7EX3HJH.js";
5
+ } from "./chunk-N2NFRGJO.js";
6
6
  import {
7
7
  SUPPORTED_LANGUAGES,
8
8
  constFileSchema,
@@ -10,7 +10,7 @@ import {
10
10
  packageFileNodeSchema,
11
11
  packageFilePythonSchema,
12
12
  workspaces
13
- } from "./chunk-RZ46YYZZ.js";
13
+ } from "./chunk-HXGGJIAS.js";
14
14
 
15
15
  // src/app-support/discovery/dev-discovery-loader.ts
16
16
  var _portLookupByServiceName = null;
package/dist/plugins.js CHANGED
@@ -5,8 +5,8 @@ import {
5
5
  kubectlCommand,
6
6
  pkgRoot,
7
7
  printUsageAndExit
8
- } from "./chunk-WKP7EQNU.js";
9
- import "./chunk-RZ46YYZZ.js";
8
+ } from "./chunk-OFUEFG64.js";
9
+ import "./chunk-HXGGJIAS.js";
10
10
 
11
11
  // src/plugins.ts
12
12
  import path from "path";
@@ -1,8 +1,8 @@
1
1
  # These will be used when generating kubernetes entities
2
2
  project-name: $PROJECT_NAME
3
3
 
4
- # Supported: hetzner, digitalocean, or gcloud
5
- infra: digitalocean
4
+ # Registry infrastructure: digitalocean, gcp, or harbor
5
+ registry-infra: digitalocean
6
6
 
7
7
  # Only relevant for Digital Ocean. Determines the number of versions to keep for each docker image.
8
8
  image-versions-to-keep: 5
@@ -1,8 +1,8 @@
1
1
  # These will be used when generating kubernetes entities
2
2
  project-name: $PROJECT_NAME
3
3
 
4
- # Supported: hetzner, digitalocean, or gcloud
5
- infra: gcloud
4
+ # Registry infrastructure: digitalocean, gcp, or harbor
5
+ registry-infra: gcp
6
6
 
7
7
  registry-base-url: gcr.io
8
8
  # What comes before <image-name>:<tag>. Can be empty.
@@ -1,8 +1,8 @@
1
1
  # These will be used when generating kubernetes entities
2
2
  project-name: $PROJECT_NAME
3
3
 
4
- # Supported: hetzner, digitalocean, or gcloud
5
- infra: hetzner
4
+ # Registry infrastructure: digitalocean, gcp, or harbor
5
+ registry-infra: harbor
6
6
 
7
7
  # Only relevant for Digital Ocean. Determines the number of versions to keep for each docker image.
8
8
  image-versions-to-keep: 5
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vaharoni/devops",
3
3
  "type": "module",
4
- "version": "1.2.18",
4
+ "version": "1.3.0",
5
5
  "description": "Devops utility",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -2,7 +2,7 @@ import { getConst } from "../../libs/config";
2
2
  import { CLICommandParser, printUsageAndExit } from "../common";
3
3
 
4
4
  const oneLiner = "Prints to stdout a constant from constant.yaml";
5
- const keyExamples = `$ devops constant infra`;
5
+ const keyExamples = `$ devops constant registry-infra`;
6
6
 
7
7
  const usage = `
8
8
  ${oneLiner}
@@ -3,7 +3,6 @@ import { InitGenerator, type InitGeneratorFileInfo } from "../../libs/init-gener
3
3
  import { CLICommandParser, printUsageAndExit } from "../common";
4
4
  import chalk from "chalk";
5
5
  import fs from 'fs-extra';
6
- import type { ConstFileSchema } from "../../types";
7
6
 
8
7
  const oneLiner =
9
8
  "Initializes the devops utility by copying template files to the current folder";
@@ -40,14 +39,14 @@ async function createFiles() {
40
39
  tc.setMessageGenerator(".envrc", envrcMessage);
41
40
 
42
41
  // gitignore
43
- const gitIgnore = gitIgnoreContent(userChoices.infraVariant, userChoices.usePython)
42
+ const gitIgnore = gitIgnoreContent(userChoices.infraPreset, userChoices.usePython)
44
43
  tc.addGeneratedFile(".gitignore", gitIgnore);
45
44
  tc.setMessageGenerator(".gitignore", gitignoreMessageGen(gitIgnore));
46
45
 
47
46
  // Infra variants
48
- tc.addCopiedFolder(`infra-variants/${userChoices.infraVariant}`, ".");
47
+ tc.addCopiedFolder(`infra-variants/${userChoices.infraPreset}`, ".");
49
48
  tc.enableSubtitution(".devops/config/constants.yaml");
50
- if (userChoices.infraVariant === "hetzner") {
49
+ if (userChoices.infraPreset === "hetzner") {
51
50
  tc.enableSubtitution(".devops/infra/hetzner/harbor-cert.yaml");
52
51
  tc.enableSubtitution(".devops/infra/hetzner/harbor-values.yaml");
53
52
  tc.enableSubtitution(".devops/infra/hetzner/hcloud-config.yaml");
@@ -119,13 +118,13 @@ function packageJsonMessage(usePrisma: boolean) {
119
118
  ],`)}`
120
119
  }
121
120
 
122
- function gitIgnoreContent(infraVariant: UserChoices["infraVariant"], usePython: boolean) {
121
+ function gitIgnoreContent(infraPreset: InfraPreset, usePython: boolean) {
123
122
  const common = `**/.env*
124
123
  config/kubeconfig
125
124
  tmp/**
126
125
  !tmp/**/.gitkeep`;
127
126
 
128
- const gcloud = infraVariant === 'gcloud'
127
+ const gcloud = infraPreset === 'gcloud'
129
128
  ? 'config/gke_gcloud_auth_plugin_cache'
130
129
  : null;
131
130
 
@@ -156,11 +155,13 @@ ${chalk.yellow(content)}`;
156
155
  }
157
156
  }
158
157
 
158
+ type InfraPreset = "gcloud" | "digitalocean" | "hetzner";
159
+
159
160
  type UserChoices = {
160
161
  projectName: string;
161
162
  stagingDomain: string;
162
163
  productionDomain: string;
163
- infraVariant: ConstFileSchema["infra"];
164
+ infraPreset: InfraPreset;
164
165
  gcloudProjectId?: string;
165
166
  registryImagePathPrefix?: string;
166
167
  registryBaseUrl?: string;
@@ -193,12 +194,12 @@ function getUserChoices(projectName: string | undefined): Promise<UserChoices> {
193
194
  },
194
195
  {
195
196
  type: "list",
196
- name: "infraVariant",
197
- message: "Where does your cluster run?",
197
+ name: "infraPreset",
198
+ message: "Select your infrastructure preset:",
198
199
  choices: [
199
- { name: "Google Cloud", value: "gcloud" },
200
- { name: "Digital Ocean", value: "digitalocean" },
201
- { name: "Hetzner", value: "hetzner" },
200
+ { name: "Google Cloud (GKE + GCP Registry)", value: "gcloud" },
201
+ { name: "Digital Ocean (DO K8s + DO Registry)", value: "digitalocean" },
202
+ { name: "Hetzner (Hetzner K8s + Harbor)", value: "hetzner" },
202
203
  ],
203
204
  },
204
205
  {
@@ -206,21 +207,21 @@ function getUserChoices(projectName: string | undefined): Promise<UserChoices> {
206
207
  name: "gcloudProjectId",
207
208
  message: "Enter the GCP project ID (default: 'changeme')",
208
209
  default: "changeme",
209
- when: (answers) => answers.infraVariant === "gcloud",
210
+ when: (answers) => answers.infraPreset === "gcloud",
210
211
  },
211
212
  {
212
213
  type: "input",
213
214
  name: "registryImagePathPrefix",
214
215
  message: (answers) => `Enter your Digital Ocean container registry name (default: '${answers.projectName}')`,
215
216
  default: (answers) => answers.projectName,
216
- when: (answers) => answers.infraVariant === "digitalocean",
217
+ when: (answers) => answers.infraPreset === "digitalocean",
217
218
  },
218
219
  {
219
220
  type: "input",
220
221
  name: "registryBaseUrl",
221
222
  message: (answers) => `Enter your registry base URL (default: 'registry.${answers.stagingDomain}')`,
222
223
  default: (answers) => `registry.${answers.stagingDomain}`,
223
- when: (answers) => answers.infraVariant === "hetzner",
224
+ when: (answers) => answers.infraPreset === "hetzner",
224
225
  },
225
226
  {
226
227
  type: "confirm",
@@ -35,7 +35,7 @@ USAGE
35
35
  Prunes the repository of old images to enforce the "image-versions-to-keep" constant in config/constants.yaml:
36
36
  devops registry prune <image> --env <env>
37
37
 
38
- This is only relevant when the "infra" constant is set to "digitalocean".
38
+ This is only relevant when the "registry-infra" constant is set to "digitalocean".
39
39
 
40
40
  EXAMPLES
41
41
  ${keyExamples}
@@ -63,8 +63,8 @@ export function prune(
63
63
  repoName: string,
64
64
  image: string
65
65
  ) {
66
- const infra = getConst("infra");
67
- if (infra !== "digitalocean") {
66
+ const registryInfra = getConst("registry-infra");
67
+ if (registryInfra !== "digitalocean") {
68
68
  console.warn(
69
69
  "Pruning is only supported for the DigitalOcean container registry"
70
70
  );
@@ -4,8 +4,8 @@ import { envToNamespace } from "../k8s-constants";
4
4
  import { kubectlCommand } from "../k8s-helpers";
5
5
 
6
6
  function isApplicable() {
7
- const infra = getConst("infra");
8
- if (infra !== "hetzner") {
7
+ const registryInfra = getConst("registry-infra");
8
+ if (registryInfra !== "harbor") {
9
9
  console.warn(
10
10
  "Setting up registry permissions is only needed for Harbor in a Hetzner setup"
11
11
  );
@@ -1,8 +1,8 @@
1
1
  # These will be used when generating kubernetes entities
2
2
  project-name: $PROJECT_NAME
3
3
 
4
- # Supported: hetzner, digitalocean, or gcloud
5
- infra: digitalocean
4
+ # Registry infrastructure: digitalocean, gcp, or harbor
5
+ registry-infra: digitalocean
6
6
 
7
7
  # Only relevant for Digital Ocean. Determines the number of versions to keep for each docker image.
8
8
  image-versions-to-keep: 5
@@ -1,8 +1,8 @@
1
1
  # These will be used when generating kubernetes entities
2
2
  project-name: $PROJECT_NAME
3
3
 
4
- # Supported: hetzner, digitalocean, or gcloud
5
- infra: gcloud
4
+ # Registry infrastructure: digitalocean, gcp, or harbor
5
+ registry-infra: gcp
6
6
 
7
7
  registry-base-url: gcr.io
8
8
  # What comes before <image-name>:<tag>. Can be empty.
@@ -1,8 +1,8 @@
1
1
  # These will be used when generating kubernetes entities
2
2
  project-name: $PROJECT_NAME
3
3
 
4
- # Supported: hetzner, digitalocean, or gcloud
5
- infra: hetzner
4
+ # Registry infrastructure: digitalocean, gcp, or harbor
5
+ registry-infra: harbor
6
6
 
7
7
  # Only relevant for Digital Ocean. Determines the number of versions to keep for each docker image.
8
8
  image-versions-to-keep: 5
@@ -7,7 +7,7 @@ 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", "gcloud"]),
10
+ "registry-infra": z.enum(["digitalocean", "gcp", "harbor"]),
11
11
  "image-versions-to-keep": z.number().optional(),
12
12
  "registry-base-url": z.string(),
13
13
  "registry-image-path-prefix": z.string().optional(),