@leverege/build-tools 2.47.1 → 2.47.3

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.47.1",
3
+ "version": "2.47.3",
4
4
  "description": "A collection of build / support tools for Leverege developers",
5
5
  "main": "index.js",
6
6
  "repository": {
@@ -61,7 +61,7 @@
61
61
  "execa": "^8.0.1",
62
62
  "glob": "^10.3.10",
63
63
  "handlebars": "^4.7.8",
64
- "inquirer": "^9.2.14",
64
+ "inquirer": "^9.2.15",
65
65
  "js-yaml": "^4.1.0",
66
66
  "ms": "^2.1.3",
67
67
  "npm-registry-fetch": "^16.1.0",
package/src/Utils.mjs CHANGED
@@ -320,6 +320,7 @@ https://console.cloud.google.com/artifacts/browse/leverege-registry?project=leve
320
320
 
321
321
  export const parseHelmChart = async ( helmroot = './helm' ) => {
322
322
  /* eslint-disable security/detect-non-literal-fs-filename */
323
+ if ( !existsSync( helmroot ) ) { return undefined }
323
324
  const chartFiles = readdirSync( helmroot, { encoding : 'utf8', recursive : true } )
324
325
  const chartYaml = YAML.load( readFileSync( `${helmroot}/Chart.yaml`, 'utf8' ) )
325
326
  const valuesYaml = YAML.load( readFileSync( `${helmroot}/values.yaml`, 'utf8' ) )
@@ -2,6 +2,8 @@
2
2
  /*
3
3
  * docker-to-registry will...
4
4
  */
5
+ import fs from 'node:fs'
6
+
5
7
  import chalk from 'chalk'
6
8
 
7
9
  import {
@@ -53,6 +55,18 @@ if ( willGitTag && repoIsDirty ) {
53
55
  process.exit( 1 )
54
56
  }
55
57
 
58
+ if ( !fs.existsSync( './helm' ) ) {
59
+ log( `
60
+ ${chalk.red.bold( '***Error: docker-to-registry requires a helm chart directory' )}
61
+
62
+ The docker-to-registry script expects to run in the root directory of a k8s
63
+ service, which requires a helm chart directory. It also expects a docker
64
+ directory but will build that if it does not exist.
65
+
66
+ ` )
67
+ process.exit( 1 )
68
+ }
69
+
56
70
  const repoDescr = await analyzeRepository()
57
71
  debug( { repoDescr }, '<==The Repo Description' )
58
72
 
@@ -131,7 +145,7 @@ const chart = helmChart?.yaml['Chart.yaml']
131
145
  const values = helmChart?.yaml['values.yaml']
132
146
  const expectedChartRegistry = `${artifactRegistry}/images`
133
147
 
134
- if ( expectedChartRegistry !== values.image.registry ) {
148
+ if ( expectedChartRegistry !== values.image?.registry ) {
135
149
  log( `
136
150
  ${chalk.red.bold( '***Error: mismatched package.json registry and helm/values.yaml' )}
137
151
 
@@ -142,12 +156,23 @@ if ( expectedChartRegistry !== values.image.registry ) {
142
156
 
143
157
  Current settings:
144
158
  package.json registry => ${chalk.yellow.bold( artifactRegistry )}
145
- values.yaml registry => ${chalk.red.bold( values.image.registry )}
159
+ values.yaml registry => ${chalk.red.bold( values.image?.registry )}
146
160
 
147
161
  Expected settings:
148
162
  values.yaml registry => ${chalk.green.bold( expectedChartRegistry )}
149
163
  ` )
150
164
 
165
+ if ( !values.image ) {
166
+ log( `
167
+ ${chalk.yellow.bold( '***DEPRECATED: legacy helm charts detected' )}
168
+
169
+ The helm chart structure appears to be based on the pre-ignition helm chart
170
+ layouts. The charts must be upgraded before docker-to-registry can complete
171
+ its job.
172
+
173
+ ` )
174
+ }
175
+
151
176
  process.exit( 1 )
152
177
  }
153
178
 
package/src/k8cryo.sh CHANGED
@@ -2,6 +2,10 @@
2
2
  #
3
3
  . `build-tools --bashfun`
4
4
 
5
+ daysToKeep=${1:-60}
6
+ let hoursToKeep="$daysToKeep*24"
7
+ printf "\ncryo backup set to keep for $daysToKeep days / $hoursToKeep hours\n"
8
+
5
9
  if [ "`basename $0`" == "k8thaw" ];
6
10
  then
7
11
  errorExit "k8thaw - UNDER CONSTRUCTION"
@@ -11,5 +15,6 @@ fi
11
15
  # generating the Date Time Stamp for scheduled backups.
12
16
  DTS="`date -u +\"%Y%m%d%H%M%S\"`"
13
17
 
14
- # The 1440h specifies the number of hours to keep the backup - 60 days
15
- velero backup create velero-cryo-$DTS --ttl 1440h
18
+ printf "\nExecuting = > velero backup create velero-cryo-$DTS --ttl ${hoursToKeep}h\n"
19
+
20
+ velero backup create velero-cryo-$DTS --ttl ${hoursToKeep}h