@leverege/build-tools 2.62.0-alpha.6 → 2.62.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.62.0-alpha.6",
3
+ "version": "2.62.0",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -16,9 +16,9 @@
16
16
  "bin": {
17
17
  "build-tools": "src/build-tools.mjs",
18
18
  "build-and-push": "src/build-and-push.sh",
19
+ "build-cnpg-image": "src/build-cnpg-image.mjs",
19
20
  "chart-to-registry": "src/chart-to-registry.mjs",
20
21
  "circleate": "src/circleate.sh",
21
- "cnpg-backup": "src/cnpg-backup.mjs",
22
22
  "decrypt-secrets": "src/decrypt-secrets.sh",
23
23
  "dirty-git": "src/dirty-git.sh",
24
24
  "dockreate": "src/dockreate.sh",
@@ -38,9 +38,7 @@
38
38
  "helminit": "src/helmup.sh",
39
39
  "helmwhat": "src/helmup.sh",
40
40
  "hook-and-release": "src/hook-and-release.mjs",
41
- "k8cryo": "src/k8cryo.sh",
42
41
  "k8scale": "src/k8scale.sh",
43
- "k8thaw": "src/k8cryo.sh",
44
42
  "k8x": "src/k8x.sh",
45
43
  "klog": "src/klog.sh",
46
44
  "npm-link": "src/npm-link.sh",
@@ -54,6 +52,7 @@
54
52
  "refresh-npm-token": "src/refresh-npm-token.mjs",
55
53
  "refresh-py-idx": "src/refresh-py-idx.sh",
56
54
  "send-to-slack": "src/send-to-slack.mjs",
55
+ "snapshot-cnpg": "src/snapshot-cnpg.mjs",
57
56
  "tag-release": "src/tag-release.mjs",
58
57
  "unleash": "src/unleash.mjs"
59
58
  },
@@ -62,31 +61,29 @@
62
61
  "dependencies": {
63
62
  "@google-cloud/artifact-registry": "^3.5.0",
64
63
  "@leverege/jsdoc-template": "^1.0.1",
65
- "ansi-colors": "^4.1.3",
66
64
  "chalk": "^5.4.1",
67
65
  "command-line-args": "^6.0.1",
68
66
  "command-line-usage": "^7.0.3",
69
67
  "deepmerge": "^4.3.1",
70
68
  "enquirer": "^2.4.1",
71
69
  "execa": "^9.5.2",
72
- "glob": "^11.0.0",
70
+ "glob": "^11.0.1",
73
71
  "handlebars": "^4.7.8",
74
- "inquirer": "^12.3.0",
72
+ "inquirer": "^12.4.2",
75
73
  "js-yaml": "^4.1.0",
76
74
  "jsdoc": "^4.0.4",
77
75
  "ms": "^2.1.3",
78
76
  "npm-registry-fetch": "^18.0.2",
79
77
  "package-up": "^5.0.0",
80
78
  "parse-gitignore": "^2.0.0",
81
- "read-pkg": "^9.0.1",
82
79
  "readline-sync": "^1.4.10",
83
- "semver": "^7.6.3",
80
+ "semver": "^7.7.1",
84
81
  "simple-git": "^3.27.0",
85
82
  "toml": "^3.0.0",
86
- "zx": "^8.3.0"
83
+ "zx": "^8.3.2"
87
84
  },
88
85
  "devDependencies": {
89
86
  "@leverege/eslint-config-leverege": "^5.0.1",
90
- "npm": "^11.0.0"
87
+ "npm": "^11.1.0"
91
88
  }
92
89
  }
package/src/Docker.mjs CHANGED
@@ -24,7 +24,7 @@ const dockerfileNodeVersion = 'jod-alpine'
24
24
  // the build-tools repository, but it just became simpler to pull the contents
25
25
  // directly into these variables and forego the file loading.
26
26
  //
27
- const pluginTemplate = `
27
+ const dockerfilePluginTemplate = `
28
28
  # Dockerfile.plugin - optionally extend the service Docker image
29
29
  #
30
30
  # This file may be used to run additional docker commands during the image
@@ -38,6 +38,14 @@ const pluginTemplate = `
38
38
  # Keep in mind that the Alpine Linux base image is used to keep image
39
39
  # footprints small, so adding packages "just because" is not considered
40
40
  # a best practice.
41
+ `
42
+ const bashrcPluginTemplate = `
43
+
44
+ # Bashrc.plugin - optionally extend the image .bashrc file
45
+ #
46
+ # This plugin file may contain additional .bashrc settigns / functions to
47
+ # provide on the target image.
48
+
41
49
  `
42
50
  const dockerfileTemplate = fs.readFileSync( path.join( DIRNAME, './templates/dockerfileTemplate.hbs' ), 'utf8' )
43
51
  const bashrcTemplate = fs.readFileSync( path.join( DIRNAME, './templates/bashrcTemplate.hbs' ), 'utf8' )
@@ -66,9 +74,10 @@ const setPreviousBuild = ( version ) => {
66
74
  fs.writeFileSync( previousFile, version )
67
75
  }
68
76
 
69
- const generateDockerfile = ( options ) => {
77
+ const generateDockerfile = async ( options ) => {
70
78
 
71
- const settings = { ...defaultSettings, ...options }
79
+ const gitReference = await shellCmd( 'git rev-parse --short HEAD' )
80
+ const settings = { gitReference, ...defaultSettings, ...options }
72
81
 
73
82
  // defaults to the current "official" version of node unless it gets
74
83
  // overridden in the leverege.nodeimg package.json stanza
@@ -85,24 +94,31 @@ const generateDockerfile = ( options ) => {
85
94
  fs.mkdirSync( './docker' ) // TODO: blindly assumes the mkdir succeeds
86
95
  }
87
96
 
97
+ // Create a bashrc plugin file if one does not already exist
98
+ const bashrcPluginFile = './docker/Bashrc.plugin'
99
+ if ( !fs.existsSync( bashrcPluginFile ) ) {
100
+ warning( `creating the missing ${bashrcPluginFile} file in the docker directory\n` )
101
+ fs.writeFileSync( bashrcPluginFile, bashrcPluginTemplate )
102
+ }
103
+ const bashrcPlugin = fs.readFileSync( bashrcPluginFile )
104
+
105
+ // Build the target bashrc file by using the template plus Bashrc.plugin
88
106
  const bashrcFile = './docker/bashrc'
89
- // DISABLING exists check. With addition of Bashrc.plugin, the file needs to
90
- // always be created or we encounter errors
91
- if ( true ) { // !fs.existsSync( bashrcFile ) ) {
92
- let bf = bashrcTemplate
93
- const bashrcFilePlugin = './docker/Bashrc.plugin'
94
- if ( fs.existsSync( bashrcFilePlugin ) ) {
95
- const bashrcAdditions = fs.readFileSync( bashrcFilePlugin )
96
- bf = `${bf}\n${bashrcAdditions}`
97
- }
98
- warning( `creating the missing ${bashrcFile} file in the docker directory` )
99
- fs.writeFileSync( bashrcFile, bf )
107
+ if ( fs.existsSync( bashrcFile ) ) {
108
+ fs.rmSync( bashrcFile ) // start with a clean bashrc
109
+ }
110
+
111
+ try {
112
+ fs.writeFileSync( bashrcFile, bashrcTemplate )
113
+ fs.appendFileSync( bashrcFile, bashrcPlugin )
114
+ } catch ( err ) {
115
+ errorExit( `***ERROR: failed creation of the ${bashrcFile} file` )
100
116
  }
101
117
 
102
118
  const dockerfilePlugin = './docker/Dockerfile.plugin'
103
119
  if ( !fs.existsSync( dockerfilePlugin ) ) {
104
120
  warning( `creating the missing ${dockerfilePlugin} file in the docker directory` )
105
- fs.writeFileSync( dockerfilePlugin, pluginTemplate )
121
+ fs.writeFileSync( dockerfilePlugin, dockerfilePluginTemplate )
106
122
  }
107
123
 
108
124
  try {
@@ -114,7 +130,7 @@ const generateDockerfile = ( options ) => {
114
130
  errorExit( `***ERROR: expected the ./build directory to exist - ${chalk.yellow( 'npm run build' )}` )
115
131
  }
116
132
 
117
- // At this point the plugin template better exist.
133
+ // At this point the docker plugin file better exist.
118
134
  if ( fs.existsSync( dockerfilePlugin ) ) {
119
135
  settings.pluginfile = fs.readFileSync( dockerfilePlugin )
120
136
  } else {
@@ -173,12 +189,22 @@ const buildContainerImage = async ( {
173
189
  // TODO: This is janky - I'll clean it up later
174
190
  // NOTE: this is dealing with raw filesystem interactions, meaning there
175
191
  // isn't a shell performing file globbing and what not
192
+ //
193
+ // Steps taken here attempt to minimize impact on legacy build setups
194
+ // 1. rename build dir to workspace
195
+ // 2. create the actual build dir and move workspace into it
196
+ // 3. move the Dockerfile into build and make a copy for image root
197
+ // 4. copy the bashrc file into build and .bashrc on the image root
198
+ // 5. drop a copy of dev's npmrc to use for build process
199
+ // 6. drop a copy of package.json and the lock into the image root
200
+ //
176
201
  fs.renameSync( './build', './workspace' )
177
202
  fs.mkdirSync( './build' )
178
203
  fs.renameSync( './workspace', buildWorkspace )
179
204
  fs.renameSync( './docker/Dockerfile', './build/Dockerfile' )
205
+ fs.cpSync( './build/Dockerfile', `${buildWorkspace}/Dockerfile` )
206
+ fs.renameSync( './docker/bashrc', './build/bashrc' )
180
207
  fs.cpSync( `${process.env.HOME}/.npmrc`, './build/.npmrc' )
181
- fs.cpSync( './docker/bashrc', './build/bashrc' )
182
208
  fs.cpSync( './package.json', `${buildWorkspace}/package.json` )
183
209
  fs.cpSync( './package-lock.json', `${buildWorkspace}/package-lock.json` )
184
210
  if ( isNpmWorkspace ) {
@@ -188,7 +214,7 @@ const buildContainerImage = async ( {
188
214
  setPreviousBuild( imageVersion ) // update docker/.previous file
189
215
 
190
216
  const { fullName : builderName } = await getGcpAccount()
191
- const gcloudBuild = `time gcloud builds submit --project ${artifactProject}`
217
+ const gcloudBuild = `gcloud builds submit --project ${artifactProject}`
192
218
  const gcloudLogs = `--gcs-log-dir ${formCloudBuildBucketName( artifactProject )}/log`
193
219
  let gcloudTags = `--tag ${imageName}:${imageVersion}`
194
220
 
package/src/Utils.mjs CHANGED
@@ -54,6 +54,10 @@ export const isString = ( s ) => {
54
54
  * General "yes" to proceed function.
55
55
  */
56
56
  export const proceed = async ( query = 'Do you wish to proceed?' ) => {
57
+ if ( process.env.CICD_PIPELINE === '1' ) {
58
+ log( '\n*** CICD Pipeline - skipping user prompts' )
59
+ return
60
+ }
57
61
  await inquirer.prompt( [
58
62
  {
59
63
  type : 'confirm',
@@ -399,6 +403,7 @@ export const getRepositoryDescr = async () => {
399
403
  const currentDir = process.cwd()
400
404
  const workingDir = process.env.PWD
401
405
  const gitRoot = await getGitRootDirectory()
406
+ const isGitRepo = gitRoot !== undefined
402
407
  const gitHooksPath = await getGitHooksPath()
403
408
  const { branch : gitBranch, upstream : gitUpstream } = await getGitBranchAndUpstream()
404
409
  const subPkgs = await glob( `${gitRoot}/packages/**/package.json`, { ignore : '/**/node_modules/**' } )
@@ -420,6 +425,7 @@ export const getRepositoryDescr = async () => {
420
425
  gitRoot,
421
426
  gitUpstream,
422
427
  helmChart,
428
+ isGitRepo,
423
429
  isMonoRepo,
424
430
  isNpmWorkspace,
425
431
  rootPackageJson,
package/src/bash-funcs CHANGED
@@ -42,6 +42,10 @@ function clearlyWarn() {
42
42
  CLEARWARN
43
43
  }
44
44
 
45
+ function warning() {
46
+ clearlyWarn DO_NOT_CLEAR
47
+ }
48
+
45
49
  function warnOnError() {
46
50
  [ $1 -ne 0 ] && printf "\n$YELO_WARN $2\n"
47
51
  }
@@ -0,0 +1,176 @@
1
+ #!/usr/bin/env node
2
+
3
+ // A simple utility for easily building CNPG based psql images. The resultant
4
+ // image will contain PostgreSQL, the JS query and Timescale extensions, and
5
+ // the extensions that are required by CNPG like barman, pgaudit, pgvector and
6
+ // pg-failover-slots.
7
+ //
8
+ // Latest Versions:
9
+ // postgres => https://www.postgresql.org/
10
+ // timescale => https://docs.timescale.com/about/latest/
11
+ // CNPG images => https://github.com/cloudnative-pg/postgres-containers/pkgs/container/postgresql
12
+
13
+ import fs from 'node:fs'
14
+ import path from 'node:path'
15
+
16
+ import chalk from 'chalk'
17
+ import cliArgs from 'command-line-args'
18
+ import cliHelp from 'command-line-usage'
19
+ import Handlebars from 'handlebars'
20
+
21
+ import {
22
+ debug,
23
+ log,
24
+ err,
25
+ errorExit,
26
+ shellCmd,
27
+ } from './Utils.mjs'
28
+
29
+ // Define CLI options
30
+ const optionList = [
31
+ { name : 'sub-tag', type : String, description : '{green sub-tag to add to the image tag (required)}', defaultOption : true },
32
+ { name : 'pg-version', type : String, description : '{green pgsql version (default: 16.6)}' },
33
+ { name : 'version', type : Boolean, description : '{green show script version}' },
34
+ { name : 'help', type : Boolean, description : '{green display this help screen}' },
35
+ ]
36
+
37
+ const sections = [
38
+ {
39
+ header : 'Leverege CNPG Docker Image Builder',
40
+ content : `{green This tool will build a PostgreSQL based image that is suitable for
41
+ deployment by the CNPG operator. It builds the docker image by using an
42
+ official CNPG docker image as a base and added the jsquery and timescale
43
+ extensions for use within a Leverege k8s cluster. The resultant image may be
44
+ used in the standard PostgreSQL configuration which is used by the stack
45
+ components, as well as timescale based services like transponder tsdb and
46
+ dense history.}`
47
+ },
48
+ {
49
+ header : 'Options',
50
+ optionList
51
+ },
52
+ {
53
+ header : 'Leverege Registry Image Tag',
54
+ content : `{green The resultant image will be tagged with a label comprised of the PG version,
55
+ the specified --sub-tag and a fixed string:
56
+
57
+ {yellow <PG ver>-cnpg-lvrg-<sub tag>}
58
+
59
+ For example, version {yellow 16.6} with a sub tag of {yellow rel.1} will be tagged:
60
+
61
+ {yellow 16.6-cnpg-lvrg-rel.1}}`
62
+ },
63
+ ]
64
+ const args = cliArgs( optionList, { camelCase : true, partial : true } )
65
+ const help = cliHelp( sections )
66
+
67
+ debug( { args, help }, '<==Command Line Info?' )
68
+
69
+ // Show help if needed
70
+ if ( args.help ) {
71
+ log( help )
72
+ process.exit( 0 )
73
+ }
74
+
75
+ // Define defaults
76
+ const PG_VERSION = args.pgVersion || '16.6'
77
+ const { subTag } = args
78
+ if ( !subTag ) {
79
+ errorExit( 'Error: An image version must be specified.' )
80
+ }
81
+
82
+ const LEVEREGE_REGISTRY = 'us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql'
83
+ const LEVEREGE_IMAGE_TAG = `${PG_VERSION}-cnpg-lvrg-${subTag}`
84
+ const LEVEREGE_IMAGE_NAME_WITH_TAG = `${LEVEREGE_REGISTRY}:${LEVEREGE_IMAGE_TAG}`
85
+
86
+ const DOCKERFILE_TEMPLATE = `
87
+ FROM ghcr.io/cloudnative-pg/postgresql:{{PG_VERSION}}-bookworm
88
+
89
+ USER root
90
+
91
+ RUN set -xe; \\
92
+ apt-get update; \\
93
+ apt-get install -y --no-install-recommends \\
94
+ "postgresql-\${PG_MAJOR}-jsquery"; \\
95
+ rm -fr /tmp/*; \\
96
+ rm -rf /var/lib/apt/lists/*;
97
+
98
+ RUN apt-get update \\
99
+ && apt-get install -y lsb-release wget \\
100
+ && echo "deb https://packagecloud.io/timescale/timescaledb/debian/ $(lsb_release -c -s) main" | tee /etc/apt/sources.list.d/timescaledb.list \\
101
+ && wget --quiet -O - https://packagecloud.io/timescale/timescaledb/gpgkey | apt-key add - \\
102
+ && apt-get update \\
103
+ && apt-get install -y "timescaledb-2-postgresql-\${PG_MAJOR}" \\
104
+ && apt-get remove -y lsb-release wget \\
105
+ && rm -fr /tmp/* \\
106
+ && rm -rf /var/lib/apt/lists/*;
107
+
108
+ RUN usermod -u 26 postgres
109
+ USER 26
110
+ `
111
+
112
+ // Check for existing image
113
+ const checkExistingImage = async ( imageName ) => {
114
+ const dockerResults = await shellCmd( `docker image list ${imageName} --quiet` )
115
+ debug( { imageName, dockerResults }, '<==docker image list' )
116
+ return dockerResults
117
+ }
118
+
119
+ // Build and push Docker image
120
+ const buildAndPushImage = async () => {
121
+ const template = Handlebars.compile( DOCKERFILE_TEMPLATE )
122
+ const renderedDockerfile = template( { PG_VERSION } )
123
+ debug( { renderedDockerfile }, '<==Dockerfile' )
124
+
125
+ // Write the Dockerfile to a temporary location
126
+ const dockerfilePath = path.resolve( 'Dockerfile.temp' )
127
+ fs.writeFileSync( dockerfilePath, renderedDockerfile )
128
+
129
+ // Build the image
130
+ log( chalk.yellow( '\nBuilding Docker image...' ) )
131
+ await shellCmd( `docker build --file ${dockerfilePath} --tag ${LEVEREGE_IMAGE_NAME_WITH_TAG} .`, { stdio : 'inherit' } )
132
+
133
+ // Push the image
134
+ log( chalk.green( '\nPushing Docker image...' ) )
135
+ await shellCmd( `docker push ${LEVEREGE_IMAGE_NAME_WITH_TAG}`, { stdio : 'inherit' } )
136
+
137
+ // Clean up the temporary Dockerfile
138
+ fs.unlinkSync( dockerfilePath )
139
+ }
140
+
141
+ // Main execution flow
142
+ try {
143
+ if ( await checkExistingImage( LEVEREGE_IMAGE_NAME_WITH_TAG ) ) {
144
+ err(
145
+ `${chalk.red( '*** ERROR ***' )} The image already exists:\n` +
146
+ ` Image : ${chalk.yellow( LEVEREGE_IMAGE_NAME_WITH_TAG )}\n` +
147
+ ` Registry: ${chalk.green( LEVEREGE_REGISTRY )}\n` +
148
+ ` Tag : ${chalk.green( LEVEREGE_IMAGE_TAG )}\n`
149
+ )
150
+ process.exit( 1 )
151
+ }
152
+
153
+ log( `${chalk.cyan( '\nAbout to build a new Docker image:\n' )}
154
+ PostgreSQL => ${chalk.green( PG_VERSION )}
155
+ Image Name => ${chalk.green( LEVEREGE_IMAGE_NAME_WITH_TAG )}\n` )
156
+
157
+ log( `Enter "${chalk.green( 'yes' )}" to proceed or anything else to exit.` )
158
+ const confirmation = await new Promise( ( resolve ) => {
159
+ process.stdin.once( 'data', data => resolve( data.toString().trim() ) )
160
+ } )
161
+
162
+ if ( confirmation !== 'yes' ) {
163
+ log( chalk.red( 'Aborted by user.' ) )
164
+ process.exit( 1 )
165
+ }
166
+
167
+ await buildAndPushImage()
168
+ log(
169
+ chalk.green( '\nImage built and successfully pushed - tagged => ' ) +
170
+ chalk.yellow( `${LEVEREGE_IMAGE_TAG}` )
171
+ )
172
+ process.exit( 0 )
173
+ } catch ( error ) {
174
+ err( chalk.red( 'An error occurred:' ), error.message )
175
+ process.exit( 1 )
176
+ }
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env node
2
+ /* eslint-disable */
3
+ /*
4
+ * chart-to-registry will...
5
+ */
6
+ import fs from 'node:fs'
7
+
8
+ import chalk from 'chalk'
9
+ import commandLineArgs from 'command-line-args'
10
+ import commandLineUsage from 'command-line-usage'
11
+ import { lt as semverLt } from 'semver'
12
+ import YAML from 'js-yaml'
13
+
14
+ import {
15
+ condir,
16
+ debug,
17
+ errorExit,
18
+ log,
19
+ warning,
20
+ getGitRootDirectory,
21
+ parsePackageJson,
22
+ parseHelmChart,
23
+ shellCmd } from './Utils.mjs'
24
+
25
+ const commandLineOptions = [ // Use commandLineOptions to tie into the Usage statements
26
+
27
+ {
28
+ name : 'location',
29
+ type : String,
30
+ description : '{green the location of the artifact registry the chart will be pushed to (default us-docker.pkg.dev)}',
31
+ },
32
+ {
33
+ name : 'project',
34
+ type : String,
35
+ description : '{green the name of the google project containing the npmrc and slack config secrets (default leverege-registry)}',
36
+ },
37
+ {
38
+ name : 'repository',
39
+ type : String,
40
+ description : '{green the target repository to receive the pushed chart}',
41
+ },
42
+ {
43
+ name : 'dry-run',
44
+ type : Boolean,
45
+ description : '{yellow perform everything except the actual chart push}',
46
+ },
47
+ {
48
+ name : 'help',
49
+ type : Boolean,
50
+ description : '{green display this help screen}',
51
+ },
52
+
53
+ ]
54
+
55
+ const sections = [
56
+ {
57
+ header : 'Leverege Helm Chart Compass (for helmup)',
58
+ content : `{green This tool helps helmup navigate the helm charts stored in the
59
+ artifact-registries.}`
60
+ },
61
+ { header : 'Options',
62
+ optionList : commandLineOptions,
63
+ },
64
+ ]
65
+
66
+ const args = commandLineArgs( commandLineOptions, { camelCase : true, partial : true } )
67
+ const usage = commandLineUsage( sections )
68
+
69
+ if ( args.help ) {
70
+ log( usage )
71
+ process.exit( 0 )
72
+ }
73
+
74
+ /* eslint-disable no-underscore-dangle */
75
+ if ( args._unknown ) {
76
+ log( usage )
77
+ log( `\nUnrecognized argument [${chalk.bold.red( args._unknown )}]\n` )
78
+ process.exit( 1 )
79
+ }
80
+ /* eslint-enable no-underscore-dangle */
81
+
82
+ const minNodejsVersion = '18.0.0'
83
+ if ( semverLt( process.version, minNodejsVersion ) ) {
84
+ errorExit( `\n***ERROR: must be running at least node ${minNodejsVersion}\n` )
85
+ }
86
+
87
+ // First of all, fail if we are not in a git repository
88
+ let gitRoot
89
+ try {
90
+ gitRoot = await getGitRootDirectory()
91
+ } catch ( error ) {
92
+ errorExit( chalk.red.bold( error ), { errorCode : 5 } )
93
+ }
94
+
95
+ const chartCompass = YAML.load( fs.readFileSync( './registry-compass.yaml', 'utf8' ) )
96
+
97
+ condir( { chartCompass }, '<==Navigation' )
@@ -5,7 +5,6 @@
5
5
  import fs from 'node:fs'
6
6
  import toml from 'toml'
7
7
  import chalk from 'chalk'
8
- import semver from 'semver'
9
8
 
10
9
  import {
11
10
  debug, log,
@@ -272,7 +272,9 @@ if ( willGitTag ) {
272
272
  }
273
273
  }
274
274
 
275
- await proceed()
275
+ if ( process.env.DRY_RUN !== '1' ) {
276
+ await proceed()
277
+ }
276
278
 
277
279
  if ( isNpmWorkspace ) {
278
280
  log( chalk.yellow.bold( 'Generating an NPM workspace package-lock.json file' ) )
@@ -19,7 +19,7 @@ cat<<DEPRECATED_TOOL
19
19
  `color y "***DEPRECATED docker-to-registry.sh - upgrade to docker-to-registry.mjs***"`
20
20
 
21
21
  DEPRECATED_TOOL
22
- sleep 3
22
+ exit 1
23
23
 
24
24
  PKGTOP="$npm_config_local_prefix"
25
25
  cd $PKGTOP/docker
@@ -1,5 +1,3 @@
1
- # Artifact Chart => https://artifacthub.io/packages/helm/cloudnative-pg/cloudnative-pg
2
- # Examples Charts => https://cloudnative-pg.io/documentation/current/samples/
3
1
  apiVersion: postgresql.cnpg.io/v1
4
2
  kind: Cluster
5
3
  metadata:
@@ -10,7 +8,7 @@ spec:
10
8
  logLevel: info # warning debug
11
9
 
12
10
  description: "Leverege PG Bench Timescale DB"
13
- imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.1-cnpg-tsdb2-beta.6
11
+ imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:17.2-cnpg-lvrg-rel.2
14
12
  bootstrap:
15
13
  initdb:
16
14
  postInitTemplateSQL:
@@ -60,6 +58,7 @@ spec:
60
58
  # - supervised: requires manual supervision to perform
61
59
  # the switchover of the primary
62
60
  primaryUpdateStrategy: unsupervised
61
+ primaryUpdateMethod: switchover
63
62
 
64
63
  serviceAccountTemplate:
65
64
  metadata:
@@ -1,5 +1,3 @@
1
- # Artifact Chart => https://artifacthub.io/packages/helm/cloudnative-pg/cloudnative-pg
2
- # Examples Charts => https://cloudnative-pg.io/documentation/current/samples/
3
1
  apiVersion: postgresql.cnpg.io/v1
4
2
  kind: Cluster
5
3
  metadata:
@@ -13,7 +11,7 @@ spec:
13
11
  enablePodMonitor: false # set true once monitoring is setup
14
12
 
15
13
  description: "Leverege Stack PostgreSQL DB"
16
- imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.4-cnpg-tsdb2-rel.1
14
+ imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:17.2-cnpg-lvrg-rel.2
17
15
  bootstrap:
18
16
  initdb:
19
17
  # database: models # do not set - let it default to cnpg app db
@@ -66,6 +64,7 @@ spec:
66
64
  # - supervised: requires manual supervision to perform
67
65
  # the switchover of the primary
68
66
  primaryUpdateStrategy: unsupervised
67
+ primaryUpdateMethod: switchover
69
68
 
70
69
  serviceAccountTemplate:
71
70
  metadata:
@@ -1,5 +1,3 @@
1
- # Artifact Chart => https://artifacthub.io/packages/helm/cloudnative-pg/cloudnative-pg
2
- # Examples Charts => https://cloudnative-pg.io/documentation/current/samples/
3
1
  apiVersion: postgresql.cnpg.io/v1
4
2
  kind: Cluster
5
3
  metadata:
@@ -13,7 +11,7 @@ spec:
13
11
  enablePodMonitor: false # set true once monitoring is setup
14
12
 
15
13
  description: "Leverege CNPG DB (recovered)"
16
- imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.4-cnpg-tsdb2-rel.1
14
+ imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:17.2-cnpg-lvrg-rel.2
17
15
  bootstrap:
18
16
  recovery:
19
17
  volumeSnapshots:
@@ -61,6 +59,7 @@ spec:
61
59
  # - supervised: requires manual supervision to perform
62
60
  # the switchover of the primary
63
61
  primaryUpdateStrategy: unsupervised
62
+ primaryUpdateMethod: switchover
64
63
 
65
64
  serviceAccountTemplate:
66
65
  metadata:
@@ -1,5 +1,3 @@
1
- # Artifact Chart => https://artifacthub.io/packages/helm/cloudnative-pg/cloudnative-pg
2
- # Examples Charts => https://cloudnative-pg.io/documentation/current/samples/
3
1
  apiVersion: postgresql.cnpg.io/v1
4
2
  kind: Cluster
5
3
  metadata:
@@ -13,7 +11,7 @@ spec:
13
11
  enablePodMonitor: false # set true once monitoring is setup
14
12
 
15
13
  description: "Leverege Plain Timescale DB"
16
- imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.4-cnpg-tsdb2-rel.1
14
+ imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:17.2-cnpg-lvrg-rel.2
17
15
  bootstrap:
18
16
  initdb:
19
17
  # database: imagine # let it default to cnpg app db
@@ -74,6 +72,7 @@ spec:
74
72
  # - supervised: requires manual supervision to perform
75
73
  # the switchover of the primary
76
74
  primaryUpdateStrategy: unsupervised
75
+ primaryUpdateMethod: switchover
77
76
 
78
77
  serviceAccountTemplate:
79
78
  metadata:
@@ -1,5 +1,3 @@
1
- # Artifact Chart => https://artifacthub.io/packages/helm/cloudnative-pg/cloudnative-pg
2
- # Examples Charts => https://cloudnative-pg.io/documentation/current/samples/
3
1
  apiVersion: postgresql.cnpg.io/v1
4
2
  kind: Cluster
5
3
  metadata:
@@ -13,7 +11,7 @@ spec:
13
11
  enablePodMonitor: false # set true once monitoring is setup
14
12
 
15
13
  description: "Leverege Dense Timescale DB"
16
- imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:16.4-cnpg-tsdb2-rel.1
14
+ imageName: us-docker.pkg.dev/leverege-registry/system/images/leverege-pgsql:17.2-cnpg-lvrg-rel.2
17
15
  bootstrap:
18
16
  initdb:
19
17
  postInitTemplateSQL:
@@ -69,6 +67,7 @@ spec:
69
67
  # - supervised: requires manual supervision to perform
70
68
  # the switchover of the primary
71
69
  primaryUpdateStrategy: unsupervised
70
+ primaryUpdateMethod: switchover
72
71
 
73
72
  serviceAccountTemplate:
74
73
  metadata:
@@ -4,20 +4,23 @@ showInstalling "The Prometheus Operator and Components"
4
4
  addHelmRepo prometheus-community https://prometheus-community.github.io/helm-charts
5
5
 
6
6
  showInstalling "The Prometheus Operator (kube-prometheus-stack)"
7
- [ -z "$PROMETHEUS_STACK_CHART_VERSION" ] && PROMETHEUS_STACK_CHART_VERSION="67"
7
+ [ -z "$PROMETHEUS_STACK_CHART_VERSION" ] && PROMETHEUS_STACK_CHART_VERSION="68"
8
8
 
9
9
  NS="--namespace prometheus"
10
10
 
11
+ # https://artifacthub.io/packages/helm/prometheus-community/kube-prometheus-stack
11
12
  helm upgrade $NS --install prometheus-stack prometheus-community/kube-prometheus-stack \
12
13
  --values prom-operator/prometheus-stack.yaml \
13
14
  --version $PROMETHEUS_STACK_CHART_VERSION $HELM_WHAT
14
15
 
16
+ # https://artifacthub.io/packages/helm/prometheus-community/prometheus-elasticsearch-exporter
15
17
  showInstalling "The Elasticsearch Exporter (prom-operator)"
16
18
  [ -z "$ELASTICSEARCH_EXPORTER_CHART_VERSION" ] && ELASTICSEARCH_EXPORTER_CHART_VERSION="6"
17
19
  helm upgrade $NS --install elasticsearch8-exporter prometheus-community/prometheus-elasticsearch-exporter \
18
20
  --values prom-operator/elasticsearch-exporter.yaml \
19
21
  --version $ELASTICSEARCH_EXPORTER_CHART_VERSION $HELM_WHAT
20
22
 
23
+ # https://artifacthub.io/packages/helm/prometheus-community/prometheus-stackdriver-exporter
21
24
  showInstalling "The Stackdriver Exporter (prom-operator)"
22
25
  [ -z "$STACKDRIVER_EXPORTER_CHART_VERSION" ] && STACKDRIVER_EXPORTER_CHART_VERSION="4"
23
26
  helm upgrade $NS --install stackdriver-exporter prometheus-community/prometheus-stackdriver-exporter \
@@ -128,6 +128,15 @@ export default class Config {
128
128
 
129
129
  async bootstrapHookAndRelease() {
130
130
  const repoDescr = await getRepositoryDescr()
131
+ if ( !repoDescr.isGitRepo ) {
132
+ const notGitRepo = `
133
+ The hook-and-release script only works with git repositories. Try running:
134
+
135
+ git init && hook-and-release --init
136
+
137
+ to initialize git and hook-and-release.`
138
+ errorExit( notGitRepo )
139
+ }
131
140
  this.gitRoot = repoDescr.gitRoot
132
141
  this.gitBranch = repoDescr.gitBranch
133
142
  this.gitHooksPath = repoDescr.gitHooksPath
@@ -1,4 +1,4 @@
1
- # Version {{regvers}} @ {{date}}
1
+ # Version {{regvers}} @ {{date}} / Git Ref: {{gitReference}}
2
2
 
3
3
  # The FROM directive sets the Base Image for subsequent instructions
4
4
  FROM {{image}} as intermediate
@@ -25,11 +25,11 @@ COPY ./.npmrc ${NPM_CONFIG_USERCONFIG}
25
25
  RUN if [ "${BUILD_ENV}" = "debian" ]; then \
26
26
  apt-get update && \
27
27
  apt-get install -y wget openssh-client build-essential && \
28
- npm install -g npm@10; \
28
+ npm install -g {{npmVersion}}; \
29
29
  else \
30
30
  apk --no-cache add openssh-client && \
31
31
  apk --update add --no-cache --virtual build-dep g++ gcc libgcc libstdc++ linux-headers make {{apkadds}} && \
32
- npm install -g npm@10; \
32
+ npm install -g {{npmVersion}}; \
33
33
  fi
34
34
 
35
35
  # Use SKIP_PREPARE to disable hook-and-release from running
@@ -58,13 +58,13 @@ COPY ./.npmrc ${NPM_CONFIG_USERCONFIG}
58
58
  RUN if [ "$BUILD_ENV" = "debian" ]; then \
59
59
  apt-get update && \
60
60
  apt-get install -y tini bash curl vim {{apkadds}} && \
61
- npm install -g npm@10 && \
61
+ npm install -g {{npmVersion}} && \
62
62
  rm /bin/sh && ln -s /bin/bash /bin/sh && \
63
63
  mkdir -p /usr/src/app /tmp/levlog && chown node:node /usr/src/app; \
64
64
  else \
65
65
  apk update && \
66
66
  apk add --no-cache bash curl tini vim {{apkadds}} && \
67
- npm install -g npm@10 && \
67
+ npm install -g {{npmVersion}} && \
68
68
  rm /bin/sh && ln -s /bin/bash /bin/sh && \
69
69
  mkdir -p /usr/src/app /tmp/levlog && chown node:node /usr/src/app; \
70
70
  fi
@@ -83,4 +83,4 @@ COPY --chown=node:node --from=intermediate /usr/src/app /usr/src/app
83
83
 
84
84
  USER {{runuser}}
85
85
  COPY ./bashrc /home/node/.bashrc
86
- CMD [ "/bin/bash", "-c", "source /home/node/.bashrc && node index.js" ]
86
+ CMD [ "/bin/bash", "-c", "source /home/node/.bashrc && node index.js" ]
@@ -13,6 +13,7 @@ RUN useradd -ms /bin/bash {{runuser}} && \
13
13
  && rm -rf /var/lib/apt/lists/*
14
14
 
15
15
  # gcc \
16
+ # git \
16
17
  # libgl1 \
17
18
  # libglib2.0-0 \
18
19
  # && rm -rf /var/lib/apt/lists/*
@@ -44,6 +45,10 @@ ENV PATH="$VIRTUAL_ENV/bin:$PATH"
44
45
  RUN uv pip install keyring
45
46
  RUN uv pip install keyrings.google-artifactregistry-auth
46
47
 
48
+ #RUN echo "extra-index-url = https://oauth2accesstoken@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple" >> ~/.config/pip/pip.conf
49
+ #ENV UV_EXTRA_INDEX_URL "https://oauth2accesstoken@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple"
50
+
51
+
47
52
  {{preInstallPluginfile}}
48
53
 
49
54
  RUN uv sync --keyring-provider subprocess --extra-index-url https://oauth2accesstoken@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple
@@ -51,5 +56,8 @@ RUN uv sync --keyring-provider subprocess --extra-index-url https://oauth2access
51
56
  # Pull in the Dockerfile.plugin file here
52
57
  {{pluginfile}}
53
58
 
59
+ #USER {{runuser}}
60
+ #COPY ./bashrc /home/{{runuser}}/.bashrc
54
61
  RUN ls /usr/src/app/.venv/bin
55
62
  CMD [ "/bin/bash", "-c", "source /home/{{runuser}}/.bashrc && python scripts/server.py" ]
63
+ #CMD [ "/bin/bash" ]
package/.har/config.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "protected-branches": [
3
- "development",
4
- "main"
5
- ],
6
- "npm-scripts": [
7
- "lint",
8
- "test"
9
- ],
10
- "ignore-packages": []
11
- }
package/.har/pre-commit DELETED
@@ -1 +0,0 @@
1
- hook-and-release
package/.har/pre-push DELETED
@@ -1 +0,0 @@
1
- hook-and-release
@@ -1,18 +0,0 @@
1
- {
2
- "workbench.colorCustomizations": {
3
- "commandCenter.border": "#e7e7e799",
4
- "sash.hoverBorder": "#065782",
5
- "statusBar.background": "#0877b3",
6
- "statusBar.border": "#0877b3",
7
- "statusBar.foreground": "#e7e7e7",
8
- "statusBarItem.hoverBackground": "#0a97e4",
9
- "statusBarItem.remoteBackground": "#0877b3",
10
- "statusBarItem.remoteForeground": "#e7e7e7",
11
- "titleBar.activeBackground": "#0877b3",
12
- "titleBar.activeForeground": "#e7e7e7",
13
- "titleBar.border": "#0877b3",
14
- "titleBar.inactiveBackground": "#0877b399",
15
- "titleBar.inactiveForeground": "#e7e7e799"
16
- },
17
- "peacock.color": "#0877b3"
18
- }