Skip to content

Commit

Permalink
log meaningful message if docker login fails (#4553)
Browse files Browse the repository at this point in the history
(cherry picked from commit 0dbf0c9)
  • Loading branch information
marcellorigotti authored and actions-user committed Mar 1, 2024
1 parent ca84e37 commit d38730c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions localnet/manage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,18 @@ setup() {

echo "🐳 Logging in to our Docker Registry. You'll need to create a Classic PAT with packages:read permissions"
echo "https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token"

set +e
# Attempt Docker login
docker login ghcr.io
# Check the exit status of the previous command
if [ $? -ne 0 ]; then
echo "Docker login to ghcr.io failed. Please check your credentials (github PAT) and try again."
exit 1
fi
# Restore the previous errexit setting
set -eo pipefail


touch localnet/.setup_complete
}
Expand All @@ -63,6 +74,16 @@ get-workflow() {
break
done
if [[ $WORKFLOW =~ build-localnet|recreate ]]; then
set +e
# Attempt Docker login
docker login ghcr.io
# Check the exit status of the previous command
if [ $? -ne 0 ]; then
echo "Docker login to ghcr.io failed. Please check your credentials (github PAT) and try again."
exit 1
fi
# Restore the previous errexit setting
set -eo pipefail
echo "❓ Would you like to run a 1 or 3 node network? (Type 1 or 3)"
read -r NODE_COUNT
if [[ $NODE_COUNT == "1" ]]; then
Expand Down

0 comments on commit d38730c

Please sign in to comment.