@leverege/build-tools 2.52.1 → 2.53.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/package.json +3 -2
- package/src/helmup.sh +0 -6
- package/src/refresh-py-idx.sh +118 -0
- package/registry-compass.yaml +0 -20
- package/src/chart-compass.mjs +0 -96
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.53.0",
|
|
4
4
|
"description": "A collection of build / support tools for Leverege developers",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"repository": {
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"pull-git": "src/pull-git.sh",
|
|
48
48
|
"push-my-chart": "src/push-my-chart.mjs",
|
|
49
49
|
"refresh-npm-token": "src/refresh-npm-token.mjs",
|
|
50
|
+
"refresh-py-idx": "src/refresh-py-idx.sh",
|
|
50
51
|
"send-to-slack": "src/send-to-slack.mjs",
|
|
51
52
|
"tag-release": "src/tag-release.mjs",
|
|
52
53
|
"unleash": "src/unleash.mjs"
|
|
@@ -80,4 +81,4 @@
|
|
|
80
81
|
"@leverege/eslint-config-leverege": "^4.2.0",
|
|
81
82
|
"npm": "^10.8.3"
|
|
82
83
|
}
|
|
83
|
-
}
|
|
84
|
+
}
|
package/src/helmup.sh
CHANGED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Execute gcloud command to get the token
|
|
4
|
+
TOKEN=$(gcloud auth print-access-token)
|
|
5
|
+
|
|
6
|
+
# Write to pip.conf
|
|
7
|
+
PIP_CONFIG_DIR="$HOME/.config/pip"
|
|
8
|
+
mkdir -p "$PIP_CONFIG_DIR"
|
|
9
|
+
PIP_CONFIG_CONTENT="
|
|
10
|
+
[global]
|
|
11
|
+
extra-index-url = https://oauth2accesstoken:${TOKEN}@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple/
|
|
12
|
+
"
|
|
13
|
+
echo "$PIP_CONFIG_CONTENT" > "$PIP_CONFIG_DIR/pip.conf"
|
|
14
|
+
echo "Updated ~/.config/pip/pip.conf"
|
|
15
|
+
|
|
16
|
+
# Write to pypirc
|
|
17
|
+
PYPIRC_CONTENT="
|
|
18
|
+
[distutils]
|
|
19
|
+
index-servers =
|
|
20
|
+
leverege-python-packages
|
|
21
|
+
|
|
22
|
+
[leverege-python-packages]
|
|
23
|
+
repository: https://us-python.pkg.dev/leverege-registry/leverege-python-packages/
|
|
24
|
+
username: oauth2accesstoken
|
|
25
|
+
password: ${TOKEN}
|
|
26
|
+
"
|
|
27
|
+
echo "$PYPIRC_CONTENT" > "$HOME/.pypirc"
|
|
28
|
+
echo "Updated ~/.pypirc"
|
|
29
|
+
|
|
30
|
+
# Escape for sed
|
|
31
|
+
UV_EXTRA_INDEX_URL="https://foo:${TOKEN}@us-python.pkg.dev/leverege-registry/leverege-python-packages/simple"
|
|
32
|
+
|
|
33
|
+
SHELLS=("bash" "dash" "zsh" "fish")
|
|
34
|
+
|
|
35
|
+
for shell in "${SHELLS[@]}"; do
|
|
36
|
+
if command -v "$shell" > /dev/null 2>&1; then
|
|
37
|
+
case "$shell" in
|
|
38
|
+
bash)
|
|
39
|
+
CONFIG_FILE="$HOME/.bashrc"
|
|
40
|
+
;;
|
|
41
|
+
dash)
|
|
42
|
+
CONFIG_FILE="$HOME/.profile"
|
|
43
|
+
;;
|
|
44
|
+
zsh)
|
|
45
|
+
CONFIG_FILE="$HOME/.zshrc"
|
|
46
|
+
;;
|
|
47
|
+
fish)
|
|
48
|
+
CONFIG_FILE="$HOME/.config/fish/config.fish"
|
|
49
|
+
;;
|
|
50
|
+
*)
|
|
51
|
+
echo "Shell $shell is not supported."
|
|
52
|
+
continue
|
|
53
|
+
;;
|
|
54
|
+
esac
|
|
55
|
+
|
|
56
|
+
echo "Updating shell configuration in $CONFIG_FILE"
|
|
57
|
+
|
|
58
|
+
if [ -f "$CONFIG_FILE" ]; then
|
|
59
|
+
if grep -q "export UV_EXTRA_INDEX_URL=" "$CONFIG_FILE"; then
|
|
60
|
+
sed -i "s|export UV_EXTRA_INDEX_URL=.*|export UV_EXTRA_INDEX_URL=${UV_EXTRA_INDEX_URL}|" "$CONFIG_FILE"
|
|
61
|
+
else
|
|
62
|
+
echo -e "\nexport UV_EXTRA_INDEX_URL=${UV_EXTRA_INDEX_URL}\n" >> "$CONFIG_FILE"
|
|
63
|
+
fi
|
|
64
|
+
else
|
|
65
|
+
echo -e "\nexport UV_EXTRA_INDEX_URL=${UV_EXTRA_INDEX_URL}\n" >> "$CONFIG_FILE"
|
|
66
|
+
fi
|
|
67
|
+
else
|
|
68
|
+
echo "Shell $shell is not installed."
|
|
69
|
+
fi
|
|
70
|
+
done
|
|
71
|
+
|
|
72
|
+
function get_parent_shell() {
|
|
73
|
+
local ppid=$(ps -p $$ -o ppid= | tr -d ' ')
|
|
74
|
+
local shell=$(ps -p $ppid -o comm= | tr -d ' ')
|
|
75
|
+
|
|
76
|
+
while [ "$ppid" != "1" ]; do
|
|
77
|
+
ppid=$(ps -p $ppid -o ppid= | tr -d ' ')
|
|
78
|
+
shell=$(ps -p $ppid -o comm= | tr -d ' ')
|
|
79
|
+
|
|
80
|
+
if [[ "$shell" =~ bash|dash|zsh|fish ]]; then
|
|
81
|
+
echo "$shell"
|
|
82
|
+
return
|
|
83
|
+
fi
|
|
84
|
+
done
|
|
85
|
+
|
|
86
|
+
echo ""
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
shell=$(get_parent_shell)
|
|
90
|
+
|
|
91
|
+
if [ -z "$shell" ]; then
|
|
92
|
+
echo -e "\nCould not determine parent shell. Please source your shell configuration to apply the changes.\n"
|
|
93
|
+
echo "Example (bash): source ~/.bashrc"
|
|
94
|
+
echo "Example (dash): source ~/.profile"
|
|
95
|
+
echo "Example (zsh): source ~/.zshrc"
|
|
96
|
+
echo "Example (fish): source ~/.config/fish/config.fish"
|
|
97
|
+
exit 1
|
|
98
|
+
fi
|
|
99
|
+
|
|
100
|
+
echo -e "\nReloading $shell shell with new configuration.\n"
|
|
101
|
+
|
|
102
|
+
case "$shell" in
|
|
103
|
+
bash)
|
|
104
|
+
source "$HOME/.bashrc"
|
|
105
|
+
;;
|
|
106
|
+
dash)
|
|
107
|
+
source "$HOME/.profile"
|
|
108
|
+
;;
|
|
109
|
+
zsh)
|
|
110
|
+
source "$HOME/.zshrc"
|
|
111
|
+
;;
|
|
112
|
+
fish)
|
|
113
|
+
source "$HOME/.config/fish/config.fish"
|
|
114
|
+
;;
|
|
115
|
+
*)
|
|
116
|
+
echo "Shell $shell is not supported."
|
|
117
|
+
;;
|
|
118
|
+
esac
|
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' )
|