Fix workflow for minimal container environments
Some checks failed
Build and Push Docker Image / build-and-push (push) Has been cancelled

- Install required debug tools first (iproute2, dnsutils, etc)
- Use fallbacks for commands that might not exist
- Better error handling in clone step
- Add IP-based clone fallback with SSL verification disabled
- Suppress apt-get errors for missing packages

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Kevin Sivic 2025-11-30 23:25:21 -05:00
parent 86dacd2f09
commit fabc795911

View file

@ -12,38 +12,54 @@ jobs:
steps: steps:
- name: Debug - Network and DNS Configuration - name: Debug - Network and DNS Configuration
run: | run: |
echo "=== Installing debug tools ==="
apt-get update -qq
apt-get install -y -qq dnsutils iputils-ping curl iproute2 2>/dev/null || echo "Some tools failed to install"
echo ""
echo "=== Network Configuration ===" echo "=== Network Configuration ==="
ip addr show ip addr show 2>/dev/null || ifconfig 2>/dev/null || echo "No network tools available"
echo "" echo ""
echo "=== DNS Configuration ===" echo "=== DNS Configuration ==="
cat /etc/resolv.conf cat /etc/resolv.conf
echo ""
echo "=== Hostname ==="
hostname
cat /etc/hosts
echo "" echo ""
echo "=== Testing DNS Resolution ===" echo "=== Testing DNS Resolution ==="
echo "Testing Google DNS:" echo "Testing Google DNS:"
nslookup google.com || echo "Failed to resolve google.com" nslookup google.com || echo "Failed to resolve google.com"
echo "" echo ""
echo "Testing forgejo.sivic.me:" echo "Testing forgejo.sivic.me:"
nslookup forgejo.sivic.me || echo "Failed to resolve forgejo.sivic.me" nslookup forgejo.sivic.me || echo "Failed to resolve forgejo.sivic.me"
echo "" echo ""
echo "=== Testing with dig ===" echo "=== Testing with dig ==="
apt-get update -qq && apt-get install -y -qq dnsutils dig forgejo.sivic.me || echo "dig failed"
dig forgejo.sivic.me
dig @8.8.8.8 forgejo.sivic.me echo ""
echo "Using Google DNS directly:"
dig @8.8.8.8 forgejo.sivic.me || echo "dig @8.8.8.8 failed"
echo "" echo ""
echo "=== Testing connectivity ===" echo "=== Testing connectivity ==="
ping -c 3 8.8.8.8 || echo "Cannot ping 8.8.8.8" ping -c 3 8.8.8.8 || echo "Cannot ping 8.8.8.8"
echo "" echo ""
echo "=== Testing HTTP access ===" echo "=== Testing HTTP access ==="
curl -v https://forgejo.sivic.me 2>&1 | head -20 || echo "Failed to curl forgejo.sivic.me" curl -v https://forgejo.sivic.me 2>&1 | head -30 || echo "Failed to curl forgejo.sivic.me"
- name: Debug - Check current directory - name: Debug - Check current directory
run: | run: |
echo "=== Current Directory ===" echo "=== Current Directory ==="
pwd pwd
ls -la ls -la
echo ""
echo "=== Git Configuration ==="
git config --list || echo "Git not configured"
echo "" echo ""
echo "=== Environment Variables ===" echo "=== Environment Variables ==="
echo "Git SHA: ${{ github.sha }}" echo "Git SHA: ${{ github.sha }}"
@ -55,17 +71,30 @@ jobs:
run: | run: |
echo "=== Attempting to clone ===" echo "=== Attempting to clone ==="
echo "URL: ${{ github.server_url }}/${{ github.repository }}" echo "URL: ${{ github.server_url }}/${{ github.repository }}"
git clone ${{ github.server_url }}/${{ github.repository }} repo || {
# Try normal clone first
if git clone ${{ github.server_url }}/${{ github.repository }} repo 2>&1; then
echo "Clone succeeded!"
else
echo "Clone failed, trying with IP..." echo "Clone failed, trying with IP..."
# Try to get the IP and clone with that
FORGEJO_IP=$(dig +short forgejo.sivic.me | head -1) FORGEJO_IP=$(dig +short forgejo.sivic.me | head -1)
echo "Forgejo IP: $FORGEJO_IP" echo "Forgejo IP: $FORGEJO_IP"
if [ -n "$FORGEJO_IP" ]; then if [ -n "$FORGEJO_IP" ]; then
git clone https://$FORGEJO_IP/kevinsivic/ratemyclient repo echo "Attempting clone with IP: $FORGEJO_IP"
git -c http.sslVerify=false clone https://$FORGEJO_IP/kevinsivic/ratemyclient repo || {
echo "IP clone also failed"
exit 1
}
else
echo "Could not determine IP address"
exit 1
fi fi
} fi
cd repo cd repo
git checkout ${{ github.sha }} git checkout ${{ github.sha }}
ls -la
- name: Build Docker image - name: Build Docker image
run: | run: |