@leverege/build-tools 2.102.0 → 2.104.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/.github/dependabot.yml +7 -0
- package/.vscode/launch.json +10 -0
- package/README.md +22 -9
- package/eslint.config.mjs +13 -0
- package/package.json +7 -10
- package/src/Docker.mjs +3 -3
- package/src/Utils.mjs +6 -4
- package/src/build-cnpg-image.mjs +1 -1
- package/src/chart-compass.mjs +3 -3
- package/src/chart-to-registry.mjs +13 -2
- package/src/circle-orb-it/{circle-orb.yml → circle-npm.yml} +6 -3
- package/src/circle-orb-it/circle-orb-it.mjs +16 -11
- package/src/circle-orb-it/circle-yarn.yml +25 -0
- package/src/custom-images/bitnami-audits/bitnami-audit.mjs +1 -1
- package/src/dashboard/DashboardManager.mjs +6 -0
- package/src/firebaseDeploy.mjs +0 -1
- package/src/firebaseServe.mjs +0 -1
- package/src/overwhelm.mjs +6 -28
- package/src/push-my-chart.mjs +13 -4
- package/src/repo-panopticon.mjs +415 -0
- package/src/service-man/config/CommandLine.mjs +6 -3
- package/src/service-man/config/Config.mjs +1 -1
- package/src/service-man/gcloud-k8s/RolesManager.mjs +1 -1
- package/src/service-man/gcloud-k8s/SecretsManager.mjs +3 -3
- package/src/service-man/gcloud-k8s/ServiceAccountManager.mjs +4 -4
- package/src/unleash.mjs +1 -1
- package/src/pkgck.sh +0 -158
package/.vscode/launch.json
CHANGED
|
@@ -58,6 +58,16 @@
|
|
|
58
58
|
"runtimeExecutable": "node",
|
|
59
59
|
"console": "integratedTerminal"
|
|
60
60
|
},
|
|
61
|
+
{
|
|
62
|
+
"name": "chart-to-registry rsrc-srvr",
|
|
63
|
+
"type": "node",
|
|
64
|
+
"request": "launch",
|
|
65
|
+
"program": "${workspaceFolder}/src/chart-to-registry.mjs",
|
|
66
|
+
"args": [],
|
|
67
|
+
"cwd": "/Users/john/Work/leverege/cicd/@plt/resource-server",
|
|
68
|
+
"runtimeExecutable": "node",
|
|
69
|
+
"console": "integratedTerminal"
|
|
70
|
+
},
|
|
61
71
|
{
|
|
62
72
|
"name": "ingestor in monorepo",
|
|
63
73
|
"type": "node",
|
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ Most tools assume the following are installed and configured:
|
|
|
16
16
|
- `kubectl` (with a valid cluster context)
|
|
17
17
|
- `helm` (v3+)
|
|
18
18
|
- `fzf` (for interactive pod selection in `k8x` and `klog`)
|
|
19
|
-
- Node.js 22+
|
|
19
|
+
- Node.js 22+ - prefer 24
|
|
20
20
|
|
|
21
21
|
---
|
|
22
22
|
|
|
@@ -85,13 +85,15 @@ init-my-chart [--dry-run] [--debug]
|
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
**`chart-to-registry`** — Pushes Helm charts to GCP Artifact Registry with version
|
|
88
|
-
checking and dependency resolution.
|
|
88
|
+
checking and dependency resolution. Warns if `appVersion` in Chart.yaml does not start
|
|
89
|
+
with `v` (bypass with `--ignore-appv`).
|
|
89
90
|
```bash
|
|
90
|
-
chart-to-registry --chart <dir> [--project <id>] [--repository <name>] [--force] [--dry-run]
|
|
91
|
+
chart-to-registry --chart <dir> [--project <id>] [--repository <name>] [--force] [--dry-run] [--ignore-appv]
|
|
91
92
|
```
|
|
92
93
|
|
|
93
94
|
**`push-my-chart`** — Publishes Helm charts to both GCS Chartmuseum (legacy) and
|
|
94
|
-
GCP Artifact Registry.
|
|
95
|
+
GCP Artifact Registry. Displays chart name, version, and appVersion before pushing;
|
|
96
|
+
warns if `appVersion` does not start with `v`.
|
|
95
97
|
```bash
|
|
96
98
|
push-my-chart [--chart <dir>] [--no-registry]
|
|
97
99
|
```
|
|
@@ -226,11 +228,20 @@ Manager, updating `.npmrc` / `.yarnrc.yml`. Skips refresh if the token is less t
|
|
|
226
228
|
refresh-npm-token [--project <id>] [--force] [--dry-run]
|
|
227
229
|
```
|
|
228
230
|
|
|
229
|
-
**`
|
|
230
|
-
|
|
231
|
+
**`repo-panopticon`** — Multi-repo health dashboard. Checks each repository against a suite
|
|
232
|
+
of indicators in a compact 80-column table. Monorepo-aware: workspace packages are
|
|
233
|
+
auto-discovered, grouped under their parent repo label, and checked individually.
|
|
231
234
|
```bash
|
|
232
|
-
|
|
235
|
+
repo-panopticon <dirs...> # check one or more repos / globs
|
|
236
|
+
repo-panopticon @plt/* @kud/* @srv/* # typical full-org sweep
|
|
237
|
+
repo-panopticon --no-pull @plt/* # skip git pull/fetch
|
|
238
|
+
repo-panopticon --limit 40 @srv/* # cap displayed rows (default 80)
|
|
239
|
+
repo-panopticon --concurrency 10 @srv/* # increase parallelism (default 5)
|
|
233
240
|
```
|
|
241
|
+
Columns: `mgr` (npm/yrn) · `pkg` (package.json version) · `git` (latest semver tag) ·
|
|
242
|
+
`scop` (package scope) · `cir` (CircleCI — ✘ missing · L legacy · 1 orb v1 · 2 orb v2) ·
|
|
243
|
+
`ESM` (`"type":"module"`) · `har` (.har hooks directory) · `lnt` (ESLint major version) ·
|
|
244
|
+
`bbl` (Babel presence). Repo name shown in orange when dirty or sync failed.
|
|
234
245
|
|
|
235
246
|
**`pkglint`** — Verifies required documentation files (README.md, LICENSE.md) are
|
|
236
247
|
present before publishing.
|
|
@@ -252,8 +263,9 @@ count-lines-of-code [--src-only]
|
|
|
252
263
|
|
|
253
264
|
### CI/CD Integration
|
|
254
265
|
|
|
255
|
-
**`circle-orb-it`** — Installs or updates CircleCI configuration (Leverege orb) and
|
|
256
|
-
GitHub Dependabot settings for a repository.
|
|
266
|
+
**`circle-orb-it`** — Installs or updates CircleCI configuration (Leverege orb v2.0.0) and
|
|
267
|
+
GitHub Dependabot settings for a repository. Auto-detects npm vs yarn-berry and writes
|
|
268
|
+
the appropriate template. Preserves existing customizations.
|
|
257
269
|
```bash
|
|
258
270
|
circle-orb-it [--dry-run] [--debug]
|
|
259
271
|
```
|
|
@@ -340,6 +352,7 @@ BUILD_TOOLS_DEBUG=1 docker-to-registry
|
|
|
340
352
|
|
|
341
353
|
| Tool | Replacement |
|
|
342
354
|
|------|-------------|
|
|
355
|
+
| `pkgck` | `repo-panopticon` |
|
|
343
356
|
| `docker-to-registry-py` | `docker-to-registry` |
|
|
344
357
|
| `chart-to-museum` | `push-my-chart` |
|
|
345
358
|
| `refresh-py-idx` | No longer needed |
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import eslintConfig from '@leverege/eslint-config-leverege'
|
|
2
|
+
|
|
3
|
+
export default [
|
|
4
|
+
...eslintConfig,
|
|
5
|
+
{
|
|
6
|
+
rules: {
|
|
7
|
+
'@stylistic/curly-newline': 'off',
|
|
8
|
+
'@stylistic/key-spacing': 'off',
|
|
9
|
+
'@stylistic/object-curly-newline': 'off',
|
|
10
|
+
'@stylistic/nonblock-statement-body-position': 'off'
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.104.0",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -9,14 +9,13 @@
|
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
11
|
"clean": "rm -rf lib",
|
|
12
|
-
"lint": "
|
|
12
|
+
"lint": "eslint",
|
|
13
13
|
"prepare": "[ $SKIP_PREPARE ] && exit 0 || ./src/hook-and-release.mjs",
|
|
14
14
|
"test": "mocha -t 60000 --exit 'test/**/!(*e2e*).mjs'",
|
|
15
15
|
"test-all": "mocha -t 60000 --exit 'test/**/**.mjs'",
|
|
16
16
|
"prepack": "npm exec prepack"
|
|
17
17
|
},
|
|
18
18
|
"bin": {
|
|
19
|
-
"build-and-push": "src/build-and-push.sh",
|
|
20
19
|
"build-cnpg-image": "src/build-cnpg-image.mjs",
|
|
21
20
|
"build-tools": "src/build-tools.mjs",
|
|
22
21
|
"change-up": "src/change-up.sh",
|
|
@@ -29,8 +28,6 @@
|
|
|
29
28
|
"decrypt-secrets": "src/decrypt-secrets.sh",
|
|
30
29
|
"dirty-git": "src/dirty-git.sh",
|
|
31
30
|
"docker-to-registry": "src/docker-to-registry.mjs",
|
|
32
|
-
"docker-to-registry-py": "src/docker-to-registry-py.mjs",
|
|
33
|
-
"docker-to-registry.sh": "src/docker-to-registry.sh",
|
|
34
31
|
"dockreate": "src/dockreate.sh",
|
|
35
32
|
"encrypt-secrets": "src/encrypt-secrets.sh",
|
|
36
33
|
"firebaseDeploy": "src/firebaseDeploy.mjs",
|
|
@@ -55,7 +52,7 @@
|
|
|
55
52
|
"npm-link": "src/npm-link.sh",
|
|
56
53
|
"npm-unlink": "src/npm-unlink.sh",
|
|
57
54
|
"overwhelm": "src/overwhelm.mjs",
|
|
58
|
-
"pkgck": "
|
|
55
|
+
"pkgck": "echo '*** Use repo-panopticon instead! ***",
|
|
59
56
|
"pkglint": "src/pkglint.sh",
|
|
60
57
|
"prepack": "src/prepack.mjs",
|
|
61
58
|
"prune-git": "src/prune-git.sh",
|
|
@@ -65,11 +62,10 @@
|
|
|
65
62
|
"push-my-chart": "src/push-my-chart.mjs",
|
|
66
63
|
"refresh-npm-token": "src/refresh-npm-token.mjs",
|
|
67
64
|
"refresh-py-idx": "src/refresh-py-idx.sh",
|
|
65
|
+
"repo-panopticon": "src/repo-panopticon.mjs",
|
|
68
66
|
"send-to-slack": "src/send-to-slack.mjs",
|
|
69
67
|
"service-man": "src/service-man/service-man.mjs",
|
|
70
68
|
"snapshot-cnpg": "src/snapshot-cnpg.mjs",
|
|
71
|
-
"tag-release": "src/tag-release.mjs",
|
|
72
|
-
"unleash": "src/unleash.mjs",
|
|
73
69
|
"upload-model": "src/upload-model.sh",
|
|
74
70
|
"yarn-build": "src/yarn-build.mjs"
|
|
75
71
|
},
|
|
@@ -109,13 +105,14 @@
|
|
|
109
105
|
"sloc": "^0.3.2",
|
|
110
106
|
"superstruct": "^2.0.2",
|
|
111
107
|
"tmp": "^0.2.5",
|
|
112
|
-
"toml": "^
|
|
108
|
+
"toml": "^4.1.1",
|
|
113
109
|
"yaml": "^2.9.0",
|
|
114
110
|
"zx": "^8.8.5"
|
|
115
111
|
},
|
|
116
112
|
"devDependencies": {
|
|
117
|
-
"@leverege/eslint-config-leverege": "^
|
|
113
|
+
"@leverege/eslint-config-leverege": "^9.0.1",
|
|
118
114
|
"chai": "^6.2.2",
|
|
115
|
+
"eslint": "^9",
|
|
119
116
|
"mocha": "^11.7.5",
|
|
120
117
|
"npm": "^11.14.1"
|
|
121
118
|
}
|
package/src/Docker.mjs
CHANGED
|
@@ -98,7 +98,7 @@ const generateDockerfile = async ( options ) => {
|
|
|
98
98
|
// could probably be tightened up a little.
|
|
99
99
|
try {
|
|
100
100
|
fs.readdirSync( './docker' )
|
|
101
|
-
} catch ( err ) {
|
|
101
|
+
} catch ( err ) { // eslint-disable-line no-unused-vars
|
|
102
102
|
warning( 'creating the missing ./docker directory' )
|
|
103
103
|
fs.mkdirSync( './docker' ) // TODO: blindly assumes the mkdir succeeds
|
|
104
104
|
}
|
|
@@ -120,7 +120,7 @@ const generateDockerfile = async ( options ) => {
|
|
|
120
120
|
try {
|
|
121
121
|
fs.writeFileSync( bashrcFile, bashrcTemplate )
|
|
122
122
|
fs.appendFileSync( bashrcFile, bashrcPlugin )
|
|
123
|
-
} catch ( err ) {
|
|
123
|
+
} catch ( err ) { // eslint-disable-line no-unused-vars
|
|
124
124
|
errorExit( `***ERROR: failed creation of the ${bashrcFile} file` )
|
|
125
125
|
}
|
|
126
126
|
|
|
@@ -136,7 +136,7 @@ const generateDockerfile = async ( options ) => {
|
|
|
136
136
|
if ( build.length === 0 ) {
|
|
137
137
|
errorExit( `***ERROR: the build dir is empty - ${chalk.yellow( 'npm run build' )}` )
|
|
138
138
|
}
|
|
139
|
-
} catch ( err ) {
|
|
139
|
+
} catch ( err ) { // eslint-disable-line no-unused-vars
|
|
140
140
|
errorExit( `***ERROR: expected the ${buildDir} directory to exist - ${chalk.yellow( 'npm run build' )}` )
|
|
141
141
|
}
|
|
142
142
|
|
package/src/Utils.mjs
CHANGED
|
@@ -132,7 +132,7 @@ export const shellCmd = async ( cmd, opts = {} ) => {
|
|
|
132
132
|
} else {
|
|
133
133
|
const parsed = parse( cmd ).filter( x => typeof x === 'string' )
|
|
134
134
|
// the leading ; forces a break from previous line otherwise trailing ) and leading [ collide
|
|
135
|
-
;[ command, ...args ] = parsed // eslint-disable-line semi-style
|
|
135
|
+
;[ command, ...args ] = parsed // eslint-disable-line @stylistic/semi-style
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
debug( { command, args }, '<== execa $ invoke' )
|
|
@@ -271,7 +271,7 @@ export const getGitBranchAndUpstream = async () => {
|
|
|
271
271
|
let upstream = 'no-upstream'
|
|
272
272
|
try {
|
|
273
273
|
upstream = await tryCommand( `git rev-parse --abbrev-ref ${branch}@{u}`, 'getGitUpstream' ) ?? 'no-upstream'
|
|
274
|
-
} catch ( error ) {}
|
|
274
|
+
} catch ( error ) {} // eslint-disable-line no-unused-vars
|
|
275
275
|
return { branch, upstream }
|
|
276
276
|
}
|
|
277
277
|
|
|
@@ -534,6 +534,7 @@ export const parseHelmChart = async ( helmroot = './helm' ) => {
|
|
|
534
534
|
const chartName = chartYaml.name
|
|
535
535
|
const chartLibrary = chartYaml?.type === 'library'
|
|
536
536
|
const chartVersion = chartYaml.version
|
|
537
|
+
const chartAppVersion = chartYaml.appVersion
|
|
537
538
|
const chartPackage = `${chartName}-${chartVersion}.tgz`
|
|
538
539
|
const valuesText = fs.readFileSync( `${helmroot}/values.yaml`, 'utf8' )
|
|
539
540
|
const valuesYaml = YAML.load( valuesText )
|
|
@@ -573,6 +574,7 @@ export const parseHelmChart = async ( helmroot = './helm' ) => {
|
|
|
573
574
|
chartLibrary,
|
|
574
575
|
chartPackage,
|
|
575
576
|
chartVersion,
|
|
577
|
+
chartAppVersion,
|
|
576
578
|
hasDependencies,
|
|
577
579
|
depsOutOfSync,
|
|
578
580
|
imageRegistry,
|
|
@@ -708,12 +710,12 @@ export const analyzeRepository = async ( giveGuidance ) => {
|
|
|
708
710
|
let wsName
|
|
709
711
|
try {
|
|
710
712
|
wsName = await shellCmd( 'npm exec -c pwd -ws' )
|
|
711
|
-
} catch ( err ) { }
|
|
713
|
+
} catch ( err ) { } // eslint-disable-line no-unused-vars
|
|
712
714
|
|
|
713
715
|
let gitRemote
|
|
714
716
|
try {
|
|
715
717
|
gitRemote = await shellCmd( 'git config --get remote.origin.url' )
|
|
716
|
-
} catch ( err ) { }
|
|
718
|
+
} catch ( err ) { } // eslint-disable-line no-unused-vars
|
|
717
719
|
|
|
718
720
|
// TODO: Add in Define VERBOSE_DOCKREATE_NPM="yes" for verbose build logging
|
|
719
721
|
// TODO: Validity check for version and package.json
|
package/src/build-cnpg-image.mjs
CHANGED
|
@@ -139,7 +139,7 @@ const buildAndPushImage = async () => {
|
|
|
139
139
|
const dockerfilePath = path.join( buildDir, 'Dockerfile' )
|
|
140
140
|
|
|
141
141
|
try {
|
|
142
|
-
fs.writeFileSync( dockerfilePath, renderedDockerfile )
|
|
142
|
+
fs.writeFileSync( dockerfilePath, renderedDockerfile ) // eslint-disable-line security/detect-non-literal-fs-filename
|
|
143
143
|
|
|
144
144
|
log( chalk.yellow( '\nBuilding Docker image...' ) )
|
|
145
145
|
const cloudBuildSubmit = 'gcloud builds submit --project leverege-registry'
|
package/src/chart-compass.mjs
CHANGED
|
@@ -96,7 +96,7 @@ if ( args.init ) {
|
|
|
96
96
|
errorExit( '\n***ERROR: expected to run in the root of a platform-k8s branch - no overwhelm.yaml present' )
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
if ( fs.existsSync( args.compass ) ) {
|
|
99
|
+
if ( fs.existsSync( args.compass ) ) { // eslint-disable-line security/detect-non-literal-fs-filename
|
|
100
100
|
errorExit( `\n***ERROR: ${args.compass} compass file already exists - not overwriting` )
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -107,12 +107,12 @@ if ( args.init ) {
|
|
|
107
107
|
|
|
108
108
|
// simply wraps the YAML read/sync
|
|
109
109
|
const buildCompassMap = ( yamlFile ) => {
|
|
110
|
-
if ( !fs.existsSync( yamlFile ) ) {
|
|
110
|
+
if ( !fs.existsSync( yamlFile ) ) { // eslint-disable-line security/detect-non-literal-fs-filename
|
|
111
111
|
debug( `chart-compass file ${yamlFile} does not exist` )
|
|
112
112
|
process.exit( 1 )
|
|
113
113
|
}
|
|
114
114
|
|
|
115
|
-
const chartCompass = YAML.load( fs.readFileSync( yamlFile, 'utf8' ) )
|
|
115
|
+
const chartCompass = YAML.load( fs.readFileSync( yamlFile, 'utf8' ) ) // eslint-disable-line security/detect-non-literal-fs-filename
|
|
116
116
|
return chartCompass
|
|
117
117
|
}
|
|
118
118
|
|
|
@@ -14,9 +14,10 @@ import {
|
|
|
14
14
|
errorExit,
|
|
15
15
|
establishOauthAccess,
|
|
16
16
|
log,
|
|
17
|
-
warning,
|
|
18
17
|
parseHelmChart,
|
|
18
|
+
proceed,
|
|
19
19
|
shellCmd,
|
|
20
|
+
warning,
|
|
20
21
|
} from './Utils.mjs'
|
|
21
22
|
|
|
22
23
|
const commandLineOptions = [ // Use commandLineOptions to tie into the Usage statements
|
|
@@ -46,6 +47,11 @@ const commandLineOptions = [ // Use commandLineOptions to tie into the Usage sta
|
|
|
46
47
|
type : Boolean,
|
|
47
48
|
description : '{green update artifact registry auth token and exit}',
|
|
48
49
|
},
|
|
50
|
+
{
|
|
51
|
+
name : 'ignore-appv',
|
|
52
|
+
type : Boolean,
|
|
53
|
+
description : '{green ignore the Char.yaml appVersion format}',
|
|
54
|
+
},
|
|
49
55
|
{
|
|
50
56
|
name : 'dry-run',
|
|
51
57
|
type : Boolean,
|
|
@@ -98,6 +104,11 @@ if ( semverLt( process.version, minNodejsVersion ) ) {
|
|
|
98
104
|
// load up all we need to know about the chart
|
|
99
105
|
const helmChart = await parseHelmChart( args.chart )
|
|
100
106
|
|
|
107
|
+
if ( !helmChart.chartAppVersion.startsWith( 'v' ) && !args.ignoreAppv ) {
|
|
108
|
+
warning( 'Chart.yaml appVersion does not begin with the letter "v"\n' )
|
|
109
|
+
await proceed( 'You sure about this?' )
|
|
110
|
+
}
|
|
111
|
+
|
|
101
112
|
// helm push helm-package.tgz oci://REGISTRY_LOCATION/REGISTRY_PROJECT/REGISTRY_REPOSITORY/charts
|
|
102
113
|
//
|
|
103
114
|
const registryLocation = args.location || helmChart.registryLocation
|
|
@@ -140,7 +151,7 @@ try {
|
|
|
140
151
|
} else {
|
|
141
152
|
errorExit( `\n***ERROR: chart ${chartName} version ${chartVersion} already exists` )
|
|
142
153
|
}
|
|
143
|
-
} catch ( error ) {
|
|
154
|
+
} catch ( error ) { // eslint-disable-line no-unused-vars
|
|
144
155
|
debug( `Chart ${chartName} version ${chartVersion} does not exist - proceeding` )
|
|
145
156
|
}
|
|
146
157
|
|
|
@@ -1,25 +1,28 @@
|
|
|
1
1
|
version: 2.1
|
|
2
2
|
|
|
3
3
|
orbs:
|
|
4
|
-
leverege: leverege/circle-nodejs-ci@
|
|
4
|
+
leverege: leverege/circle-nodejs-ci@2.0.0
|
|
5
5
|
|
|
6
6
|
workflows:
|
|
7
7
|
build-and-verify:
|
|
8
8
|
jobs:
|
|
9
9
|
- leverege/install-dependencies:
|
|
10
10
|
context: npm
|
|
11
|
-
# pkg-manager: yarn-berry # uncomment for Yarn Berry repos
|
|
12
11
|
- leverege/code-analysis:
|
|
12
|
+
context: npm
|
|
13
13
|
requires:
|
|
14
14
|
- leverege/install-dependencies
|
|
15
15
|
- leverege/code-coverage:
|
|
16
|
+
context:
|
|
17
|
+
- npm
|
|
18
|
+
- leverege-gcp # provides GCP_SA_KEY_JSON for tests that need GCP access
|
|
16
19
|
coverage-threshold: 70 # percentage threshold for functions, lines, and statements
|
|
17
|
-
context: leverege-gcp # provides GCP_SA_KEY_JSON for tests that need GCP access
|
|
18
20
|
enable-redis: false # set to true if tests require a live Redis connection
|
|
19
21
|
cache-config: '{"type":"inMemory"}' # sets CACHE_CONFIG env var - options: inMemory, redis
|
|
20
22
|
requires:
|
|
21
23
|
- leverege/install-dependencies
|
|
22
24
|
- leverege/generate-docs:
|
|
25
|
+
context: npm
|
|
23
26
|
requires:
|
|
24
27
|
- leverege/install-dependencies
|
|
25
28
|
- leverege/mirror-to-github:
|
|
@@ -11,14 +11,19 @@ import {
|
|
|
11
11
|
enableDebug,
|
|
12
12
|
errorExit,
|
|
13
13
|
getGitRootDirectory,
|
|
14
|
+
getIsYarnProject,
|
|
14
15
|
log,
|
|
16
|
+
mkdirSafe,
|
|
15
17
|
proceed,
|
|
18
|
+
warning,
|
|
16
19
|
} from '../Utils.mjs'
|
|
17
20
|
|
|
18
|
-
const ORB_VERSION = '
|
|
21
|
+
const ORB_VERSION = '2.0.0' // Keep this in sync with the versions in circle-npm.yml and circle-yarn.yml
|
|
19
22
|
const CIRCLE_DIR = '.circleci'
|
|
20
23
|
const CIRCLE_YML = `${CIRCLE_DIR}/config.yml`
|
|
21
|
-
const
|
|
24
|
+
const CIRCLE_NPM_TEMPLATE = path.join( BUILD_TOOLS_ROOT, 'circle-orb-it', 'circle-npm.yml' )
|
|
25
|
+
const CIRCLE_YARN_TEMPLATE = path.join( BUILD_TOOLS_ROOT, 'circle-orb-it', 'circle-yarn.yml' )
|
|
26
|
+
const CIRCLE_YML_TEMPLATE = isYarn => ( isYarn ? CIRCLE_YARN_TEMPLATE : CIRCLE_NPM_TEMPLATE )
|
|
22
27
|
const GITHUB_DIR = '.github'
|
|
23
28
|
const DEPENDABOT_FILE = `${GITHUB_DIR}/dependabot.yml`
|
|
24
29
|
const DEPENDABOT_TEMPLATE = path.join( BUILD_TOOLS_ROOT, 'circle-orb-it', 'dependabot.yml' )
|
|
@@ -52,9 +57,13 @@ if ( !gitRoot ) {
|
|
|
52
57
|
errorExit( 'This command must be run inside a git repository' )
|
|
53
58
|
}
|
|
54
59
|
|
|
60
|
+
const isYarn = getIsYarnProject( gitRoot )
|
|
61
|
+
const circleTemplate = CIRCLE_YML_TEMPLATE( isYarn )
|
|
62
|
+
log( chalk.blue( `\nPackage manager: ${isYarn ? 'yarn-berry' : 'npm'}` ) )
|
|
63
|
+
|
|
55
64
|
// Warn if this looks like a Python project since the orb is Node.js only
|
|
56
65
|
if ( fs.existsSync( path.join( gitRoot, 'pyproject.toml' ) ) ) {
|
|
57
|
-
|
|
66
|
+
warning( 'pyproject.toml detected - the leverege orb is Node.js only' )
|
|
58
67
|
await proceed( 'Continue anyway?' )
|
|
59
68
|
}
|
|
60
69
|
|
|
@@ -119,7 +128,7 @@ if ( !writeCircleYml && !writeDependabot ) {
|
|
|
119
128
|
|
|
120
129
|
if ( options.dryRun ) {
|
|
121
130
|
if ( writeCircleYml ) {
|
|
122
|
-
let dryRunContent = fs.readFileSync(
|
|
131
|
+
let dryRunContent = fs.readFileSync( circleTemplate, 'utf-8' )
|
|
123
132
|
if ( redisEnabled ) {
|
|
124
133
|
dryRunContent = dryRunContent
|
|
125
134
|
.replace( 'enable-redis: false', 'enable-redis: true' )
|
|
@@ -142,10 +151,8 @@ if ( options.dryRun ) {
|
|
|
142
151
|
// ---------- Write ----------
|
|
143
152
|
|
|
144
153
|
if ( writeCircleYml ) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
let circleYmlContent = fs.readFileSync( CIRCLE_YML_TEMPLATE, 'utf-8' )
|
|
154
|
+
mkdirSafe( circleDir )
|
|
155
|
+
let circleYmlContent = fs.readFileSync( circleTemplate, 'utf-8' )
|
|
149
156
|
if ( redisEnabled ) {
|
|
150
157
|
circleYmlContent = circleYmlContent
|
|
151
158
|
.replace( 'enable-redis: false', 'enable-redis: true' )
|
|
@@ -162,9 +169,7 @@ if ( writeCircleYml ) {
|
|
|
162
169
|
}
|
|
163
170
|
|
|
164
171
|
if ( writeDependabot ) {
|
|
165
|
-
|
|
166
|
-
fs.mkdirSync( githubDir, { recursive : true } )
|
|
167
|
-
}
|
|
172
|
+
mkdirSafe( githubDir )
|
|
168
173
|
fs.writeFileSync( dependabotPath, fs.readFileSync( DEPENDABOT_TEMPLATE, 'utf-8' ) )
|
|
169
174
|
log( chalk.green( `Dependabot config written => ${dependabotPath}` ) )
|
|
170
175
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
version: 2.1
|
|
2
|
+
|
|
3
|
+
orbs:
|
|
4
|
+
leverege: leverege/circle-nodejs-ci@2.0.0
|
|
5
|
+
|
|
6
|
+
workflows:
|
|
7
|
+
build-and-verify:
|
|
8
|
+
jobs:
|
|
9
|
+
- leverege/code-analysis:
|
|
10
|
+
context: npm
|
|
11
|
+
pkg-manager: yarn-berry
|
|
12
|
+
- leverege/code-coverage:
|
|
13
|
+
context:
|
|
14
|
+
- npm
|
|
15
|
+
- leverege-gcp # provides GCP_SA_KEY_JSON for tests that need GCP access
|
|
16
|
+
pkg-manager: yarn-berry
|
|
17
|
+
coverage-threshold: 70 # percentage threshold for functions, lines, and statements
|
|
18
|
+
enable-redis: false # set to true if tests require a live Redis connection
|
|
19
|
+
cache-config: '{"type":"inMemory"}' # sets CACHE_CONFIG env var - options: inMemory, redis
|
|
20
|
+
- leverege/generate-docs:
|
|
21
|
+
context: npm
|
|
22
|
+
pkg-manager: yarn-berry
|
|
23
|
+
- leverege/mirror-to-github:
|
|
24
|
+
context: github-mirror
|
|
25
|
+
# github-team: platform # available teams: platform, utilities, pitcrew, recovr
|
|
@@ -123,7 +123,7 @@ const runner = async ( projects ) => {
|
|
|
123
123
|
log( `Project [${project}]` )
|
|
124
124
|
try {
|
|
125
125
|
await prepareContext( project ) // eslint-disable-line no-await-in-loop
|
|
126
|
-
} catch ( error ) {
|
|
126
|
+
} catch ( error ) { // eslint-disable-line no-unused-vars
|
|
127
127
|
log( `Project or context is invalid, skipping [${chalk.redBright( project )}]` )
|
|
128
128
|
continue
|
|
129
129
|
}
|
|
@@ -59,6 +59,7 @@ export default class DashboardManager {
|
|
|
59
59
|
// leaf directory — apply JSON files using basename as the Grafana folder name
|
|
60
60
|
const folderName = path.basename( dir )
|
|
61
61
|
for ( const file of jsonFiles ) {
|
|
62
|
+
// eslint-disable-next-line no-await-in-loop
|
|
62
63
|
const name = await this.#applyDashboard( folderName, path.join( dir, file.name ) )
|
|
63
64
|
if ( name ) applied.add( name )
|
|
64
65
|
}
|
|
@@ -79,6 +80,7 @@ export default class DashboardManager {
|
|
|
79
80
|
.filter( f => f.endsWith( '.json' ) )
|
|
80
81
|
|
|
81
82
|
for ( const file of files ) {
|
|
83
|
+
// eslint-disable-next-line no-await-in-loop
|
|
82
84
|
const name = await this.#applyDashboard( folder.name, path.join( dir, folder.name, file ) )
|
|
83
85
|
if ( name ) applied.add( name )
|
|
84
86
|
}
|
|
@@ -159,6 +161,7 @@ export default class DashboardManager {
|
|
|
159
161
|
if ( subDirs.length === 0 ) {
|
|
160
162
|
const folderName = path.basename( dir )
|
|
161
163
|
for ( const file of jsonFiles ) {
|
|
164
|
+
// eslint-disable-next-line no-await-in-loop
|
|
162
165
|
const name = await this.#applyDashboard( folderName, path.join( dir, file.name ), local )
|
|
163
166
|
if ( name ) applied.add( name )
|
|
164
167
|
}
|
|
@@ -168,6 +171,7 @@ export default class DashboardManager {
|
|
|
168
171
|
.filter( f => f.endsWith( '.json' ) )
|
|
169
172
|
|
|
170
173
|
for ( const file of files ) {
|
|
174
|
+
// eslint-disable-next-line no-await-in-loop
|
|
171
175
|
const name = await this.#applyDashboard( folder.name, path.join( dir, folder.name, file ), local )
|
|
172
176
|
if ( name ) applied.add( name )
|
|
173
177
|
}
|
|
@@ -259,6 +263,7 @@ export default class DashboardManager {
|
|
|
259
263
|
continue
|
|
260
264
|
}
|
|
261
265
|
try {
|
|
266
|
+
// eslint-disable-next-line no-await-in-loop
|
|
262
267
|
await api.deleteNamespacedConfigMap( { name, namespace : this.#namespace } )
|
|
263
268
|
log( chalk.red( ` ✗ pruned ${name}` ) )
|
|
264
269
|
} catch ( e ) {
|
|
@@ -290,6 +295,7 @@ export default class DashboardManager {
|
|
|
290
295
|
continue
|
|
291
296
|
}
|
|
292
297
|
try {
|
|
298
|
+
// eslint-disable-next-line no-await-in-loop
|
|
293
299
|
await api.deleteNamespacedConfigMap( { name, namespace : this.#namespace } )
|
|
294
300
|
log( chalk.red( ` ✗ pruned (local) ${name}` ) )
|
|
295
301
|
} catch ( e ) {
|
package/src/firebaseDeploy.mjs
CHANGED
package/src/firebaseServe.mjs
CHANGED
package/src/overwhelm.mjs
CHANGED
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
} from './Utils.mjs'
|
|
27
27
|
|
|
28
28
|
const optionsDefinitions = [
|
|
29
|
-
/* eslint-disable no-multi-spaces */
|
|
29
|
+
/* DISABLED eslint-disable no-multi-spaces */
|
|
30
30
|
{ name : 'context', alias : 'x', type : String, default : '' },
|
|
31
31
|
{ name : 'deprecated', alias : 'd', type : Boolean, default : false },
|
|
32
32
|
{ name : 'section', alias : 's', type : String, default : 'default' },
|
|
@@ -38,7 +38,7 @@ const optionsDefinitions = [
|
|
|
38
38
|
{ name : 'genvals', alias : 'g', type : Boolean, default : false }, // only generates values.yaml
|
|
39
39
|
{ name : 'matchk8s', alias : 'm', type : Boolean, default : false }, // checks k8s context
|
|
40
40
|
{ name : 'verbose', alias : 'v', type : Boolean, default : false },
|
|
41
|
-
/* eslint-enable no-multi-spaces */
|
|
41
|
+
/* DISABLED eslint-enable no-multi-spaces */
|
|
42
42
|
]
|
|
43
43
|
const args = cliArgs( optionsDefinitions )
|
|
44
44
|
|
|
@@ -307,12 +307,12 @@ ahoy.forEach( ( dir ) => {
|
|
|
307
307
|
const valuesAll = YAML.load( valuesOut ) || {}
|
|
308
308
|
const valuesSvc = {
|
|
309
309
|
service : {
|
|
310
|
-
/* eslint-disable no-template-curly-in-string */
|
|
310
|
+
/* DISABLE eslint-disable no-template-curly-in-string */
|
|
311
311
|
project_id : '${PROJECT_ID}',
|
|
312
312
|
project_name : '${PROJECT_NAME}',
|
|
313
313
|
host : '${HOST}',
|
|
314
314
|
ingress : '${INGRESS}',
|
|
315
|
-
/* eslint-enable no-template-curly-in-string */
|
|
315
|
+
/* DISABLE eslint-enable no-template-curly-in-string */
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
const valuesMerged = YAML.dump( deepmerge( valuesSvc, valuesAll ), { quotingType : '"' } )
|
|
@@ -342,33 +342,11 @@ if ( over.PROJECT_NAME === 'minikube' ) {
|
|
|
342
342
|
const projectId = over.PROJECT_ID
|
|
343
343
|
const zone = over.GCE_REGION + ( over.GCE_ZONE ? `-${over.GCE_ZONE}` : '' )
|
|
344
344
|
|
|
345
|
-
if ( !clusterName ) {
|
|
346
|
-
/* eslint-disable quotes */
|
|
347
|
-
log( chalk.yellow(
|
|
348
|
-
`
|
|
349
|
-
|
|
350
|
-
The overwhelm.yaml file in this branch is missing a CLUSTER_NAME setting,
|
|
351
|
-
which was added to support cluster names that do not match the project
|
|
352
|
-
name. Since the mismatch is rare, you can probably get by with simply
|
|
353
|
-
adding this line following PROJECT_NAME in the default section of
|
|
354
|
-
overwhelm.yaml:
|
|
355
|
-
|
|
356
|
-
${chalk.bold.green( `CLUSTER_NAME : '\${PROJECT_NAME}'` )}
|
|
357
|
-
|
|
358
|
-
However, if the CLUSTER_NAME is not the same as the PROJECT_NAME then go
|
|
359
|
-
ahead and add the CLUSTER_NAME setting to the ${chalk.bold.green( projectId )} section of the
|
|
360
|
-
overwhelm.yaml file.
|
|
361
|
-
|
|
362
|
-
` ) )
|
|
363
|
-
/* eslint-enable quotes */
|
|
364
|
-
process.exit( 1 )
|
|
365
|
-
}
|
|
366
|
-
|
|
367
345
|
// the kubectl call will throw if there isn't an existing context
|
|
368
346
|
let currentCtx = '_no_current_context_'
|
|
369
347
|
try {
|
|
370
348
|
currentCtx = await shellCmd( 'kubectl config current-context' )
|
|
371
|
-
} catch ( err ) {
|
|
349
|
+
} catch ( err ) { // eslint-disable-line no-unused-vars
|
|
372
350
|
// err && log( `Caught Error =>[${err}]` )
|
|
373
351
|
}
|
|
374
352
|
|
|
@@ -386,7 +364,7 @@ if ( args.fetchctx ) {
|
|
|
386
364
|
if ( !matchedCtx ) {
|
|
387
365
|
try {
|
|
388
366
|
await shellCmd( cmd )
|
|
389
|
-
} catch ( err ) {
|
|
367
|
+
} catch ( err ) { // eslint-disable-line no-unused-vars
|
|
390
368
|
process.exit( 61 ) // ECONNREFUSED
|
|
391
369
|
}
|
|
392
370
|
}
|
package/src/push-my-chart.mjs
CHANGED
|
@@ -9,7 +9,9 @@ import {
|
|
|
9
9
|
errorExit,
|
|
10
10
|
log,
|
|
11
11
|
parseHelmChart,
|
|
12
|
-
|
|
12
|
+
proceed,
|
|
13
|
+
shellCmd,
|
|
14
|
+
warning,
|
|
13
15
|
} from './Utils.mjs'
|
|
14
16
|
|
|
15
17
|
const commandLineOptions = [
|
|
@@ -56,11 +58,18 @@ if ( args.help ) {
|
|
|
56
58
|
const {
|
|
57
59
|
chartName,
|
|
58
60
|
chartVersion,
|
|
61
|
+
chartAppVersion,
|
|
59
62
|
depsOutOfSync,
|
|
60
63
|
} = await parseHelmChart( args.chart )
|
|
61
64
|
|
|
62
|
-
log( chalk.green( `Chart
|
|
63
|
-
log( chalk.green( `Version
|
|
65
|
+
log( chalk.green( `Chart => ${chalk.bold.yellow( chartName )}` ) )
|
|
66
|
+
log( chalk.green( `Version => ${chalk.bold.yellow( chartVersion )}` ) )
|
|
67
|
+
log( chalk.green( `AppVersion => ${chalk.bold.yellow( chartAppVersion )}` ) )
|
|
68
|
+
|
|
69
|
+
if ( !chartAppVersion.startsWith( 'v' ) ) {
|
|
70
|
+
warning( 'Chart.yaml appVersion does not begin with the letter "v"\n' )
|
|
71
|
+
await proceed( 'You sure about this?' )
|
|
72
|
+
}
|
|
64
73
|
|
|
65
74
|
if ( depsOutOfSync ) {
|
|
66
75
|
try {
|
|
@@ -89,7 +98,7 @@ if ( args.noRegistry ) {
|
|
|
89
98
|
|
|
90
99
|
try {
|
|
91
100
|
log( chalk.green( ' ... pushing to the Artifact Registry' ) )
|
|
92
|
-
const registry = await shellCmd( `chart-to-registry --chart ${args.chart}` )
|
|
101
|
+
const registry = await shellCmd( `chart-to-registry --chart ${args.chart} --ignore-appv` )
|
|
93
102
|
debug( { registry }, '<==chart-to-registry' )
|
|
94
103
|
process.exit( museumStatus )
|
|
95
104
|
} catch ( ex ) {
|