42 lines
1.7 KiB
Bash
Executable File
42 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
set -euo pipefail
|
|
|
|
# Get current git tag, fall back to "latest" if no tags exist
|
|
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "latest")
|
|
|
|
echo "Uploading container images to Gitea registry with tag: $TAG"
|
|
|
|
# Simple authentication test - try to get registry info
|
|
if ! docker info >/dev/null 2>&1; then
|
|
echo "Error: Docker daemon is not running"
|
|
exit 1
|
|
fi
|
|
|
|
# Test authentication by trying to list repositories (this will fail if not authenticated)
|
|
echo "Testing Gitea registry authentication..."
|
|
if ! timeout 10s docker manifest inspect git.sschuhmann.de/sschuhmann/rehearsalhub/api:$TAG >/dev/null 2>&1; then
|
|
# Check if the error is specifically authentication related
|
|
TEST_OUTPUT=$(docker manifest inspect git.sschuhmann.de/sschuhmann/rehearsalhub/api:$TAG 2>&1 || true)
|
|
if echo "$TEST_OUTPUT" | grep -qi "401\|unauthorized\|authentication required"; then
|
|
echo "Error: Not authenticated with git.sschuhmann.de registry"
|
|
echo "Please run: docker login git.sschuhmann.de"
|
|
exit 1
|
|
fi
|
|
# If it's not an auth error, it's probably just that the image doesn't exist yet
|
|
echo "Registry accessible (image doesn't exist yet, will be created)"
|
|
fi
|
|
|
|
# Push all images to Gitea registry
|
|
echo "Pushing api image..."
|
|
docker push git.sschuhmann.de/sschuhmann/rehearsalhub/api:$TAG
|
|
|
|
echo "Pushing web image..."
|
|
docker push git.sschuhmann.de/sschuhmann/rehearsalhub/web:$TAG
|
|
|
|
echo "Pushing worker image..."
|
|
docker push git.sschuhmann.de/sschuhmann/rehearsalhub/worker:$TAG
|
|
|
|
echo "Pushing watcher image..."
|
|
docker push git.sschuhmann.de/sschuhmann/rehearsalhub/watcher:$TAG
|
|
|
|
echo "Upload complete! All images pushed to git.sschuhmann.de/sschuhmann/rehearsalhub:$TAG" |