Simplify registry authentication logic and update comments

Updates the script comment to reference skopeo and clarifies the pre-build authentication check. Removes the conditional docker login wrapper and intermediate prompts, now executing docker login directly. The script will fail fast with a clear error message if authentication fails.
This commit is contained in:
Eric Coissac
2026-05-04 15:16:58 +02:00
parent 61c5b322dd
commit b79bb06130
+8 -10
View File
@@ -266,17 +266,15 @@ publish_images() {
version=$(read_version)
# docker buildx --push uses Docker's own credential store, independent of
# skopeo. Verify auth early to get a clear error before a long build.
echo -e "${BLUE}Checking registry authentication...${NC}"
# skopeo. Prompt once before the (long) build so the user isn't surprised
# by an auth failure at the very end.
local registry_host="${REGISTRY%%/*}"
if ! docker login "$registry_host" >/dev/null 2>&1; then
echo -e "${YELLOW}Not logged in to ${registry_host}. Running docker login...${NC}"
docker login "$registry_host" || {
echo "Error: authentication to ${registry_host} failed." >&2
echo "Run: docker login ${registry_host}" >&2
exit 1
}
fi
echo -e "${BLUE}Authenticating to ${registry_host} (required to push)...${NC}"
docker login "$registry_host" || {
echo "Error: authentication to ${registry_host} failed." >&2
echo "Run: docker login ${registry_host}" >&2
exit 1
}
echo ""
echo -e "${BLUE}Publishing images (version ${version}) to ${REGISTRY}${NC}"