Skip to content

Commit

Permalink
fix: skip docker login if config already mounted
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian committed Aug 15, 2023
1 parent a1cb8cf commit 0fedc31
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ fi

if [[ -f $DOCKER_CREDS_FILE ]]; then
if jq < "$DOCKER_CREDS_FILE" >/dev/null 2>&1 ; then
# shellcheck disable=SC2046
# shellcheck disable=SC2046
# shellcheck disable=SC2162
while read user pass registry ; do
echo "$pass" | docker login --username "$user" --password-stdin "$registry"
Expand All @@ -46,30 +46,32 @@ if [ -n "$GORELEASER_GITHUB_TOKEN" ] ; then
export GITHUB_TOKEN=$GORELEASER_GITHUB_TOKEN
fi

if [ -n "$GITHUB_TOKEN" ]; then
# Log into GitHub package registry
echo "$GITHUB_TOKEN" | docker login docker.pkg.github.com -u docker --password-stdin
echo "$GITHUB_TOKEN" | docker login ghcr.io -u docker --password-stdin
fi
if [[ ! -f /root/.docker/config.json ]]; then
if [ -n "$GITHUB_TOKEN" ]; then
# Log into GitHub package registry
echo "$GITHUB_TOKEN" | docker login docker.pkg.github.com -u docker --password-stdin
echo "$GITHUB_TOKEN" | docker login ghcr.io -u docker --password-stdin
fi

if [ -n "$CI_REGISTRY_PASSWORD" ]; then
# Log into GitLab registry
echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
if [ -n "$CI_REGISTRY_PASSWORD" ]; then
# Log into GitLab registry
echo "$CI_REGISTRY_PASSWORD" | docker login "$CI_REGISTRY" -u "$CI_REGISTRY_USER" --password-stdin
fi
fi

case "$(uname -m)" in
x86_64|amd64)
CC=x86_64-linux-gnu-gcc
CXX=x86_64-linux-gnu-g++
;;
arm64|aarch64)
CC=aarch64-linux-gnu-gcc
CXX=aarch64-linux-gnu-g++
;;
*)
echo "goreleaser-cross supports only amd64/arm64 hosts"
exit 1
;;
x86_64|amd64)
CC=x86_64-linux-gnu-gcc
CXX=x86_64-linux-gnu-g++
;;
arm64|aarch64)
CC=aarch64-linux-gnu-gcc
CXX=aarch64-linux-gnu-g++
;;
*)
echo "goreleaser-cross supports only amd64/arm64 hosts"
exit 1
;;
esac

export CC
Expand Down

0 comments on commit 0fedc31

Please sign in to comment.