@leverege/build-tools 2.48.4 → 2.48.5
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 +1 -1
- package/src/Utils.mjs +6 -2
- package/src/chart-to-registry.mjs +24 -6
package/package.json
CHANGED
package/src/Utils.mjs
CHANGED
|
@@ -317,7 +317,7 @@ https://console.cloud.google.com/artifacts/browse/leverege-registry?project=leve
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
// DEPRECATED: old museum reference to push-my-chart instead of chart-to-registry
|
|
320
|
-
if ( museum.match( 'push-my-chart' ) ) {
|
|
320
|
+
if ( museum.match( 'DISABLED-push-my-chart' ) ) {
|
|
321
321
|
const deprecationError = `
|
|
322
322
|
|
|
323
323
|
Update the npm museum script to use chart-to-registry instead of the deprecated
|
|
@@ -341,13 +341,17 @@ export const parseHelmChart = async ( helmroot = './helm' ) => {
|
|
|
341
341
|
if ( !existsSync( helmroot ) ) { return undefined }
|
|
342
342
|
const chartFiles = readdirSync( helmroot, { encoding : 'utf8', recursive : true } )
|
|
343
343
|
const chartYaml = YAML.load( readFileSync( `${helmroot}/Chart.yaml`, 'utf8' ) )
|
|
344
|
-
const
|
|
344
|
+
const chartName = chartYaml.name
|
|
345
|
+
const chartVersion = chartYaml.version
|
|
346
|
+
const chartPackage = `${chartName}-${chartVersion}.tgz`
|
|
345
347
|
const valuesYaml = YAML.load( readFileSync( `${helmroot}/values.yaml`, 'utf8' ) )
|
|
346
348
|
const imageRegistry = valuesYaml.image?.registry
|
|
347
349
|
const registryComponents = imageRegistry.split( '/' )
|
|
348
350
|
/* eslint-enable security/detect-non-literal-fs-filename */
|
|
349
351
|
return ( {
|
|
352
|
+
chartName,
|
|
350
353
|
chartPackage,
|
|
354
|
+
chartVersion,
|
|
351
355
|
imageRegistry,
|
|
352
356
|
registryLocation : registryComponents[0],
|
|
353
357
|
registryProject : registryComponents[1],
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
debug,
|
|
14
14
|
errorExit,
|
|
15
15
|
log,
|
|
16
|
+
warning,
|
|
16
17
|
getGitRootDirectory,
|
|
17
18
|
parsePackageJson,
|
|
18
19
|
parseHelmChart,
|
|
@@ -20,11 +21,6 @@ import {
|
|
|
20
21
|
|
|
21
22
|
const commandLineOptions = [ // Use commandLineOptions to tie into the Usage statements
|
|
22
23
|
/* eslint-disable max-len */
|
|
23
|
-
{
|
|
24
|
-
name : 'dry-run',
|
|
25
|
-
type : Boolean,
|
|
26
|
-
description : '{green perform everything except the actuall chart push}',
|
|
27
|
-
},
|
|
28
24
|
{
|
|
29
25
|
name : 'location',
|
|
30
26
|
type : String,
|
|
@@ -40,6 +36,16 @@ const commandLineOptions = [ // Use commandLineOptions to tie into the Usage sta
|
|
|
40
36
|
type : String,
|
|
41
37
|
description : '{green the target repository to receive the pushed chart}',
|
|
42
38
|
},
|
|
39
|
+
{
|
|
40
|
+
name : 'dry-run',
|
|
41
|
+
type : Boolean,
|
|
42
|
+
description : '{yellow perform everything except the actual chart push}',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name : 'force',
|
|
46
|
+
type : Boolean,
|
|
47
|
+
description : '{yellow push the chart even if it already exists in the registry}',
|
|
48
|
+
},
|
|
43
49
|
{
|
|
44
50
|
name : 'help',
|
|
45
51
|
type : Boolean,
|
|
@@ -134,9 +140,21 @@ try {
|
|
|
134
140
|
errorExit( error )
|
|
135
141
|
}
|
|
136
142
|
|
|
143
|
+
const { chartName, chartPackage, chartVersion } = helmChart
|
|
144
|
+
try {
|
|
145
|
+
await shellCmd( `helm pull ${ociPushEndpoint}/${chartName} --version ${chartVersion}` )
|
|
146
|
+
rmSync( chartPackage )
|
|
147
|
+
if ( args.force ) {
|
|
148
|
+
warning( `chart ${chartName} version ${chartVersion} exists - force pushing` )
|
|
149
|
+
} else {
|
|
150
|
+
errorExit( `Error: chart ${chartName} version ${chartVersion} already exists` )
|
|
151
|
+
}
|
|
152
|
+
} catch ( error ) {
|
|
153
|
+
debug( `Chart ${chartName} version ${chartVersion} does not exist - proceeding` )
|
|
154
|
+
}
|
|
155
|
+
|
|
137
156
|
try {
|
|
138
157
|
await shellCmd( 'helm package helm' )
|
|
139
|
-
const { chartPackage } = helmChart
|
|
140
158
|
if ( !existsSync( chartPackage ) ) { // eslint-disable-line security/detect-non-literal-fs-filename
|
|
141
159
|
errorExit( `Error: expected helm package to produce ${chartPackage}` )
|
|
142
160
|
}
|