@meistrari/mise-en-place 2.19.0 → 2.19.1
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/mise/tasks/registry-login.sh +10 -10
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
|
-
#MISE description="Login to
|
|
3
|
-
#USAGE flag "-r --registry <registry>" default="
|
|
4
|
-
#USAGE flag "-u --username <username>" default="" help="
|
|
2
|
+
#MISE description="Login to the internal registry. Opens the UI so you can copy your CLI secret."
|
|
3
|
+
#USAGE flag "-r --registry <registry>" default="registry.internal.tela.tools" help="Registry host to authenticate against." env="REGISTRY_HOST"
|
|
4
|
+
#USAGE flag "-u --username <username>" default="" help="Registry OIDC username. Prompted for when omitted." env="REGISTRY_USERNAME"
|
|
5
5
|
#USAGE flag "-f --force" default=#false help="Re-authenticate even if the stored credential still works."
|
|
6
|
-
#USAGE flag "--browser" negate="--no-browser" default=#true help="Open the
|
|
6
|
+
#USAGE flag "--browser" negate="--no-browser" default=#true help="Open the registry UI so the CLI secret can be copied."
|
|
7
7
|
#MISE quiet=true
|
|
8
8
|
#MISE interactive=true
|
|
9
9
|
|
|
10
10
|
set -euo pipefail
|
|
11
11
|
|
|
12
|
-
REGISTRY="${usage_registry:-registry.internal.tela.tools}"
|
|
13
|
-
USERNAME="${usage_username:-}"
|
|
12
|
+
REGISTRY="${usage_registry:-${REGISTRY_HOST:-registry.internal.tela.tools}}"
|
|
13
|
+
USERNAME="${usage_username:-${REGISTRY_USERNAME:-}}"
|
|
14
14
|
|
|
15
15
|
# Harbor runs authMode: oidc_auth, so the Google password is not a valid docker
|
|
16
16
|
# credential. Harbor mints a per-user CLI secret instead, shown in the UI. This
|
|
@@ -86,14 +86,14 @@ if [ "${usage_force:-false}" != "true" ] && check_credential; then
|
|
|
86
86
|
fi
|
|
87
87
|
|
|
88
88
|
if [ -z "$USERNAME" ]; then
|
|
89
|
-
#
|
|
89
|
+
# Registry identities come from Google (Dex), so only a work address is a
|
|
90
90
|
# plausible default. A personal git email would just be a wrong prefill.
|
|
91
91
|
default_user="$(git config --get user.email 2>/dev/null || true)"
|
|
92
92
|
case "$default_user" in
|
|
93
93
|
*@meistrari.com|*@tela.com) ;;
|
|
94
94
|
*) default_user="" ;;
|
|
95
95
|
esac
|
|
96
|
-
read -r -p "
|
|
96
|
+
read -r -p "Registry username${default_user:+ [$default_user]}: " USERNAME || true
|
|
97
97
|
USERNAME="${USERNAME:-$default_user}"
|
|
98
98
|
[ -n "$USERNAME" ] || die "a username is required"
|
|
99
99
|
fi
|
|
@@ -101,7 +101,7 @@ fi
|
|
|
101
101
|
if [ "${usage_browser:-true}" = "true" ]; then
|
|
102
102
|
cat <<EOF
|
|
103
103
|
|
|
104
|
-
In the
|
|
104
|
+
In the registry UI:
|
|
105
105
|
1. Sign in through Google (Dex) if prompted
|
|
106
106
|
2. Open the avatar menu (top right) -> User Profile
|
|
107
107
|
3. Copy the CLI secret
|
|
@@ -114,7 +114,7 @@ EOF
|
|
|
114
114
|
fi
|
|
115
115
|
|
|
116
116
|
# -s so the secret never reaches the terminal or shell history.
|
|
117
|
-
read -r -s -p "Paste your
|
|
117
|
+
read -r -s -p "Paste your registry CLI secret: " CLI_SECRET || true
|
|
118
118
|
echo
|
|
119
119
|
|
|
120
120
|
[ -n "$CLI_SECRET" ] || die "no CLI secret entered"
|