@leverege/build-tools 2.100.1-quinn.2 → 2.101.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.
Files changed (65) hide show
  1. package/.vscode/launch.json +20 -0
  2. package/README.md +318 -44
  3. package/package.json +6 -4
  4. package/src/Docker.mjs +12 -6
  5. package/src/Utils.mjs +18 -14
  6. package/src/bash-funcs +0 -22
  7. package/src/circle-orb-it/circle-orb-it.mjs +1 -1
  8. package/src/circle-orb-it/circle-orb.yml +1 -1
  9. package/src/docker-to-registry.mjs +19 -29
  10. package/src/helm-charts/cnpg-db-psql-stack/helmup.bootstrap +1 -0
  11. package/src/helm-charts/cnpg-db-psql-stack/helmup.plugin +6 -2
  12. package/src/helm-charts/cnpg-db-tsdb-basic/helmup.bootstrap +1 -0
  13. package/src/helm-charts/cnpg-db-tsdb-basic/helmup.plugin +6 -2
  14. package/src/helm-charts/cnpg-db-tsdb-dense/helmup.bootstrap +2 -0
  15. package/src/helm-charts/cnpg-db-tsdb-dense/helmup.plugin +6 -2
  16. package/src/helm-charts/cnpg-operator/operand.bootstrap +41 -35
  17. package/src/helm-charts/eso/.nohelm +0 -0
  18. package/src/helm-charts/eso/helmup.bootstrap +0 -2
  19. package/src/helm-charts/prom-operator/helmup.bootstrap +45 -0
  20. package/src/helm-charts/prom-operator/prometheus-stack.yaml.ovh +11 -0
  21. package/src/helm-charts/prom-operator/rules/kubestate-rules.yaml +3 -5
  22. package/src/helmup.sh +6 -1
  23. package/src/init-my-chart/Chart.yaml.hbs +1 -1
  24. package/src/init-my-chart/leaf-chart-templates/values.schema.json +26 -9
  25. package/src/refresh-npm-token.mjs +7 -6
  26. package/src/service-man/config/secrets/README.md +187 -0
  27. package/src/service-man/config/secrets/authz-jwt.json +9 -2
  28. package/src/service-man/config/secrets/jwt-secret.json +13 -0
  29. package/src/service-man/config/secrets/jwt-service-secret.json +13 -0
  30. package/src/service-man/config/secrets/mail-gun-leverege.json +13 -0
  31. package/src/service-man/config/secrets/oidc-client-secret.json +9 -2
  32. package/src/service-man/config/secrets/pg-password.json +13 -0
  33. package/src/service-man/config/secrets/session-secret.json +9 -2
  34. package/src/service-man/config/secrets/tsdb-password.json +13 -0
  35. package/src/service-man/config/secrets/twilio-leverege.json +13 -0
  36. package/src/service-man/gcloud-k8s/SecretsManager.mjs +113 -75
  37. package/leverege-build-tools-2.21.13.tgz +0 -0
  38. package/lib/server/build-tools.js +0 -138
  39. package/lib/server/firebaseDeploy.js +0 -195
  40. package/lib/server/firebaseServe.js +0 -116
  41. package/lib/server/getfbcfg.js +0 -25
  42. package/lib/server/getjson.js +0 -70
  43. package/lib/server/overwhelm.js +0 -447
  44. package/lib/server/push-my-chart.js +0 -18
  45. package/lib/server/refresh-npm-token.js +0 -135
  46. package/lib/server/tag-release.js +0 -681
  47. package/lib/server/unleash.js +0 -50
  48. package/lib/web/build-tools.js +0 -138
  49. package/lib/web/firebaseDeploy.js +0 -195
  50. package/lib/web/firebaseServe.js +0 -116
  51. package/lib/web/getfbcfg.js +0 -25
  52. package/lib/web/getjson.js +0 -70
  53. package/lib/web/overwhelm.js +0 -447
  54. package/lib/web/push-my-chart.js +0 -18
  55. package/lib/web/refresh-npm-token.js +0 -135
  56. package/lib/web/tag-release.js +0 -681
  57. package/lib/web/unleash.js +0 -50
  58. package/src/DockerPy.mjs +0 -266
  59. package/src/service-man/config/secrets/authz-postgres.json +0 -7
  60. package/src/service-man/config/secrets/db-timescale-dense.json +0 -8
  61. package/src/service-man/config/secrets/jwt-options.json +0 -7
  62. package/src/service-man/config/secrets/mail-gun-api-key.json +0 -6
  63. package/src/service-man/config/secrets/npmrc.json +0 -6
  64. package/src/service-man/config/secrets/postgresql-password.json +0 -8
  65. package/src/service-man/config/secrets/twilio.json +0 -8
@@ -18,6 +18,26 @@
18
18
  },
19
19
  "outputCapture": "std"
20
20
  },
21
+ {
22
+ "name": "docker-to-registry pubsub-pulse",
23
+ "type": "node",
24
+ "request": "launch",
25
+ "program": "${workspaceFolder}/src/docker-to-registry.mjs",
26
+ "args": ["v4.2.1-debug.1"],
27
+ "cwd": "/Users/john/Work/leverege/cicd/@srv/pubsub-pulse",
28
+ "runtimeExecutable": "node",
29
+ "console": "integratedTerminal"
30
+ },
31
+ {
32
+ "name": "docker-to-registry pitcrew-vision",
33
+ "type": "node",
34
+ "request": "launch",
35
+ "program": "${workspaceFolder}/src/docker-to-registry.mjs",
36
+ "args": ["v1.9.13-john.1"],
37
+ "cwd": "/Users/john/Work/leverege/cicd/@pit/pitcrew-vision-logic-server",
38
+ "runtimeExecutable": "node",
39
+ "console": "integratedTerminal"
40
+ },
21
41
  {
22
42
  "name": "overwhelm tst-dense",
23
43
  "type": "node",
package/README.md CHANGED
@@ -1,79 +1,353 @@
1
1
  # Leverege Build Tools
2
2
 
3
- A collection of build / support tools for all Leverege code.
3
+ A collection of build, deployment, and infrastructure tools for the Leverege platform.
4
4
 
5
5
  ## Installing
6
6
 
7
- Install build-tools
7
+ ```bash
8
+ npm install -g @leverege/build-tools
9
+ ```
10
+
11
+ ## Prerequisites
12
+
13
+ Most tools assume the following are installed and configured:
14
+
15
+ - `gcloud` (authenticated, with appropriate project access)
16
+ - `kubectl` (with a valid cluster context)
17
+ - `helm` (v3+)
18
+ - `fzf` (for interactive pod selection in `k8x` and `klog`)
19
+ - Node.js 22+
20
+
21
+ ---
22
+
23
+ ## Tools
8
24
 
25
+ ### Core
26
+
27
+ **`build-tools`** — Utility for locating the build-tools installation and exposing shared bash functions.
28
+ ```bash
29
+ build-tools --bashfun # output path to bash-funcs for sourcing
30
+ build-tools --reporoot # print the repo root path
31
+ build-tools --version # print installed version
9
32
  ```
10
- npm install -g @leverege/build-tools
33
+
34
+ **`bash-funcs`** — Shared bash function library. Source it in any shell script:
35
+ ```bash
36
+ . `build-tools --bashfun`
37
+ ```
38
+ Provides: `color()`, `errorExit()`, `warnOnError()`, `exitOnError()`, `generatePassword()`,
39
+ `showInstalling()`, `bindWorkloadIdentity()`, `createNamespaceIfNeeded()`, `waitForSA()`,
40
+ `waitForIAM()`, `ifPluggedIn()`, and more.
41
+
42
+ ---
43
+
44
+ ### Helm & Kubernetes Deployment
45
+
46
+ **`helmup`** — Context-safe Helm deployment tool. Installs or upgrades one or more services.
47
+ ```bash
48
+ helmup <service> [service...] # deploy one or more services
49
+ helmup platform # deploy all platform services
50
+ helmup system # deploy all system services
51
+ ```
52
+ Aliases: `helmboot` (rerun bootstrap), `helmcycle` (down then up), `helminit` (clean reinstall),
53
+ `helmwhat` (dry run). Handles workload identity binding, namespace creation, SA creation via
54
+ service-man, and GCS bucket setup automatically.
55
+
56
+ **`helmdn`** — Uninstalls Helm releases. Requires confirmation before proceeding.
57
+ ```bash
58
+ helmdn <service> [service...]
59
+ ```
60
+
61
+ **`overwhelm`** — Kubernetes context validator and YAML template processor. The configuration
62
+ backbone of helmup — replaces `${VARIABLE}` placeholders in `.ovh` files, validates the active
63
+ k8s context, and generates `values.yaml` files.
64
+ ```bash
65
+ overwhelm --genvals # generate values.yaml from values-local.yaml
66
+ overwhelm --context # print the current k8s context
67
+ ```
68
+
69
+ **`helm-audit`** — Displays all deployed Helm releases with chart versions, app versions,
70
+ and deployed image tags. Highlights version mismatches.
71
+ ```bash
72
+ helm-audit
73
+ ```
74
+
75
+ **`chart-compass`** — Locates Helm charts in GCP Artifact Registry for use by helmup.
76
+ ```bash
77
+ chart-compass --service <name>
78
+ chart-compass --init # generate chart-compass.yaml
79
+ ```
80
+
81
+ **`init-my-chart`** — Initializes a new Helm chart from Leverege leaf chart templates,
82
+ or upgrades an existing chart to the current template structure.
83
+ ```bash
84
+ init-my-chart [--dry-run] [--debug]
85
+ ```
86
+
87
+ **`chart-to-registry`** — Pushes Helm charts to GCP Artifact Registry with version
88
+ checking and dependency resolution.
89
+ ```bash
90
+ chart-to-registry --chart <dir> [--project <id>] [--repository <name>] [--force] [--dry-run]
91
+ ```
92
+
93
+ **`push-my-chart`** — Publishes Helm charts to both GCS Chartmuseum (legacy) and
94
+ GCP Artifact Registry.
95
+ ```bash
96
+ push-my-chart [--chart <dir>] [--no-registry]
97
+ ```
98
+
99
+ ---
100
+
101
+ ### Service & Infrastructure Management
102
+
103
+ **`service-man`** — Manages GCP service accounts, IAM roles, and secrets for Kubernetes
104
+ cluster bootstrapping. Runs during `helmup` for each service, and standalone for initial
105
+ cluster setup.
106
+ ```bash
107
+ service-man --create-service <name> # create SA, IAM roles, and k8s SA
108
+ service-man --setup-secrets # write all secrets to GCP Secret Manager
109
+ # and apply ESO ExternalSecrets
110
+ service-man --setup-roles # bind IAM roles
111
+ service-man --fetch-versions # display deployed service versions
112
+ service-man --sync-secrets <sm>=<k8s> # sync SM secret to k8s (legacy)
11
113
  ```
114
+ Secrets are defined as JSON files in `src/service-man/config/secrets/`. See the
115
+ [Secrets README](src/service-man/config/secrets/README.md) for the full format reference.
12
116
 
13
- ## Tool Descriptions
117
+ ---
14
118
 
15
- ### General Tools:
16
- * **build-tools**: a command to get the root of this repo, a latest version check, or bash functions to source
17
- * **bash-funcs**: handy set of commonly used bash function that can be sourced by adding this to a script:
119
+ ### Docker Image Management
120
+
121
+ **`docker-to-registry`** Builds and pushes Docker images (Node.js/general) to GCP
122
+ Artifact Registry with git tagging.
18
123
  ```bash
19
- . `build-tools --bashfun`
124
+ docker-to-registry <version> # e.g. docker-to-registry v1.2.3
125
+ docker-to-registry latest # beta build — any non-semver version skips git tagging
126
+ docker-to-registry v1.2.3 --dry-run # skip confirmation prompt
127
+ docker-to-registry guide-me # print helm/registry migration guidance
20
128
  ```
21
- * **docker-to-registry**: used to build and deploy application docker images to the GCP artifact registry
22
- * **pull-artifact**: used to pull generic artifacts from the GCP artifact registry
129
+
130
+ **`build-cnpg-image`** Builds a custom CloudNative PostgreSQL image with jsquery and
131
+ timescaledb extensions using GCP Cloud Build.
23
132
  ```bash
24
- Usage: pull-artifact -f <artifact schema file path> -n <package name> -v <package version>
133
+ build-cnpg-image <sub-tag> [--pg-version <version>]
134
+ # e.g. build-cnpg-image final --pg-version 17.6
25
135
  ```
26
- * **push-artifact**: used to push generic artifacts to the GCP artifact registry
136
+
137
+ ---
138
+
139
+ ### Database & Snapshot Management
140
+
141
+ **`snapshot-cnpg`** — Creates a volumeSnapshot backup of a CNPG cluster.
27
142
  ```bash
28
- Usage: push-artifact -f <artifact schema file path> -n <package name> -v <package version>
143
+ snapshot-cnpg <cluster-name>
29
144
  ```
30
145
 
31
- ### Helm Helpers:
32
- * **overwhelm**: a k8s context helper and yaml replacer *${REPLACE_ME}*
33
- * **helmup**: a context safe helm deployment tool
34
- * **helmdn**: a destroyer of helm deployments (danger zone)
35
- * **helm-audit** : fetch and display deployed service chart and application versions
146
+ **`clone-cnpg-from-snapshot`** Clones a CNPG database cluster from a snapshot,
147
+ optionally across GCP projects or regions. Generates YAML and scripts; requires
148
+ `--execute` for real operations.
149
+ ```bash
150
+ clone-cnpg-from-snapshot \
151
+ --snapshot <name> \
152
+ --source-project <proj> \
153
+ --dest-project <proj> \
154
+ --dest-region <region> \
155
+ [--execute] [--dry-run] [--cleanup]
156
+ ```
36
157
 
37
- ### Kubernetes Helpers:
38
- * **k8x**: a script to help run commands on active pods in a k8s cluster
158
+ **`gcp-snapshots`** Lists or deletes old GCP VM/disk snapshots.
39
159
  ```bash
40
- Usage: k8x [target] where target can be one of the following or omitted for bash
41
- cnpg - run bash on a cloudnative-pg cluster node
42
- es8 - run bash on an elasticsearch8 node
43
- grafana - run bash on grafana in prometheus operator namespace
44
- grafold - run bash on grafana in legacy monitor namespace
45
- prometheus - run bash on prometheus operator server
46
- psql - run psql on a legacy database node
47
- redis - run redis-cli on a redis master/replica
48
- valkey - run valkey-cli on a valkeymaster/replica
160
+ gcp-snapshots --project <id> [--age <days>] [--list|--delete]
161
+ # default age threshold: 180 days
162
+ ```
49
163
 
50
- help - this right here
164
+ ---
165
+
166
+ ### Kubernetes Utilities
167
+
168
+ **`k8x`** — Opens an interactive shell (or specific CLI) on a running pod, with fuzzy
169
+ finder support for pod selection. Requires `fzf`.
170
+ ```bash
171
+ k8x # open bash on any pod (fuzzy select)
172
+ k8x cnpg # bash on a cnpg cluster node
173
+ k8x es8 # bash on an elasticsearch8 node
174
+ k8x grafana # bash on grafana
175
+ k8x prometheus # bash on prometheus
176
+ k8x redis # redis-cli on redis master
177
+ k8x valkey # valkey-cli on valkey master
51
178
  ```
52
- * **k8scale**: a script for scaling deployed services
179
+
180
+ **`k8scale`** — Scales Kubernetes deployments or performs rolling restarts.
53
181
  ```bash
54
- Usage: k8scale <up|dn|down|roll> [services]
55
- dn|down - scales a service to zero pods
56
- up - allows service to scale up to minReplicas
57
- roll - performs a rolling restart of pods in a service
182
+ k8scale up [services] # scale up to minReplicas
183
+ k8scale dn [services] # scale down to zero
184
+ k8scale roll [services] # rolling restart
58
185
  ```
59
- * **klog**: tails the logs of the specified service
60
186
 
187
+ **`klog`** — Streams logs from a pod with pino-pretty formatting. Saves to a timestamped
188
+ log file. Requires `fzf` for interactive selection.
189
+ ```bash
190
+ klog # fuzzy-select pod and stream logs
191
+ klog <app-name> # stream logs for named app
192
+ klog <app-name> <ns> # specify namespace
193
+ ```
61
194
 
62
- ### Git Helpers:
63
- * **git-tar**: a git safety net which is described [here on github](https://github.com/jphelps413/git-tar)
64
- * **dirty-git**: feed it a list of directories and it will show which are locally modified or stashed.
65
- * **prune-git**: performs maintenance on a list of git repositories.
66
- * **pull-git**: walks a list of git repos, pulling each if they are clean.
195
+ ---
67
196
 
68
- ### Troubleshooting:
197
+ ### Artifact Management
69
198
 
70
- For additional debug level logging, set the environment variable `BUILD_TOOLS_DEBUG=1` before running the tool.
199
+ **`pull-artifact`** Pulls generic artifacts from GCP Artifact Registry based on an
200
+ `artifacts.yaml` spec file.
201
+ ```bash
202
+ pull-artifact [-f <spec-file>] [-n <name>] [-v <version>]
203
+ ```
71
204
 
72
- Example:
205
+ **`push-artifact`** — Pushes generic artifacts to GCP Artifact Registry.
206
+ ```bash
207
+ push-artifact [-f <spec-file>] [-n <name>] [-v <version>]
208
+ ```
209
+
210
+ ---
211
+
212
+ ### Package & Release Management
213
+
214
+ **`hook-and-release`** — Manages git pre-commit hooks and version consistency for npm
215
+ package releases. Runs automatically as the npm `prepare` lifecycle hook.
216
+
217
+ **`prepack`** — Pre-publication build step that compiles code and creates git tags.
218
+ ```bash
219
+ prepack [--compile] [--manual-tag] [--force-tag] [--push-tag]
220
+ ```
221
+
222
+ **`refresh-npm-token`** — Refreshes the Leverege npm registry token from GCP Secret
223
+ Manager, updating `.npmrc` / `.yarnrc.yml`. Skips refresh if the token is less than
224
+ 24 hours old.
225
+ ```bash
226
+ refresh-npm-token [--project <id>] [--force] [--dry-run]
227
+ ```
228
+
229
+ **`pkgck`** — Checks for common package configuration issues (babel, eslint, circleci,
230
+ dockerfile, etc.) with visual pass/fail indicators.
231
+ ```bash
232
+ pkgck
233
+ ```
234
+
235
+ **`pkglint`** — Verifies required documentation files (README.md, LICENSE.md) are
236
+ present before publishing.
237
+ ```bash
238
+ pkglint
239
+ ```
240
+
241
+ **`generate-docs`** — Generates JSDoc API documentation from source files.
242
+ ```bash
243
+ generate-docs
244
+ ```
245
+
246
+ **`count-lines-of-code`** — Counts lines of code in a project or monorepo workspaces.
247
+ ```bash
248
+ count-lines-of-code [--src-only]
249
+ ```
250
+
251
+ ---
252
+
253
+ ### CI/CD Integration
254
+
255
+ **`circle-orb-it`** — Installs or updates CircleCI configuration (Leverege orb) and
256
+ GitHub Dependabot settings for a repository. Preserves existing customizations.
257
+ ```bash
258
+ circle-orb-it [--dry-run] [--debug]
259
+ ```
260
+
261
+ **`send-to-slack`** — Sends messages to a Slack channel, retrieving the webhook URL
262
+ from GCP Secret Manager.
263
+ ```bash
264
+ send-to-slack --project <id> --config <secret-name> --message <text> [--dry-run]
265
+ ```
266
+
267
+ ---
268
+
269
+ ### Git Utilities
270
+
271
+ **`dirty-git`** — Shows the status of multiple git repositories (clean/dirty/stashed/unpushed).
272
+ ```bash
273
+ dirty-git <dir1> [dir2] ...
274
+ ```
275
+
276
+ **`prune-git`** — Garbage-collects and prunes remote branch references in clean repositories.
277
+ ```bash
278
+ prune-git <dir1> [dir2] ...
279
+ ```
280
+
281
+ **`pull-git`** — Pulls latest changes in clean repositories, skipping dirty ones.
282
+ ```bash
283
+ pull-git <dir1> [dir2] ...
284
+ ```
285
+
286
+ **`git-tar`** — Creates a tarball of a git repository with exclusion list support.
287
+ ```bash
288
+ git-tar # run from within the repository
289
+ ```
290
+
291
+ ---
292
+
293
+ ### Secrets & Encryption
294
+
295
+ **`encrypt-secrets`** — Encrypts `.env` and `secrets/` directory using GCP KMS.
296
+ ```bash
297
+ encrypt-secrets
298
+ ```
299
+
300
+ **`decrypt-secrets`** — Decrypts KMS-encrypted files, restoring `.env` and `secrets/`.
301
+ ```bash
302
+ decrypt-secrets
303
+ ```
304
+
305
+ ---
306
+
307
+ ### Helm Charts
308
+
309
+ The `src/helm-charts/` directory contains bootstrapped chart configurations for all
310
+ platform, auxiliary, and system services. Each chart directory may contain:
311
+
312
+ - `helmup.bootstrap` — one-time setup script run on first deploy (SA creation, IAM, secrets)
313
+ - `helmup.plugin` — helm install/upgrade logic
314
+ - `helmdn.plugin` — teardown logic
315
+ - `*.yaml.ovh` — overwhelm-processed Kubernetes manifests
316
+ - `values-*.yaml` — helm values overrides
317
+
318
+ **Platform services:** api-server, authz-server, db-curator, emailer, imagine,
319
+ message-processor, messenger, reason, resource-server, rule-engine, scheduler,
320
+ transponders (bq/dh/rt/tsdb)
321
+
322
+ **Auxiliary services:** argocd, fota-server, geotile-server, pgbouncer, pubsub-pulse,
323
+ push-notifier, pusher, vin-decoder-server
324
+
325
+ **System services:** cnpg-operator, cnpg-db-psql-stack, cnpg-db-tsdb-basic,
326
+ cnpg-db-tsdb-dense, elasticsearch8, eso, prom-operator, traefik, valkey, velero, pg-repack
327
+
328
+ ---
329
+
330
+ ## Configuration
331
+
332
+ For additional debug logging, set `BUILD_TOOLS_DEBUG=1`:
73
333
  ```bash
74
334
  BUILD_TOOLS_DEBUG=1 docker-to-registry
75
335
  ```
76
336
 
337
+ ---
338
+
339
+ ## Deprecated Tools
340
+
341
+ | Tool | Replacement |
342
+ |------|-------------|
343
+ | `docker-to-registry-py` | `docker-to-registry` |
344
+ | `chart-to-museum` | `push-my-chart` |
345
+ | `refresh-py-idx` | No longer needed |
346
+ | `k8cryo` | `snapshot-cnpg` / `clone-cnpg-from-snapshot` |
347
+ | `reflector` (helm) | ESO ExternalSecrets |
348
+
349
+ ---
350
+
77
351
  ## Authors
78
352
 
79
353
  * **DevOps and Friends**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.100.1-quinn.2",
3
+ "version": "2.101.1",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -16,6 +16,7 @@
16
16
  "prepack": "npm exec prepack"
17
17
  },
18
18
  "bin": {
19
+ "build-and-push": "src/build-and-push.sh",
19
20
  "build-cnpg-image": "src/build-cnpg-image.mjs",
20
21
  "build-tools": "src/build-tools.mjs",
21
22
  "change-up": "src/change-up.sh",
@@ -29,6 +30,7 @@
29
30
  "dirty-git": "src/dirty-git.sh",
30
31
  "docker-to-registry": "src/docker-to-registry.mjs",
31
32
  "docker-to-registry-py": "src/docker-to-registry-py.mjs",
33
+ "docker-to-registry.sh": "src/docker-to-registry.sh",
32
34
  "dockreate": "src/dockreate.sh",
33
35
  "encrypt-secrets": "src/encrypt-secrets.sh",
34
36
  "firebaseDeploy": "src/firebaseDeploy.mjs",
@@ -46,7 +48,7 @@
46
48
  "helmup": "src/helmup.sh",
47
49
  "helmwhat": "src/helmup.sh",
48
50
  "hook-and-release": "src/hook-and-release.mjs",
49
- "init-my-chart": "src/init-my-chart.mjs",
51
+ "init-my-chart": "src/init-my-chart/init-my-chart.mjs",
50
52
  "k8scale": "src/k8scale.sh",
51
53
  "k8x": "src/k8x.sh",
52
54
  "klog": "src/klog.sh",
@@ -92,7 +94,7 @@
92
94
  "googleapis": "^171.4.0",
93
95
  "handlebars": "^4.7.9",
94
96
  "ignore": "^7.0.5",
95
- "inquirer": "^13.3.2",
97
+ "inquirer": "^13.4.1",
96
98
  "js-yaml": "^4.1.1",
97
99
  "jsdoc": "^4.0.5",
98
100
  "ms": "^2.1.3",
@@ -103,7 +105,7 @@
103
105
  "readline-sync": "^1.4.10",
104
106
  "semver": "^7.7.4",
105
107
  "shell-quote": "^1.8.3",
106
- "simple-git": "^3.33.0",
108
+ "simple-git": "^3.36.0",
107
109
  "sloc": "^0.3.2",
108
110
  "superstruct": "^2.0.2",
109
111
  "tmp": "^0.2.5",
package/src/Docker.mjs CHANGED
@@ -9,6 +9,7 @@ import handlebars from 'handlebars'
9
9
  import {
10
10
  errorExit,
11
11
  getCleanTag,
12
+ getDateTimestamp,
12
13
  getGcpAccount,
13
14
  log,
14
15
  proceed,
@@ -25,7 +26,7 @@ const DIRNAME = path.dirname( url.fileURLToPath( import.meta.url ) )
25
26
  // See the latest docker images here => https://hub.docker.com/_/node
26
27
  //
27
28
  const dockerfileNodeVersion = process.env.DOCKER_BUILD_NODE_VERSION || '24.14.0-alpine3.23'
28
- const dockerfileNpmVersion = process.env.DOCKER_BUILD_NPM_VERSION || '11.9.0'
29
+ const dockerfileNpmVersion = process.env.DOCKER_BUILD_NPM_VERSION || '11.12.0'
29
30
 
30
31
  // The contents of these variables were initially located in files that live in
31
32
  // the build-tools repository, but it just became simpler to pull the contents
@@ -59,8 +60,9 @@ const cloudBuildStepsMultiArch = fs.readFileSync( path.join( DIRNAME, './templat
59
60
 
60
61
  const defaultSettings = {
61
62
  apkadds : '',
62
- nodeimage : 'jod-alpine',
63
+ date : getDateTimestamp(),
63
64
  imageBase : 'node:jod-alpine',
65
+ nodeimage : 'jod-alpine',
64
66
  npmlogging : process.env.VERBOSE_NPM_LOGGING ? '--ddd' : '--silent',
65
67
  npmVersion : `npm@${dockerfileNpmVersion}`,
66
68
  pluginfile : '# NO PLUGIN',
@@ -184,7 +186,8 @@ const buildContainerImage = async ( repoDescr ) => {
184
186
  const {
185
187
  artifactProject,
186
188
  artifactRegistry,
187
- containerName,
189
+ containerName,
190
+ dryRun,
188
191
  imagePlatform,
189
192
  imageVersion,
190
193
  isNodeJsProject,
@@ -242,7 +245,10 @@ const buildContainerImage = async ( repoDescr ) => {
242
245
 
243
246
  const { fullName } = await getGcpAccount()
244
247
  const imageBuilder = getCleanTag( fullName )
245
- const imageInfoTag = `zzinfo_${defaultSettings.date}_${defaultSettings.nodeimage}_${imageBuilder}`
248
+ // TODO: this is a bit of a band-aid to get something working while we sort out the
249
+ // the best way to handle python versions and base images
250
+ const buildImage = isPythonProject ? 'python-3.12-slim' : defaultSettings.nodeimage
251
+ const imageInfoTag = `zzinfo_${defaultSettings.date}_${buildImage}_${imageBuilder}`
246
252
  const gcloudProjectNumber = await shellCmd( `gcloud projects describe ${artifactProject} --format="value(projectNumber)"` )
247
253
 
248
254
  // build the cloudbuild.yaml from the handlebars template
@@ -275,9 +281,9 @@ const buildContainerImage = async ( repoDescr ) => {
275
281
  ${cloudBuildSA}
276
282
  ` ) )
277
283
 
278
- if ( process.env.DRY_RUN === '1' ) {
284
+ if ( dryRun ) {
279
285
  log( `Would have run => ${cloudBuildCmd} ${cloudBuildLogs} ${cloudBuildCfg} ${buildDir}` )
280
- log( '\n***Exiting from DRY_RUN\n' )
286
+ log( '\n***Exiting from --dry-run\n' )
281
287
  process.exit( 0 )
282
288
  }
283
289
 
package/src/Utils.mjs CHANGED
@@ -156,7 +156,7 @@ export const establishOauthAccess = async ( registryLocation = 'us-docker.pkg.de
156
156
  // -p is frowned upon but using a pipe | is problematic with shellCmd (execa)
157
157
  const registryLoginCommand = `helm registry login -u oauth2accesstoken -p ${accessToken}`
158
158
 
159
- const loginResult = await shellCmd( `${registryLoginCommand} https://${registryLocation}` )
159
+ const loginResult = await shellCmd( `${registryLoginCommand} ${registryLocation}` )
160
160
  debug( { loginResult }, '<==registryLogin' )
161
161
  } catch ( error ) {
162
162
  // on exception we probably need to reestablish gcloud auth login
@@ -198,6 +198,14 @@ export const getDirectories = ( { path : srcPath = process.cwd(), respectGitigno
198
198
  .map( dirent => dirent.name )
199
199
  }
200
200
 
201
+ // equivalent to Unix touch command to create an empty file
202
+ export const touchFile = ( filename ) => {
203
+ if ( filename ) {
204
+ const handle = fs.openSync( filename, 'w' ) // eslint-disable-line security/detect-non-literal-fs-filename
205
+ fs.closeSync( handle )
206
+ }
207
+ }
208
+
201
209
  // returns YYYMMDD-hhmm
202
210
  export const getDateTimestamp = () => {
203
211
  const fullDTS = new Date().toISOString().replace( /[-T:]/g, '' ).slice( 0, 14 )
@@ -285,16 +293,12 @@ export const parseJsonFile = async ( jsonFile ) => {
285
293
  // TODO: rework this file exists logic / throw
286
294
  if ( !fs.existsSync( jsonFile ) ) { return undefined } // eslint-disable-line security/detect-non-literal-fs-filename
287
295
  /* eslint-disable security/detect-non-literal-fs-filename */
288
- if ( fs.existsSync( jsonFile ) ) {
289
- try {
290
- const json = JSON.parse( fs.readFileSync( jsonFile, 'utf8' ) )
291
- return json
292
- } catch ( error ) {
293
- throw new Error( `${error} in ${jsonFile}` )
294
- }
295
- }
296
- throw new Error( `Utils.parseJsonFile: file ${jsonFile} does not exist in ${process.cwd()}` )
297
- /* eslint-enable security/detect-non-literal-fs-filename */
296
+ try {
297
+ const json = JSON.parse( fs.readFileSync( jsonFile, 'utf8' ) )
298
+ return json
299
+ } catch ( error ) {
300
+ throw new Error( `${error} in ${jsonFile}` )
301
+ }
298
302
  }
299
303
 
300
304
  // Parses the ./package.json file and verifies there is a properly formatted
@@ -306,7 +310,7 @@ const deprecated = ( opts ) => {
306
310
  }
307
311
 
308
312
  export const parsePackageJson = async ( packageFileName = './package.json' ) => {
309
- if ( !fs.existsSync( packageFileName ) ) { return undefined } // eslint-disable-line security/detect-non-literal-fs-filename
313
+ if ( !fs.existsSync( packageFileName ) ) { return undefined }
310
314
 
311
315
  const packageJson = await parseJsonFile( packageFileName )
312
316
 
@@ -497,8 +501,8 @@ https://console.cloud.google.com/artifacts/browse/leverege-registry?project=leve
497
501
  }
498
502
 
499
503
  export const parsePyProjectToml = async ( packageFileName = './pyproject.toml' ) => {
500
- if ( !fs.existsSync( packageFileName ) ) { return undefined } // eslint-disable-line security/detect-non-literal-fs-filename
501
- const tomlStr = fs.readFileSync( packageFileName ) // eslint-disable-line security/detect-non-literal-fs-filename
504
+ if ( !fs.existsSync( packageFileName ) ) { return undefined }
505
+ const tomlStr = fs.readFileSync( packageFileName )
502
506
  const pyproject = toml.parse( tomlStr )
503
507
 
504
508
  const registry = pyproject?.leverege?.registry
package/src/bash-funcs CHANGED
@@ -229,28 +229,6 @@ function waitForIAM() {
229
229
  done
230
230
  }
231
231
 
232
- # *** DEPRECATED *** REMOVE AFTER BITNAMI ERADICATED ***
233
- # *** DEPRECATED *** REMOVE AFTER BITNAMI ERADICATED ***
234
- # *** DEPRECATED *** REMOVE AFTER BITNAMI ERADICATED ***
235
- #
236
- function addBitnamiRepo() {
237
- warning '*** the addBitnamiRepo function should be removed - DEPRECATED ***'
238
- if [ ! -z "$BITNAMI_LATEST" ] || [ "$1" == "latest" ];
239
- then
240
- BITNAMI_URL="https://charts.bitnami.com/bitnami"
241
- else
242
- cat<<CATNAMI
243
- Using the pre 2022 legacy charts from bitnami. To use latest run:
244
-
245
- `color y "BITNAMI_LATEST=1 $HELMUP_ARGS"`
246
-
247
- CATNAMI
248
- BITNAMI_URL="https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami"
249
- fi
250
-
251
- addHelmRepo bitnami $BITNAMI_URL
252
- }
253
-
254
232
  function removeHelmRepo(){
255
233
  [ ! -z "$SKIP_RM_HELM_REPO" ] && return
256
234
  helm repo remove $1 &> $DEVNULL
@@ -15,7 +15,7 @@ import {
15
15
  proceed,
16
16
  } from '../Utils.mjs'
17
17
 
18
- const ORB_VERSION = '1.2.4' // Keep this in sync with the version in circle-orb.yml
18
+ const ORB_VERSION = '1.2.6' // Keep this in sync with the version in circle-orb.yml
19
19
  const CIRCLE_DIR = '.circleci'
20
20
  const CIRCLE_YML = `${CIRCLE_DIR}/config.yml`
21
21
  const CIRCLE_YML_TEMPLATE = path.join( BUILD_TOOLS_ROOT, 'circle-orb-it', 'circle-orb.yml' )
@@ -1,7 +1,7 @@
1
1
  version: 2.1
2
2
 
3
3
  orbs:
4
- leverege: leverege/circle-nodejs-ci@1.2.4
4
+ leverege: leverege/circle-nodejs-ci@1.2.6
5
5
 
6
6
  workflows:
7
7
  build-and-verify: