@leverege/build-tools 2.80.1 → 2.82.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.
Files changed (53) hide show
  1. package/.vscode/launch.json +22 -0
  2. package/package.json +7 -6
  3. package/src/Utils.mjs +2 -2
  4. package/src/bash-funcs +21 -0
  5. package/src/bitnami-audit.mjs +169 -0
  6. package/src/bitnami-audit.sh +75 -0
  7. package/src/bitnami-to-leverege-artifacts.sh +140 -0
  8. package/src/count-lines-of-code.mjs +6 -4
  9. package/src/crane-lift.sh +11 -0
  10. package/src/helm-charts/argocd/.nohelm +0 -0
  11. package/src/helm-charts/argocd/.nohelmdn +0 -0
  12. package/src/helm-charts/argocd/helmup.bootstrap +3 -0
  13. package/src/helm-charts/argocd/helmup.plugin +3 -0
  14. package/src/helm-charts/cnpg-db-pgbench/helmup.bootstrap +11 -0
  15. package/src/helm-charts/cnpg-db-psql-stack/helmup.bootstrap +11 -0
  16. package/src/helm-charts/cnpg-db-psql-stack/helmup.plugin +1 -1
  17. package/src/helm-charts/cnpg-db-recovery/helmup.bootstrap +11 -0
  18. package/src/helm-charts/cnpg-db-recovery/helmup.plugin +1 -1
  19. package/src/helm-charts/cnpg-db-tsdb-basic/helmup.bootstrap +11 -0
  20. package/src/helm-charts/cnpg-db-tsdb-basic/helmup.plugin +1 -1
  21. package/src/helm-charts/cnpg-db-tsdb-dense/helmup.bootstrap +11 -0
  22. package/src/helm-charts/cnpg-db-tsdb-dense/helmup.plugin +1 -1
  23. package/src/helm-charts/cnpg-operator/helmdn.plugin +1 -1
  24. package/src/helm-charts/cnpg-operator/helmup.bootstrap +201 -0
  25. package/src/helm-charts/cnpg-operator/helmup.plugin +1 -1
  26. package/src/helm-charts/cnpg-operator/operand.bootstrap +41 -0
  27. package/src/helm-charts/elasticsearch8/elasticsearch-local-dev.yaml +9 -0
  28. package/src/helm-charts/elasticsearch8/elasticsearch-local-prd.yaml +9 -0
  29. package/src/helm-charts/elasticsearch8/helmup.plugin +3 -3
  30. package/src/helm-charts/pgbouncer/helmup.bootstrap +24 -0
  31. package/src/helm-charts/postgres/.nohelm +0 -0
  32. package/src/helm-charts/postgres/.nohelmdn +0 -0
  33. package/src/helm-charts/postgres/README.md +6 -0
  34. package/src/helm-charts/postgres/helmdn.plugin +3 -0
  35. package/src/helm-charts/postgres/helmup.plugin +21 -0
  36. package/src/helm-charts/postgres/postgres-local.yaml +51 -0
  37. package/src/helm-charts/prom-operator/helmup.bootstrap +47 -0
  38. package/src/helm-charts/prom-operator/rules/traefik-rules.yaml +2 -2
  39. package/src/helm-charts/prom-operator/stackdriver-exporter.yaml.ovh +2 -1
  40. package/src/helm-charts/redis/helmup.plugin +2 -2
  41. package/src/helm-charts/redis/values-local.yaml +14 -0
  42. package/src/helm-charts/traefik/helmup.plugin +1 -1
  43. package/src/helm-charts/traefik/values-local.yaml +1 -1
  44. package/src/helm-charts/valkey/helmup.plugin +3 -3
  45. package/src/helm-charts/valkey/valkey-local.yaml +11 -1
  46. package/src/helm-charts/velero/helmup.bootstrap +104 -0
  47. package/src/helm-charts/velero/helmup.plugin +1 -1
  48. package/src/helmdn.sh +2 -1
  49. package/src/helmup.sh +65 -644
  50. package/src/init-my-chart.mjs +18 -0
  51. package/src/k8x.sh +4 -0
  52. package/src/overwhelm.mjs +1 -1
  53. package/.vscode/settings.json +0 -3
@@ -0,0 +1,22 @@
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "type": "node",
6
+ "request": "launch",
7
+ "name": "Test",
8
+ "runtimeExecutable": "npm",
9
+ "runtimeArgs": [
10
+ "run",
11
+ "testNoTimeout"
12
+ ],
13
+ "resolveSourceMapLocations": [
14
+ "${workspaceFolder}/**",
15
+ "!**/node_modules/**"
16
+ ],
17
+ "env": {
18
+ },
19
+ "outputCapture": "std"
20
+ }
21
+ ]
22
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.80.1",
3
+ "version": "2.82.0",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -42,6 +42,7 @@
42
42
  "helminit": "src/helmup.sh",
43
43
  "helmwhat": "src/helmup.sh",
44
44
  "hook-and-release": "src/hook-and-release.mjs",
45
+ "init-my-chart": "src/init-my-chart.mjs",
45
46
  "k8scale": "src/k8scale.sh",
46
47
  "k8x": "src/k8x.sh",
47
48
  "klog": "src/klog.sh",
@@ -64,7 +65,7 @@
64
65
  "license": "SEE LICENSE IN LICENSE.md",
65
66
  "dependencies": {
66
67
  "@leverege/jsdoc-template": "^1.0.1",
67
- "chalk": "^5.4.1",
68
+ "chalk": "^5.5.0",
68
69
  "command-line-args": "^6.0.1",
69
70
  "command-line-usage": "^7.0.3",
70
71
  "commander": "^14.0.0",
@@ -74,11 +75,11 @@
74
75
  "glob": "^11.0.3",
75
76
  "handlebars": "^4.7.8",
76
77
  "ignore": "^7.0.5",
77
- "inquirer": "^12.7.0",
78
+ "inquirer": "^12.9.0",
78
79
  "js-yaml": "^4.1.0",
79
80
  "jsdoc": "^4.0.4",
80
81
  "ms": "^2.1.3",
81
- "npm-registry-fetch": "^18.0.2",
82
+ "npm-registry-fetch": "^19.0.0",
82
83
  "ora": "^8.2.0",
83
84
  "p-limit": "^6.2.0",
84
85
  "package-up": "^5.0.0",
@@ -88,10 +89,10 @@
88
89
  "simple-git": "^3.28.0",
89
90
  "sloc": "^0.3.2",
90
91
  "toml": "^3.0.0",
91
- "zx": "^8.7.1"
92
+ "zx": "^8.8.0"
92
93
  },
93
94
  "devDependencies": {
94
95
  "@leverege/eslint-config-leverege": "^5.0.1",
95
- "npm": "^11.4.2"
96
+ "npm": "^11.5.2"
96
97
  }
97
98
  }
package/src/Utils.mjs CHANGED
@@ -14,7 +14,7 @@ import YAML from 'js-yaml'
14
14
 
15
15
  // __dirname goes away with ESM so we take this approach instead and
16
16
  // this assumes this file lives in the src dir of the build-tools repo
17
- export const BUILD_TOOLS_ROOT = path.dirname( url.fileURLToPath( import.meta.url ) )
17
+ export const BUILD_TOOLS_ROOT = process.env.BUILD_TOOLS_ROOT || path.dirname( url.fileURLToPath( import.meta.url ) )
18
18
 
19
19
  let debugEnabled = process.env.BUILD_TOOLS_DEBUG === '1'
20
20
 
@@ -565,7 +565,7 @@ export const analyzeRepository = async ( giveGuidance ) => {
565
565
  // if the build tools version is still undefined then assume we are using a globally installed bt
566
566
  if ( buildToolsVersion === undefined ) {
567
567
  const fromBuildTools = await shellCmd( 'build-tools --version' )
568
- buildToolsVersion = fromBuildTools.match( /\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/ )[0]
568
+ buildToolsVersion = fromBuildTools.match( /\d+\.\d+\.\d+(?:-[a-zA-Z0-9.-]+)?$/ )[0] // eslint-disable-line security/detect-unsafe-regex
569
569
  }
570
570
 
571
571
  const containerName = closestPackageJson?.name.replace( /^@[^/]+\//, '' ) || rootPyProjectToml?.project.name
package/src/bash-funcs CHANGED
@@ -149,6 +149,27 @@ REPOADD
149
149
  helm repo update &> $DEVNULL
150
150
  }
151
151
 
152
+ # *** DEPRECATED *** REMOVE AFTER BITNAMI ERADICATED ***
153
+ # *** DEPRECATED *** REMOVE AFTER BITNAMI ERADICATED ***
154
+ # *** DEPRECATED *** REMOVE AFTER BITNAMI ERADICATED ***
155
+ #
156
+ function addBitnamiRepo() {
157
+ if [ ! -z "$BITNAMI_LATEST" ] || [ "$1" == "latest" ];
158
+ then
159
+ BITNAMI_URL="https://charts.bitnami.com/bitnami"
160
+ else
161
+ cat<<CATNAMI
162
+ Using the pre 2022 legacy charts from bitnami. To use latest run:
163
+
164
+ `color y "BITNAMI_LATEST=1 $HELMUP_ARGS"`
165
+
166
+ CATNAMI
167
+ BITNAMI_URL="https://raw.githubusercontent.com/bitnami/charts/eb5f9a9513d987b519f0ecd732e7031241c50328/bitnami"
168
+ fi
169
+
170
+ addHelmRepo bitnami $BITNAMI_URL
171
+ }
172
+
152
173
  function removeHelmRepo(){
153
174
  [ ! -z "$SKIP_RM_HELM_REPO" ] && return
154
175
  helm repo remove $1 &> $DEVNULL
@@ -0,0 +1,169 @@
1
+ #!/usr/bin/env node
2
+ //
3
+ // This script is used to scan all of the projects in the auditProject array
4
+ // to look for any deployments that are still using the bitnami images. The
5
+ // output from this script can then be imported / upload / replace existing in
6
+ // the BitnamiImageRegistry gsheet to show progess on the migration effort.
7
+ //
8
+ import fs from 'node:fs'
9
+ import chalk from 'chalk'
10
+ import semver from 'semver'
11
+
12
+ import {
13
+ debug,
14
+ log,
15
+ shellCmd,
16
+ } from './Utils.mjs'
17
+
18
+ const auditProjects = [
19
+ 'dev-controltek',
20
+ 'dev-cox-health',
21
+ 'dev-pitcrew',
22
+ 'xxx-bogus', // expect warning
23
+ 'dev-recovr-auto',
24
+ 'dev-schnucks',
25
+ 'dev-tpi',
26
+ 'discount-tire-prd',
27
+ 'discount-tire-stg',
28
+ 'leverege-cnpg-20240729',
29
+ 'leverege-ops-20250730',
30
+ 'leverege-demo', // expect warning
31
+ 'leverege-elastic',
32
+ 'leverege-onboarding',
33
+ 'leverege-sandbox',
34
+ 'nimbelink-demo',
35
+ 'prd-controltek',
36
+ 'prd-cox-health',
37
+ 'prd-generic-kudelski',
38
+ 'prd-les-schwab',
39
+ 'prd-recovr-auto',
40
+ 'prd-skymirr',
41
+ 'prd-tpi',
42
+ 'prd-valvoline',
43
+ 'qa-cox-health', // expect warning
44
+ 'siren-marine-dev',
45
+ 'siren-marine-prd',
46
+ 'siren-marine-staging',
47
+ 'siren-marine-test',
48
+ 'stg-cox-health',
49
+ 'stg-generic-kudelski',
50
+ 'stg-recovr-auto',
51
+ 'stg-recovr-perf',
52
+ ]
53
+
54
+ const gitCheckoutCleanBranch = async ( branch = 'bootstrap-k8s' ) => {
55
+ // find and remove cruft, like generated values.yaml files
56
+ await shellCmd( 'find . -not \\( -path \\*junk -prune -o -path \\*helm-elasticsearch -prune \\) -name values.yaml -exec rm {} \\;' )
57
+
58
+ // start with a clean baseline
59
+ await shellCmd( 'git checkout bootstrap-k8s' )
60
+ await shellCmd( 'git clean -d --force' )
61
+
62
+ // checkout the target branch
63
+ await shellCmd( `git checkout ${branch}` )
64
+ }
65
+
66
+ const setK8sContext = async ( project ) => {
67
+ await shellCmd( 'overwhelm --fetchctx' )
68
+ await shellCmd( 'overwhelm --matchk8s' )
69
+ }
70
+
71
+ const prepareContext = async ( project ) => {
72
+ await gitCheckoutCleanBranch( project )
73
+ await setK8sContext( project )
74
+ }
75
+
76
+ const filterBitnamiImages = ( project, imagesJSON ) => {
77
+ const data = JSON.parse( imagesJSON )
78
+ const seen = new Set()
79
+
80
+ for ( const item of data.items ) {
81
+ const ns = item.metadata.namespace
82
+ let service = item.metadata.name
83
+
84
+ // Collapse services
85
+ service = service.replace( /elasticsearch8-(coordinating|data|master|ingest)/, 'elasticsearch' )
86
+ service = service.replace( /redis-(master|replicas)/, 'redis' )
87
+ service = service.replace( /valkey-(primary|replicas)/, 'valkey' )
88
+
89
+ const containers = item.spec?.template?.spec?.containers || []
90
+ for ( const c of containers ) {
91
+ let img = c.image
92
+
93
+ // Only keep bitnami images
94
+ if ( !/bitnami/.test( img ) ) continue
95
+
96
+ // Registry decluttering
97
+ img = img.replace( /^docker\.io\/bitnami/, 'bitnami' )
98
+ img = img.replace( /^us-docker\.pkg\.dev\/leverege-registry\/bitnami-mirror\/images/, 'leverege' )
99
+ img = img.replace( /^us-docker\.pkg\.dev\/leverege-registry\/system\/images/, 'leverege/system' )
100
+
101
+ const [ image, fullVersion = 'latest' ] = img.split( ':' )
102
+ const displayVersion = fullVersion.replace( /-debian-.*$/, '' )
103
+
104
+ const row = [ project, ns, service, image, displayVersion, fullVersion ].join( ',' )
105
+ if ( !seen.has( row ) ) {
106
+ debug( row )
107
+ seen.add( row )
108
+ }
109
+ }
110
+ }
111
+ return seen
112
+ }
113
+
114
+ const imageSummary = new Map()
115
+
116
+ const runner = async ( projects ) => {
117
+ const CSV_FILE = '../BitnamiImageRegistry.csv'
118
+ const fd = fs.openSync( CSV_FILE, 'w' )
119
+ fs.writeSync( fd, 'Project,Namespace,Service,Image,Version,Tag\n' )
120
+
121
+ for ( const project of projects ) {
122
+ log( `Project [${project}]` )
123
+ try {
124
+ await prepareContext( project ) // eslint-disable-line no-await-in-loop
125
+ } catch ( error ) {
126
+ log( `Project or context is invalid, skipping [${chalk.redBright( project )}]` )
127
+ continue
128
+ }
129
+
130
+ // eslint-disable-next-line no-await-in-loop
131
+ const k8sImageDump = await shellCmd( 'kubectl get deploy,statefulset -A -o json' )
132
+ const bitnamiImages = filterBitnamiImages( project, k8sImageDump )
133
+
134
+ for ( const line of bitnamiImages ) {
135
+ fs.writeSync( fd, `${line}\n` )
136
+
137
+ const [ , , , image, version, tag ] = line.split( ',' )
138
+ if ( /^leverege/.test( image ) ) continue // we don't need leverege in the summary
139
+
140
+ if ( !imageSummary.has( image ) ) {
141
+ imageSummary.set( image, { version : new Set(), tag : new Set() } )
142
+ }
143
+ imageSummary.get( image ).version.add( version )
144
+ imageSummary.get( image ).tag.add( tag )
145
+ }
146
+ }
147
+ fs.closeSync( fd )
148
+
149
+ log( '\n==== Bitnami Image Summary ====\n' )
150
+
151
+ log( 'IMAGES=(' )
152
+
153
+ for ( const [ image, { tag, version } ] of imageSummary.entries() ) {
154
+ const sortedTags = Array.from( tag ).sort( semver.rcompare )
155
+ for ( const t of sortedTags.slice( 0, 15 ) ) {
156
+ log( ` "${image}:${t}"` )
157
+ }
158
+
159
+ // Optional: also log a human-friendly display version list
160
+ const sortedVersions = Array.from( version ).sort( semver.rcompare )
161
+ log( ` # Display versions: ${sortedVersions.join( ', ' )}` )
162
+ }
163
+
164
+ log( ')' )
165
+
166
+ gitCheckoutCleanBranch() // back to clean bootstrap-k8s
167
+ }
168
+
169
+ await runner( auditProjects )
@@ -0,0 +1,75 @@
1
+ #!/bin/bash
2
+
3
+ BITNAMI_CTX=(
4
+ dev-controltek
5
+ dev-cox-health
6
+ dev-pitcrew
7
+ dev-recovr-auto
8
+ dev-schnucks
9
+ dev-tpi
10
+ discount-tire-prd
11
+ discount-tire-stg
12
+ leverege-cnpg-20240729
13
+ leverege-ops-20250730
14
+ leverege-demo
15
+ leverege-elastic
16
+ leverege-onboarding
17
+ leverege-sandbox
18
+ nimbelink-demo
19
+ prd-controltek
20
+ prd-cox-health
21
+ prd-generic-kudelski
22
+ prd-les-schwab
23
+ prd-recovr-auto
24
+ prd-skymirr
25
+ prd-tpi
26
+ prd-valvoline
27
+ qa-cox-health
28
+ siren-marine-dev
29
+ siren-marine-prd
30
+ siren-marine-staging
31
+ siren-marine-test
32
+ stg-cox-health
33
+ stg-generic-kudelski
34
+ stg-recovr-auto
35
+ stg-recovr-perf
36
+ )
37
+
38
+ function gitCheckoutCleanBranch() {
39
+ # find the cruft, namely any values.yaml files which tend to block the
40
+ # cleaning of subdirs that contain them (values.yaml aren't tracked in git)
41
+ find . -not \( -path \*junk -prune -o -path \*helm-elasticsearch -prune \) -name values.yaml -exec rm {} \;
42
+ git ko bootstrap-k8s &> /dev/null
43
+ git clean -d --force &> /dev/null
44
+
45
+ local branch=${1:bootstrap-k8s}
46
+ git ko "$branch" &> /dev/null
47
+ }
48
+
49
+ # create a clean sheet with headers
50
+ CSV_FILE="../BitnamiImageRegistry.csv"
51
+ rm -f $CSV_FILE
52
+ echo 'project,namespace,service,image,version' > $CSV_FILE
53
+
54
+ gitCheckoutCleanBranch # start clean
55
+
56
+ for CTX in "${BITNAMI_CTX[@]}";
57
+ do
58
+ gitCheckoutCleanBranch $CTX
59
+
60
+ if [[ $? -eq 0 ]];
61
+ then
62
+ overwhelm -f
63
+ overwhelm -m
64
+ if [[ $? -ne 0 ]];
65
+ then
66
+ echo "Project [${CTX}] is valid, but the k8s context is not - skipping..."
67
+ continue
68
+ fi
69
+ echo "Context GOOD [$CTX]"
70
+ kubectl get deploy,statefulset -A -o json | bitnami-k8s-parse $CTX >> $CSV_FILE
71
+ fi
72
+ find . -not \( -path \*junk -prune -o -path \*helm-elasticsearch -prune \) -name values.yaml -exec rm {} \;
73
+ done
74
+
75
+ gitCheckoutCleanBranch # end clean
@@ -0,0 +1,140 @@
1
+ #!/bin/bash
2
+ #
3
+ # This script was used to bootstrap the leverege-registry bitnmai-mirror
4
+ # folder with initial images and charts needed for the migration away from
5
+ # bitnami. I left it here as an artifact and can be deleted once the entire
6
+ # migration is complete.
7
+ #
8
+ # CONFIGURATION
9
+ PROJECT_ID="leverege-registry"
10
+ REGION="us" # adjust if needed
11
+ MIRROR_ROOT="${REGION}-docker.pkg.dev/${PROJECT_ID}/bitnami-mirror"
12
+ DOCKER_PREFIX="${MIRROR_ROOT}/images"
13
+ CHARTS_PREFIX="oci://${MIRROR_ROOT}/charts"
14
+
15
+ # Images to mirror
16
+ IMAGES=(
17
+ "bitnami/postgresql:11.14.0-debian-10-r28"
18
+ "bitnami/postgresql:11.7.0-debian-10-r99"
19
+ # Display versions: 11.14.0, 11.7.0
20
+ "bitnami/postgres-exporter:0.10.0-debian-10-r172"
21
+ "bitnami/postgres-exporter:0.8.0-debian-10-r106"
22
+ # Display versions: 0.10.0, 0.8.0
23
+ "bitnami/redis:7.4.3-debian-12-r0"
24
+ "bitnami/redis:7.4.2-debian-12-r2"
25
+ "bitnami/redis:7.4.1-debian-12-r0"
26
+ "bitnami/redis:7.2.5-debian-12-r2"
27
+ "bitnami/redis:7.2.5-debian-12-r0"
28
+ "bitnami/redis:7.2.4-debian-12-r12"
29
+ "bitnami/redis:7.2.3-debian-11-r1"
30
+ "bitnami/redis:7.0.12-debian-11-r34"
31
+ "bitnami/redis:7.0.11-debian-11-r12"
32
+ "bitnami/redis:7.0.8-debian-11-r0"
33
+ "bitnami/redis:6.2.1-debian-10-r36"
34
+ "bitnami/redis:6.0.3-debian-10-r2"
35
+ # Display versions: 7.4.3, 7.4.2, 7.4.1, 7.2.5, 7.2.4, 7.2.3, 7.0.12, 7.0.11, 7.0.8, 6.2.1, 6.0.3
36
+ "bitnami/redis-exporter:1.70.0-debian-12-r2"
37
+ "bitnami/redis-exporter:1.67.0-debian-12-r7"
38
+ "bitnami/redis-exporter:1.63.0-debian-12-r1"
39
+ "bitnami/redis-exporter:1.61.0-debian-12-r2"
40
+ "bitnami/redis-exporter:1.61.0-debian-12-r0"
41
+ "bitnami/redis-exporter:1.58.0-debian-12-r7"
42
+ "bitnami/redis-exporter:1.55.0-debian-11-r2"
43
+ "bitnami/redis-exporter:1.52.0-debian-11-r25"
44
+ "bitnami/redis-exporter:1.50.0-debian-11-r13"
45
+ "bitnami/redis-exporter:1.45.0-debian-11-r26"
46
+ "bitnami/redis-exporter:1.20.0-debian-10-r16"
47
+ "bitnami/redis-exporter:1.6.1-debian-10-r7"
48
+ # Display versions: 1.70.0, 1.67.0, 1.63.0, 1.61.0, 1.58.0, 1.55.0, 1.52.0, 1.50.0, 1.45.0, 1.20.0, 1.6.1
49
+ "bitnami/elasticsearch:8.18.0-debian-12-r2"
50
+ "bitnami/elasticsearch:8.17.3-debian-12-r0"
51
+ "bitnami/elasticsearch:8.16.1-debian-12-r0"
52
+ "bitnami/elasticsearch:8.15.2-debian-12-r2"
53
+ "bitnami/elasticsearch:8.12.2-debian-12-r0"
54
+ "bitnami/elasticsearch:8.12.1-debian-11-r2"
55
+ "bitnami/elasticsearch:8.12.1-debian-11-r1"
56
+ "bitnami/elasticsearch:8.12.0-debian-11-r1"
57
+ "bitnami/elasticsearch:8.11.1-debian-11-r0"
58
+ "bitnami/elasticsearch:8.10.3-debian-11-r1"
59
+ "bitnami/elasticsearch:8.9.1-debian-11-r2"
60
+ # Display versions: 8.18.0, 8.17.3, 8.16.1, 8.15.2, 8.12.2, 8.12.1, 8.12.0, 8.11.1, 8.10.3, 8.9.1
61
+ "bitnami/sealed-secrets-controller:0.29.0-debian-12-r1"
62
+ "bitnami/valkey:8.1.3-debian-12-r1"
63
+ # Display versions: 8.1.30
64
+ )
65
+
66
+ # Charts to mirror (chart:version)
67
+ CHARTS=(
68
+ "bitnamicharts/elasticsearch:22.1.0"
69
+ "bitnamicharts/elasticsearch:21.6.3"
70
+ "bitnamicharts/elasticsearch:21.3.20"
71
+ "bitnamicharts/elasticsearch:19.17.6"
72
+ # "bitnamicharts/postgresql:10.16.2" # pulled manually from ancient bitnami source
73
+ "bitnamicharts/redis:20.13.4"
74
+ "bitnamicharts/valkey:3.0.22"
75
+ )
76
+
77
+ echo "🔑 Authenticating to Artifact Registry..."
78
+ gcloud auth configure-docker ${REGION}-docker.pkg.dev -q &> /dev/null
79
+ gcloud auth application-default print-access-token | helm registry login \
80
+ -u oauth2accesstoken --password-stdin ${REGION}-docker.pkg.dev
81
+
82
+ echo "📦 Ensuring Artifact Registry repos exist..."
83
+ gcloud artifacts repositories create bitnami-mirror \
84
+ --repository-format=docker \
85
+ --location=${REGION} \
86
+ --project=${PROJECT_ID} \
87
+ --description="Mirror of Bitnami images/charts" &> /dev/null \
88
+ || echo "✅ Docker repo already exists."
89
+
90
+ # Check if crane is available (brew install crane)
91
+ if command -v crane &>/dev/null;
92
+ then
93
+ echo "🚀 Using crane for image copies (fast + multi-arch safe)"
94
+ USE_CRANE=true
95
+ else
96
+ echo "🐳 crane not found, falling back to Docker CLI"
97
+ USE_CRANE=false
98
+ fi
99
+
100
+ echo "⬇️ Pulling & pushing container images..."
101
+ for IMAGE in "${IMAGES[@]}"; do
102
+ SRC_IMAGE="docker.io/${IMAGE}"
103
+ NAME=$(echo "${IMAGE}" | cut -d: -f1 | awk -F/ '{print $NF}')
104
+ TAG=$(echo "${IMAGE}" | cut -d: -f2)
105
+ DEST_IMAGE="${DOCKER_PREFIX}/${NAME}:${TAG}"
106
+
107
+ echo "Mirroring ${SRC_IMAGE} → ${DEST_IMAGE}"
108
+
109
+ if [ "$USE_CRANE" = true ];
110
+ then
111
+ # crane copies the whole manifest list (multi-arch safe)
112
+ cat<<CRANE_CAT
113
+ crane copy "${SRC_IMAGE}" "${DEST_IMAGE}"
114
+ CRANE_CAT
115
+ crane copy "${SRC_IMAGE}" "${DEST_IMAGE}"
116
+ else
117
+ docker pull --platform linux/amd64 "${SRC_IMAGE}"
118
+ docker tag "${SRC_IMAGE}" "${DEST_IMAGE}"
119
+ docker push "${DEST_IMAGE}"
120
+
121
+ # clean up local docker - the || true ensures the script won’t fail if the
122
+ # image was already removed or the tag isn’t present
123
+ docker rmi -f "${SRC_IMAGE}" "${DEST_IMAGE}" || true
124
+ fi
125
+ done
126
+
127
+ echo "⬇️ Pulling & pushing Helm charts..."
128
+ for ENTRY in "${CHARTS[@]}"; do
129
+ CHART=$(echo $ENTRY | cut -d: -f1)
130
+ VERSION=$(echo $ENTRY | cut -d: -f2)
131
+ echo "Mirroring chart ${CHART}:${VERSION}"
132
+ #cat<<CHART_MOVER
133
+ helm pull oci://registry-1.docker.io/${CHART} --version ${VERSION}
134
+ CHART_TARBALL=$(basename ${CHART})-${VERSION}.tgz
135
+ helm push "${CHART_TARBALL}" ${CHARTS_PREFIX}
136
+ rm -f "${CHART_TARBALL}"
137
+ #CHART_MOVER
138
+ done
139
+
140
+ echo "✅ Mirror complete."
@@ -2,6 +2,8 @@
2
2
  import path from 'node:path'
3
3
  import { $, fs, chalk, argv } from 'zx'
4
4
 
5
+ import { log } from './Utils.mjs'
6
+
5
7
  const srcOnly = argv.srcOnly
6
8
 
7
9
  const $$ = $( {
@@ -21,10 +23,10 @@ if ( !hasWorkspace ) {
21
23
  for ( let i = 0; i < dirs.length; i++ ) {
22
24
  const dir = dirs[i]
23
25
 
24
- await getLinesOfCodeForDirectory( path.join( rootDir, 'packages', dir ) )
26
+ await getLinesOfCodeForDirectory( path.join( rootDir, 'packages', dir ) ) // eslint-disable-line no-await-in-loop
25
27
  }
26
28
  } else {
27
- console.log( chalk.redBright( 'No workspace directories for which to count code' ) )
29
+ log( chalk.redBright( 'No workspace directories for which to count code' ) )
28
30
  }
29
31
  }
30
32
 
@@ -33,13 +35,13 @@ async function getLinesOfCodeForDirectory( directory ) {
33
35
  const hasSrc = await fs.exists( srcDir )
34
36
 
35
37
  if ( hasSrc ) {
36
- console.log( `${chalk.greenBright( srcOnly ? srcDir : directory )}:` )
38
+ log( `${chalk.greenBright( srcOnly ? srcDir : directory )}:` )
37
39
  if ( srcOnly ) {
38
40
  await $$`sloc ${srcDir} --format cli-table`
39
41
  } else {
40
42
  await $$`sloc ${directory} --format cli-table -i '^(src|test)/.*' -e node_modules`
41
43
  }
42
44
  } else {
43
- console.log( chalk.redBright( `No src directory at ${directory}` ) )
45
+ log( chalk.redBright( `No src directory at ${directory}` ) )
44
46
  }
45
47
  }
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+ #
3
+ # just a simple wrapper round crane docker lifter
4
+ #
5
+ IMAGE_WITH_TAG="${1}" # like valkey:8.1.3-debian-12-r1
6
+
7
+ REGISTRY_LEVEREGE="us-docker.pkg.dev/leverege-registry/bitnami-mirror/images"
8
+ REGISTRY_BITNAMI="docker.io/bitnami"
9
+
10
+ crane copy "${REGISTRY_BITNAMI}/${IMAGE_WITH_TAG}" \
11
+ "${REGISTRY_LEVEREGE}"/${IMAGE_WITH_TAG}"
File without changes
File without changes
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ echo "--- BOOT ME BABY! $SERVICE"
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+
3
+ echo "---->>> helmup.plugin"
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+
3
+ BOOTSTRAP="cnpg-operator/operand.bootstrap"
4
+
5
+ if [ ! -f "$BOOTSTRAP" ];
6
+ then
7
+ printf "\n `color r '***ERROR:'` the cnpg-operator must be installed first\n\n"
8
+ return 1
9
+ fi
10
+
11
+ . "$BOOTSTRAP" "$SERVICE"
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+
3
+ BOOTSTRAP="cnpg-operator/operand.bootstrap"
4
+
5
+ if [ ! -f "$BOOTSTRAP" ];
6
+ then
7
+ printf "\n `color r '***ERROR:'` the cnpg-operator must be installed first\n\n"
8
+ return 1
9
+ fi
10
+
11
+ . "$BOOTSTRAP" "$SERVICE"
@@ -1,6 +1,6 @@
1
1
  #!/bin/bash
2
2
 
3
3
  # ensures the PG_PASSWORD secret exists and correct
4
- ensureCnpgSecret PG_PASSWORD $SERVICE-postgres-pw
4
+ synchronizeSecrets PG_PASSWORD $SERVICE-postgres-pw
5
5
 
6
6
  kubectl apply -f cnpg-db-psql-stack/cluster.yaml $K8S_WHAT
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+
3
+ BOOTSTRAP="cnpg-operator/operand.bootstrap"
4
+
5
+ if [ ! -f "$BOOTSTRAP" ];
6
+ then
7
+ printf "\n `color r '***ERROR:'` the cnpg-operator must be installed first\n\n"
8
+ return 1
9
+ fi
10
+
11
+ . "$BOOTSTRAP" "$SERVICE"
@@ -1,6 +1,6 @@
1
1
  #!/bin/bash
2
2
 
3
3
  # ensures the PG_PASSWORD secret exists and correct
4
- # ensureCnpgSecret PG_PASSWORD $SERVICE-postgres-pw
4
+ # synchronizeSecrets PG_PASSWORD $SERVICE-postgres-pw
5
5
 
6
6
  kubectl apply -f cnpg-db-recovery/cluster.yaml $K8S_WHAT
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+
3
+ BOOTSTRAP="cnpg-operator/operand.bootstrap"
4
+
5
+ if [ ! -f "$BOOTSTRAP" ];
6
+ then
7
+ printf "\n `color r '***ERROR:'` the cnpg-operator must be installed first\n\n"
8
+ return 1
9
+ fi
10
+
11
+ . "$BOOTSTRAP" "$SERVICE"
@@ -1,6 +1,6 @@
1
1
  #!/bin/bash
2
2
 
3
3
  # ensures the TSDB_PASSWORD secret exists and correct
4
- ensureCnpgSecret TSDB_PASSWORD $SERVICE-postgres-pw
4
+ synchronizeSecrets TSDB_PASSWORD $SERVICE-postgres-pw
5
5
 
6
6
  kubectl apply -f cnpg-db-tsdb-basic/cluster.yaml $K8S_WHAT
@@ -0,0 +1,11 @@
1
+ #!/bin/bash
2
+
3
+ BOOTSTRAP="cnpg-operator/operand.bootstrap"
4
+
5
+ if [ ! -f "$BOOTSTRAP" ];
6
+ then
7
+ printf "\n `color r '***ERROR:'` the cnpg-operator must be installed first\n\n"
8
+ return 1
9
+ fi
10
+
11
+ . "$BOOTSTRAP" "$SERVICE"
@@ -1,6 +1,6 @@
1
1
  #!/bin/bash
2
2
 
3
3
  # ensures the TSDB_DENSE_PASSWORD secret exists and correct
4
- ensureCnpgSecret TSDB_DENSE_PASSWORD $SERVICE-postgres-pw
4
+ synchronizeSecrets TSDB_DENSE_PASSWORD $SERVICE-postgres-pw
5
5
 
6
6
  kubectl apply -f cnpg-db-tsdb-dense/cluster.yaml $K8S_WHAT