@leverege/build-tools 2.50.0 → 2.50.2
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/bash-funcs +1 -1
- package/src/firebaseDeploy.mjs +16 -13
- package/src/firebaseServe.mjs +4 -1
- package/registry-compass.yaml +0 -20
- package/src/chart-compass.mjs +0 -96
package/package.json
CHANGED
package/src/bash-funcs
CHANGED
|
@@ -156,7 +156,7 @@ function sendToSlack() {
|
|
|
156
156
|
\`$toPost\`
|
|
157
157
|
node `node --version` / `build-tools --version` / helm `helm version --short`
|
|
158
158
|
EOSLACK
|
|
159
|
-
send-to-slack --project leverege-registry \
|
|
159
|
+
send-to-slack --project ${REFRESH_NPM_PROJECT:-leverege-registry} \
|
|
160
160
|
--config REFRESH_NPM_SLACK_CONFIG \
|
|
161
161
|
--message "\"$slackmsg\""
|
|
162
162
|
# the "\"$var\"" escaped " is necessary for proper message encapsulation
|
package/src/firebaseDeploy.mjs
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// https://github.com/google/zx
|
|
4
4
|
/* eslint-disable max-len */
|
|
5
5
|
import pkg from 'enquirer'
|
|
6
|
-
import colors from 'ansi-colors'
|
|
7
6
|
import { $, fs, argv, path, chalk } from 'zx'
|
|
8
7
|
|
|
9
8
|
const { prompt } = pkg
|
|
@@ -97,8 +96,8 @@ if ( INTERACTIVE_MODE ) {
|
|
|
97
96
|
name : 'targetEnv',
|
|
98
97
|
message : 'To which environment would you like to deploy?',
|
|
99
98
|
choices : Object.values( targets ).map( ( t ) => {
|
|
100
|
-
const productionLabel = t.production ?
|
|
101
|
-
return { message : `${
|
|
99
|
+
const productionLabel = t.production ? chalk.bold.red( '--PRODUCTION--' ) : ''
|
|
100
|
+
return { message : `${chalk.bold.cyan( 'Site: ' )}${t.siteId.padEnd( maxSiteIdLength )} ${chalk.bold.green( 'Project: ' )}${t.projectId} ${productionLabel}`, value : t.alias }
|
|
102
101
|
} )
|
|
103
102
|
} ] )
|
|
104
103
|
|
|
@@ -108,7 +107,7 @@ if ( INTERACTIVE_MODE ) {
|
|
|
108
107
|
const { confirmProductionDeploy } = await prompt( [ {
|
|
109
108
|
type : 'confirm',
|
|
110
109
|
name : 'confirmProductionDeploy',
|
|
111
|
-
message : `${
|
|
110
|
+
message : `${chalk.bold.red( 'WARNING: ' )} This is a ${chalk.bold.yellow( 'PRODUCTION' )} environment. Are you sure you want to deploy here?`
|
|
112
111
|
} ] )
|
|
113
112
|
if ( !confirmProductionDeploy ) {
|
|
114
113
|
console.log( 'Cancelling deployment...' )
|
|
@@ -169,14 +168,14 @@ if ( aliasFileExists ) {
|
|
|
169
168
|
exec.push( fs.readFile( path.join( process.cwd(), SECRETS_DIR, `${TARGET.siteId}.env` ), { encoding : 'utf-8' } ) )
|
|
170
169
|
}
|
|
171
170
|
|
|
172
|
-
console.log( `\n\n\n${
|
|
173
|
-
console.log( `${
|
|
174
|
-
console.log( `${
|
|
175
|
-
console.log( `${
|
|
176
|
-
console.log( `${
|
|
177
|
-
console.log( `${
|
|
178
|
-
console.log( `${
|
|
179
|
-
console.log( `${
|
|
171
|
+
console.log( `\n\n\n${chalk.bold.green( '====== Deployment Summary ======' )}` )
|
|
172
|
+
console.log( `${chalk.blue( 'Firebase project:' )} ${TARGET.projectId} ${TARGET.production ? chalk.yellow( '--PRODUCTION--' ) : ''}` )
|
|
173
|
+
console.log( `${chalk.blue( 'Site ID:' )} ${TARGET.siteId}` )
|
|
174
|
+
console.log( `${chalk.blue( 'Channel Name:' )} ${CHANNEL?.name ?? chalk.italic.gray( '(none)' )}` )
|
|
175
|
+
console.log( `${chalk.blue( 'Channel Expiration date:' )} ${CHANNEL?.name ? CHANNEL.expiration ?? chalk.italic.gray( '(none)' ) : chalk.italic.gray( '(n/a)' )}` )
|
|
176
|
+
console.log( `${chalk.blue( 'Shared .env file:' )} ${sharedFileExists ? `${SECRETS_DIR}/shared.env` : chalk.italic.gray( '(none)' )}` )
|
|
177
|
+
console.log( `${chalk.blue( 'Additional .env overrides:' )} ${aliasFileExists ? `${SECRETS_DIR}/${TARGET.alias}.env` : `${SECRETS_DIR}/${TARGET.siteId}.env`}` )
|
|
178
|
+
console.log( `${chalk.bold.green( '===============================' )}` )
|
|
180
179
|
|
|
181
180
|
if ( INTERACTIVE_MODE ) {
|
|
182
181
|
const { confirmSelections } = await prompt( [ {
|
|
@@ -192,12 +191,15 @@ if ( INTERACTIVE_MODE ) {
|
|
|
192
191
|
}
|
|
193
192
|
const envFileContent = ( await Promise.all( exec ) ).join( '\n' )
|
|
194
193
|
|
|
194
|
+
const ac = new AbortController()
|
|
195
|
+
|
|
195
196
|
EXIT_EVENTS
|
|
196
197
|
.forEach( ( event ) => {
|
|
197
198
|
process.on( event, () => {
|
|
198
199
|
if ( !exited ) {
|
|
199
200
|
exited = true
|
|
200
201
|
fs.removeSync( path.join( process.cwd(), '.env.temp' ) )
|
|
202
|
+
ac.abort()
|
|
201
203
|
}
|
|
202
204
|
} )
|
|
203
205
|
} )
|
|
@@ -210,7 +212,8 @@ try {
|
|
|
210
212
|
const deployType = CHANNEL ? `hosting:channel:deploy ${CHANNEL.name} ${CHANNEL.expiration ? `--expires ${CHANNEL.expiration}` : ''}`.split( ' ' ) : 'deploy'
|
|
211
213
|
const hostingPrefix = CHANNEL ? '' : 'hosting:'
|
|
212
214
|
|
|
213
|
-
await
|
|
215
|
+
await $( { ac } )`npm run clean && DOTENV_CONFIG_PATH=${path.join( process.cwd(), '.env.temp' )} DEPLOYMENT_TARGET=${TARGET.siteId} npm run build && firebase use ${TARGET.projectId} && firebase ${deployType} --only ${hostingPrefix}${TARGET.siteId}`
|
|
216
|
+
.pipe( process.stdout )
|
|
214
217
|
} catch ( err ) {
|
|
215
218
|
console.error( err )
|
|
216
219
|
}
|
package/src/firebaseServe.mjs
CHANGED
|
@@ -126,12 +126,15 @@ if ( aliasFileExists ) {
|
|
|
126
126
|
|
|
127
127
|
const envFileContent = ( await Promise.all( exec ) ).join( '\n' )
|
|
128
128
|
|
|
129
|
+
const ac = new AbortController()
|
|
130
|
+
|
|
129
131
|
EXIT_EVENTS
|
|
130
132
|
.forEach( ( event ) => {
|
|
131
133
|
process.on( event, () => {
|
|
132
134
|
if ( !exited ) {
|
|
133
135
|
exited = true
|
|
134
136
|
fs.removeSync( path.join( process.cwd(), '.env.temp' ) )
|
|
137
|
+
ac.abort()
|
|
135
138
|
}
|
|
136
139
|
} )
|
|
137
140
|
} )
|
|
@@ -139,7 +142,7 @@ EXIT_EVENTS
|
|
|
139
142
|
await fs.writeFile( path.join( process.cwd(), '.env.temp' ), envFileContent )
|
|
140
143
|
|
|
141
144
|
try {
|
|
142
|
-
await
|
|
145
|
+
await $( { ac } )`DOTENV_CONFIG_PATH=${path.join( process.cwd(), '.env.temp' )} DEPLOYMENT_TARGET=${TARGET.siteId} npm run serve --colors`.pipe( process.stdout )
|
|
143
146
|
} catch ( err ) {
|
|
144
147
|
console.error( err )
|
|
145
148
|
}
|
package/registry-compass.yaml
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
registry:
|
|
2
|
-
- root: us-docker.pkg.dev
|
|
3
|
-
- repositories:
|
|
4
|
-
- name: stack
|
|
5
|
-
charts:
|
|
6
|
-
- api-server
|
|
7
|
-
- authz-server
|
|
8
|
-
- emailer
|
|
9
|
-
- message-processor
|
|
10
|
-
- name: leverege
|
|
11
|
-
charts:
|
|
12
|
-
- pubsub-pulse
|
|
13
|
-
- pusher
|
|
14
|
-
- overdose
|
|
15
|
-
- name: cox-health
|
|
16
|
-
charts:
|
|
17
|
-
- actions-server
|
|
18
|
-
- analytics-server
|
|
19
|
-
- centrak-healthz
|
|
20
|
-
- centrak-ingestor
|
package/src/chart-compass.mjs
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/*
|
|
3
|
-
* chart-to-registry will...
|
|
4
|
-
*/
|
|
5
|
-
import fs from 'node:fs'
|
|
6
|
-
|
|
7
|
-
import chalk from 'chalk'
|
|
8
|
-
import commandLineArgs from 'command-line-args'
|
|
9
|
-
import commandLineUsage from 'command-line-usage'
|
|
10
|
-
import { lt as semverLt } from 'semver'
|
|
11
|
-
import YAML from 'js-yaml'
|
|
12
|
-
|
|
13
|
-
import {
|
|
14
|
-
condir,
|
|
15
|
-
debug,
|
|
16
|
-
errorExit,
|
|
17
|
-
log,
|
|
18
|
-
warning,
|
|
19
|
-
getGitRootDirectory,
|
|
20
|
-
parsePackageJson,
|
|
21
|
-
parseHelmChart,
|
|
22
|
-
shellCmd } from './Utils.mjs'
|
|
23
|
-
|
|
24
|
-
const commandLineOptions = [ // Use commandLineOptions to tie into the Usage statements
|
|
25
|
-
/* eslint-disable max-len */
|
|
26
|
-
{
|
|
27
|
-
name : 'location',
|
|
28
|
-
type : String,
|
|
29
|
-
description : '{green the location of the artifact registry the chart will be pushed to (default us-docker.pkg.dev)}',
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
name : 'project',
|
|
33
|
-
type : String,
|
|
34
|
-
description : '{green the name of the google project containing the npmrc and slack config secrets (default leverege-registry)}',
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name : 'repository',
|
|
38
|
-
type : String,
|
|
39
|
-
description : '{green the target repository to receive the pushed chart}',
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
name : 'dry-run',
|
|
43
|
-
type : Boolean,
|
|
44
|
-
description : '{yellow perform everything except the actual chart push}',
|
|
45
|
-
},
|
|
46
|
-
{
|
|
47
|
-
name : 'help',
|
|
48
|
-
type : Boolean,
|
|
49
|
-
description : '{green display this help screen}',
|
|
50
|
-
},
|
|
51
|
-
/* eslint-enable max-len */
|
|
52
|
-
]
|
|
53
|
-
|
|
54
|
-
const sections = [
|
|
55
|
-
{
|
|
56
|
-
header : 'Leverege Helm Chart Compass (for helmup)',
|
|
57
|
-
content : `{green This tool helps helmup navigate the helm charts stored in the
|
|
58
|
-
artifact-registries.}`
|
|
59
|
-
},
|
|
60
|
-
{ header : 'Options',
|
|
61
|
-
optionList : commandLineOptions,
|
|
62
|
-
},
|
|
63
|
-
]
|
|
64
|
-
|
|
65
|
-
const args = commandLineArgs( commandLineOptions, { camelCase : true, partial : true } )
|
|
66
|
-
const usage = commandLineUsage( sections )
|
|
67
|
-
|
|
68
|
-
if ( args.help ) {
|
|
69
|
-
log( usage )
|
|
70
|
-
process.exit( 0 )
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
/* eslint-disable no-underscore-dangle */
|
|
74
|
-
if ( args._unknown ) {
|
|
75
|
-
log( usage )
|
|
76
|
-
log( `\nUnrecognized argument [${chalk.bold.red( args._unknown )}]\n` )
|
|
77
|
-
process.exit( 1 )
|
|
78
|
-
}
|
|
79
|
-
/* eslint-enable no-underscore-dangle */
|
|
80
|
-
|
|
81
|
-
const minNodejsVersion = '18.0.0'
|
|
82
|
-
if ( semverLt( process.version, minNodejsVersion ) ) {
|
|
83
|
-
errorExit( `\n***ERROR: must be running at least node ${minNodejsVersion}\n` )
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// First of all, fail if we are not in a git repository
|
|
87
|
-
let gitRoot
|
|
88
|
-
try {
|
|
89
|
-
gitRoot = await getGitRootDirectory()
|
|
90
|
-
} catch ( error ) {
|
|
91
|
-
errorExit( chalk.red.bold( error ), { errorCode : 5 } )
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
const chartCompass = YAML.load( fs.readFileSync( './registry-compass.yaml', 'utf8' ) )
|
|
95
|
-
|
|
96
|
-
condir( { chartCompass }, '<==Navigation' )
|