@leverege/build-tools 2.48.0 → 2.48.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leverege/build-tools",
3
- "version": "2.48.0",
3
+ "version": "2.48.1",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
package/src/Utils.mjs CHANGED
@@ -278,7 +278,7 @@ https://console.cloud.google.com/artifacts/browse/leverege-registry?project=leve
278
278
  }
279
279
 
280
280
  // DEPRECATED: old reference to ./dist should be ./build
281
- const { build, clean, dockerize, } = packageJson.scripts
281
+ const { build, clean, dockerize, museum, } = packageJson.scripts
282
282
 
283
283
  if ( build.match( 'dist' ) || clean.match( 'dist' ) ) {
284
284
  const deprecationError = `
@@ -315,6 +315,24 @@ https://console.cloud.google.com/artifacts/browse/leverege-registry?project=leve
315
315
 
316
316
  deprecated( { deprecationError, deprecationInfo } )
317
317
  }
318
+
319
+ // DEPRECATED: old museum reference to push-my-chart instead of chart-to-registry
320
+ if ( museum.match( 'push-my-chart' ) ) {
321
+ const deprecationError = `
322
+
323
+ Update the npm museum script to use chart-to-registry instead of the deprecated
324
+ push-my-chart script. The new museum target is simply:
325
+ `
326
+ const deprecationInfo = `
327
+ "scripts": {
328
+ ...
329
+ ${chalk.green.bold( '"museum": "chart-to-registry",' )}
330
+ ...
331
+ },
332
+ `
333
+
334
+ deprecated( { deprecationError, deprecationInfo } )
335
+ }
318
336
  return { artifactRegistry, ...packageJson }
319
337
  }
320
338
 
@@ -323,13 +341,15 @@ export const parseHelmChart = async ( helmroot = './helm' ) => {
323
341
  if ( !existsSync( helmroot ) ) { return undefined }
324
342
  const chartFiles = readdirSync( helmroot, { encoding : 'utf8', recursive : true } )
325
343
  const chartYaml = YAML.load( readFileSync( `${helmroot}/Chart.yaml`, 'utf8' ) )
344
+ const chartPackage = `${chartYaml.name}-${chartYaml.version}.tgz`
326
345
  const valuesYaml = YAML.load( readFileSync( `${helmroot}/values.yaml`, 'utf8' ) )
327
346
  /* eslint-enable security/detect-non-literal-fs-filename */
328
347
  return ( {
348
+ chartPackage,
329
349
  files : chartFiles,
330
350
  yaml : {
331
351
  'Chart.yaml' : chartYaml,
332
- 'values.yaml' : valuesYaml
352
+ 'values.yaml' : valuesYaml,
333
353
  }
334
354
  } )
335
355
  }
@@ -2,6 +2,7 @@
2
2
  /*
3
3
  * chart-to-registry will...
4
4
  */
5
+ import { existsSync, rmSync } from 'node:fs'
5
6
 
6
7
  import chalk from 'chalk'
7
8
  import commandLineArgs from 'command-line-args'
@@ -9,7 +10,7 @@ import commandLineUsage from 'command-line-usage'
9
10
  import { lt as semverLt } from 'semver'
10
11
 
11
12
  import {
12
- condir, debug,
13
+ debug,
13
14
  errorExit,
14
15
  log,
15
16
  getGitRootDirectory,
@@ -76,8 +77,6 @@ if ( semverLt( process.version, minNodejsVersion ) ) {
76
77
  errorExit( `\n***ERROR: must be running at least node ${minNodejsVersion}\n` )
77
78
  }
78
79
 
79
- log( { args }, chalk.yellow( '\n\n***WARNING: Under Construction' ) )
80
-
81
80
  // gcloud auth print-access-token | helm registry login -u oauth2accesstoken \
82
81
  // -p ${password} https://us-docker.pkg.dev
83
82
  //
@@ -116,7 +115,22 @@ try {
116
115
  errorExit( error )
117
116
  }
118
117
 
119
- condir( { packageJson, helmChart }, '<==Parsed package and chart' )
118
+ debug( { packageJson, helmChart }, '<==Parsed package and chart' )
119
+
120
+ // helm push helm-package.tgz oci://REGISTRY_NAME/REPOSITORY_NAME/charts/SERVICE
121
+ //
122
+ const ociPushEndpoint = `oci://${args.region}/${args.project}/${args.repository}/charts`
120
123
 
121
- // helm push chart-tarball oci://REGISTRY_NAME/REPOSITORY_NAME/charts/SERVICE
122
- // helm install my-release oci://REGISTRY_NAME/REPOSITORY_NAME/redis
124
+ try {
125
+ await shellCmd( 'helm package helm' )
126
+ const { chartPackage } = helmChart
127
+ if ( !existsSync( chartPackage ) ) { // eslint-disable-line security/detect-non-literal-fs-filename
128
+ errorExit( `Error: expected helm package to produce ${chartPackage}` )
129
+ }
130
+
131
+ log( `\nPushing ${chalk.green.bold( chartPackage )} => ${chalk.green.bold( ociPushEndpoint )}` )
132
+ await shellCmd( `helm push ${chartPackage} ${ociPushEndpoint}` )
133
+ rmSync( chartPackage )
134
+ } catch ( err ) {
135
+ errorExit( err )
136
+ }
@@ -18,7 +18,7 @@ import {
18
18
 
19
19
  import docker from './Docker.mjs'
20
20
 
21
- const minimumBuildToolsVersion = '2.48.0'
21
+ const minimumBuildToolsVersion = '2.48.1'
22
22
 
23
23
  // refresh-npm-token does not throw so no need to try, but it emits in debug
24
24
  const refreshErr = await shellCmd( 'refresh-npm-token' )
package/src/dockreate.sh CHANGED
@@ -10,7 +10,9 @@ fi
10
10
  . `build-tools --bashfun`
11
11
  cat<<DOCKREATE_DEPRECATED
12
12
 
13
- `color y "***DOCKREATE is DEPRECATED - move to docker-to-registry***"`
13
+ `color r "***DOCKREATE is DEPRECATED - move to docker-to-registry***"`
14
+
15
+ For guidance on transitioning run `color g docker-to-registry guide-me`
14
16
 
15
17
  DOCKREATE_DEPRECATED
16
18
  sleep 3