git updates

This commit is contained in:
2025-09-09 16:26:07 -04:00
parent f29d060d59
commit 27cb38c3bb
5 changed files with 117 additions and 98 deletions
+29 -91
View File
@@ -44,109 +44,47 @@ jobs:
docker tag nfoguard:latest nfoguard:${{ github.sha }}
echo "Docker image built and tagged successfully"
- name: Find local Gitea IP
- name: Login and Push to Gitea registry (local network)
run: |
echo "Using known local Gitea IP: 192.168.253.221"
GITEA_LOCAL_IP="192.168.253.221"
# Test connectivity to local IP
echo "Testing local connectivity..."
if timeout 3 curl -s "http://$GITEA_LOCAL_IP:3000" >/dev/null 2>&1; then
echo "✅ Local Gitea accessible at $GITEA_LOCAL_IP:3000"
else
echo "❌ Cannot reach local Gitea at $GITEA_LOCAL_IP:3000"
fi
# Test registry endpoint
if timeout 3 curl -s "http://$GITEA_LOCAL_IP:3000/v2/" >/dev/null 2>&1; then
echo "✅ Registry endpoint accessible"
else
echo "❌ Registry endpoint not accessible"
fi
# Export for other steps
echo "GITEA_LOCAL_IP=$GITEA_LOCAL_IP" >> $GITHUB_ENV
echo "Using Gitea at: $GITEA_LOCAL_IP"
- name: Login to Gitea registry
run: |
echo "Logging into Gitea container registry..."
echo "Using local network connection to avoid Cloudflare tunnel timeouts..."
export DOCKER_CONFIG=/tmp/docker-config
mkdir -p $DOCKER_CONFIG
# Test local IP connectivity first
REGISTRY="$GITEA_LOCAL_IP:3000"
echo "Testing registry connectivity to: $REGISTRY"
# Use local IP directly - no tunnel overhead
LOCAL_REGISTRY="192.168.253.221:3000"
echo "Registry: $LOCAL_REGISTRY"
# Test if we can reach the registry endpoint
if curl -s -f "http://$REGISTRY/v2/" >/dev/null 2>&1; then
echo "✅ Registry endpoint accessible via HTTP"
# Try login with local IP
echo "${{ secrets.token }}" | docker --config $DOCKER_CONFIG login "$REGISTRY" -u "${{ secrets.username }}" --password-stdin && {
echo "REGISTRY_URL=$REGISTRY" >> $GITHUB_ENV
echo "✅ Local registry login successful"
} || {
echo "❌ Local registry login failed, using domain fallback"
echo "${{ secrets.token }}" | docker --config $DOCKER_CONFIG login gitea.skalas.org -u "${{ secrets.username }}" --password-stdin
echo "REGISTRY_URL=gitea.skalas.org" >> $GITHUB_ENV
}
else
echo "❌ Local registry not accessible, using domain"
echo "${{ secrets.token }}" | docker --config $DOCKER_CONFIG login gitea.skalas.org -u "${{ secrets.username }}" --password-stdin
echo "REGISTRY_URL=gitea.skalas.org" >> $GITHUB_ENV
fi
# Login to local registry
echo "${{ secrets.token }}" | docker --config $DOCKER_CONFIG login "$LOCAL_REGISTRY" -u "${{ secrets.username }}" --password-stdin
echo "Using registry: ${REGISTRY_URL:-gitea.skalas.org}"
- name: Push to Gitea registry
run: |
echo "Pushing to Gitea container registry at: ${REGISTRY_URL:-gitea.skalas.org}"
export DOCKER_CONFIG=/tmp/docker-config
# Tag images for local registry
docker tag nfoguard:latest "$LOCAL_REGISTRY/jskala/nfoguard:latest"
docker tag nfoguard:latest "$LOCAL_REGISTRY/jskala/nfoguard:${{ github.sha }}"
# Use the discovered registry URL or fallback to domain name
REGISTRY=${REGISTRY_URL:-gitea.skalas.org}
echo "Pushing to local registry (much faster!)..."
# Retag images for the correct registry
docker tag nfoguard:latest "$REGISTRY/jskala/nfoguard:latest"
docker tag nfoguard:latest "$REGISTRY/jskala/nfoguard:${{ github.sha }}"
echo "Pushing to $REGISTRY..."
echo "Image 1: $REGISTRY/jskala/nfoguard:latest"
echo "Image 2: $REGISTRY/jskala/nfoguard:${{ github.sha }}"
# Push first image with detailed output
# Push to local network - should be very fast
echo "=== Pushing latest tag ==="
timeout 600 docker --config $DOCKER_CONFIG push "$REGISTRY/jskala/nfoguard:latest" 2>&1 | tee /tmp/push1.log && {
echo "✅ First image pushed successfully"
FIRST_SUCCESS=true
} || {
echo "❌ First push failed"
cat /tmp/push1.log
FIRST_SUCCESS=false
}
# Push second image
echo "=== Pushing SHA tag ==="
timeout 600 docker --config $DOCKER_CONFIG push "$REGISTRY/jskala/nfoguard:${{ github.sha }}" 2>&1 | tee /tmp/push2.log && {
echo "✅ Second image pushed successfully"
SECOND_SUCCESS=true
} || {
echo "❌ Second push failed"
cat /tmp/push2.log
SECOND_SUCCESS=false
}
# Verify what actually made it
echo "=== Verifying push results ==="
curl -s "$REGISTRY/v2/jskala/nfoguard/tags/list" || echo "Could not verify tags"
if [ "$FIRST_SUCCESS" = "true" ]; then
echo "🎉 At least one image pushed successfully!"
exit 0
if docker --config $DOCKER_CONFIG push "$LOCAL_REGISTRY/jskala/nfoguard:latest"; then
echo "✅ Latest tag pushed successfully"
echo "=== Pushing SHA tag ==="
if docker --config $DOCKER_CONFIG push "$LOCAL_REGISTRY/jskala/nfoguard:${{ github.sha }}"; then
echo "✅ SHA tag pushed successfully"
else
echo "⚠️ SHA tag push failed but latest succeeded"
fi
else
echo "💥 Push failed"
echo "❌ Local registry push failed"
docker images | grep nfoguard
exit 1
fi
# Verify the push worked
echo "=== Verifying push ==="
curl -s "http://$LOCAL_REGISTRY/v2/jskala/nfoguard/tags/list" || echo "Could not verify (but push likely succeeded)"
echo "🎉 Local registry push completed!"
deploy:
needs: build