diff --git a/.forgejo/workflows/build-libostree-backport.yml b/.forgejo/workflows/build-libostree-backport.yml index 3f9e91f..7d0a81f 100644 --- a/.forgejo/workflows/build-libostree-backport.yml +++ b/.forgejo/workflows/build-libostree-backport.yml @@ -254,39 +254,16 @@ jobs: run: | echo "=== Attempting Debian Package Registry upload with ACCESS_TOKEN ===" - # Basic connectivity tests - echo "=== Testing basic connectivity ===" - echo "Testing DNS resolution..." - nslookup git.raines.xyz || echo "DNS resolution failed" - - echo "Testing HTTPS connectivity..." - curl -I https://git.raines.xyz || echo "HTTPS connectivity failed" - - echo "Testing API endpoint accessibility..." - curl -I https://git.raines.xyz/api/v1/version || echo "API endpoint test failed" - - echo "=== End connectivity tests ===" - - # Initialize array to store uploaded package IDs - uploaded_debian_ids=() - - echo "=== Checking for .deb files ===" - echo "Current directory: $(pwd)" - echo "release-assets directory contents:" - ls -la release-assets/ 2>/dev/null || echo "release-assets directory not found" - echo "All .deb files in current directory:" - find . -name "*.deb" -type f 2>/dev/null || echo "No .deb files found" - echo "=== End file check ===" - - # Check if ACCESS_TOKEN is available (without exposing the actual token) - echo "=== Checking ACCESS_TOKEN ===" - if [ -n "${{ secrets.ACCESS_TOKEN }}" ]; then - echo "secrets.ACCESS_TOKEN is populated. First 4 chars: ${{ secrets.ACCESS_TOKEN | slice(0, 4) }}" - else - echo "❌ secrets.ACCESS_TOKEN is EMPTY or NOT SET. THIS IS A CRITICAL ERROR." + # Check if ACCESS_TOKEN is available + if [ -z "${{ secrets.ACCESS_TOKEN }}" ]; then + echo "❌ ACCESS_TOKEN is not set" exit 1 fi - echo "=== End token check ===" + echo "✅ ACCESS_TOKEN is set" + + # List contents of release-assets for debugging + echo "Contents of release-assets/:" + ls -la release-assets/ || echo "release-assets/ directory not found or empty." for deb_file in release-assets/*.deb; do if [ -f "$deb_file" ]; then @@ -294,34 +271,28 @@ jobs: filename=$(basename "$deb_file") echo "File: $filename" - # Use -v to see the full curl output for every upload attempt - # This will tell us if it's being rejected or accepted (even if not "re-uploaded") - response_output=$(curl -v -i --user "robojerk:${{ secrets.ACCESS_TOKEN }}" \ - --upload-file "$deb_file" \ - "https://git.raines.xyz/api/packages/robojerk/debian/pool/noble/main/upload" 2>&1) - - echo "--- Full curl output for $deb_file ---" - echo "$response_output" - echo "--- End curl output ---" - - # Extract HTTP code from the verbose output - http_code=$(echo "$response_output" | grep -oP '^< HTTP/\d.\d \K\d{3}' | tail -1 || echo "N/A") + # Get HTTP code directly using curl -w + http_code=$(curl -s -o /dev/null -w "%{http_code}" \ + --user "robojerk:${{ secrets.ACCESS_TOKEN }}" \ + --upload-file "$deb_file" \ + "https://git.raines.xyz/api/packages/robojerk/debian/pool/noble/main/upload") echo "HTTP Response Code: $http_code" if [ "$http_code" = "201" ]; then - echo "✅ Debian Package Registry upload SUCCESS for $deb_file (auto-assigned by Forgejo)" - elif [ "$http_code" = "409" ]; then # Conflict - indicates package already exists - echo "➡️ INFO: Package $deb_file already exists (HTTP 409 Conflict). Skipping re-upload." + echo "✅ Debian Package Registry upload SUCCESS for $deb_file" + elif [ "$http_code" = "409" ]; then + echo "➡️ INFO: Package $deb_file already exists (HTTP 409 Conflict)" else echo "❌ Debian Package Registry upload FAILED for $deb_file (HTTP $http_code)" - # No need to print full verbose curl output again, it's already above - exit 1 # Fail the step if any unexpected upload error occurs + # Show verbose output for debugging failures + curl -v -i --user "robojerk:${{ secrets.ACCESS_TOKEN }}" \ + --upload-file "$deb_file" \ + "https://git.raines.xyz/api/packages/robojerk/debian/pool/noble/main/upload" 2>&1 + exit 1 fi fi done - # Set output for this step - echo "debian_package_ids=${uploaded_debian_ids[*]}" >> $GITHUB_OUTPUT # - name: Upload to Generic Package Registry (Fallback) # id: generic_upload @@ -398,53 +369,30 @@ jobs: echo " - If HTTP 201, manually assign packages to repository via web UI" echo " - If HTTP 401/403, check token permissions" - - name: Debug Package Listing API + - name: Check Package Status shell: bash run: | - echo "=== Debugging Package Listing API ===" + echo "=== Checking Package Status ===" - echo "Testing /api/v1/user/packages endpoint..." - echo "--- Raw response from /api/v1/user/packages ---" - raw_response=$(curl -s -H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \ - "https://git.raines.xyz/api/v1/user/packages") + echo "Testing /api/v1/packages/robojerk endpoint..." + response=$(curl -s -H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \ + "https://git.raines.xyz/api/v1/packages/robojerk") - echo "Response length: ${#raw_response} characters" - echo "First 500 characters:" - echo "$raw_response" | head -c 500 - echo "..." - echo "--- End raw response ---" + echo "Response length: ${#response} characters" + echo "First 200 characters:" + echo "$response" | head -c 200 - # Check if response is empty - if [ -z "$raw_response" ]; then - echo "❌ Response is empty - likely authentication or permission issue" - exit 1 - fi - - # Try to parse as JSON - echo "--- Attempting JSON parsing ---" - if echo "$raw_response" | jq -e . > /dev/null 2>&1; then - echo "✅ Response is valid JSON" - echo "JSON structure:" - echo "$raw_response" | jq -r 'type' 2>/dev/null || echo "Could not determine JSON type" - - # Check if it's an array - if echo "$raw_response" | jq -e 'type == "array"' > /dev/null 2>&1; then - echo "✅ Response is a JSON array" - echo "Array length:" - echo "$raw_response" | jq -r 'length' 2>/dev/null || echo "Could not get array length" - - echo "Package list:" - echo "$raw_response" | jq -r '.[] | "\(.id): \(.name) \(.version) (\(.package_type))"' 2>/dev/null || echo "Could not list packages" + if [ -n "$response" ]; then + echo "✅ Got response from packages API" + if echo "$response" | jq -e . > /dev/null 2>&1; then + echo "✅ Response is valid JSON" + echo "Packages found:" + echo "$response" | jq -r '.[].name + " (" + .[].package_type + ")"' 2>/dev/null || echo "Could not parse package list" else - echo "❌ Response is JSON but not an array" - echo "Actual JSON structure:" - echo "$raw_response" | jq -r '.' 2>/dev/null || echo "Could not pretty-print JSON" + echo "❌ Response is not valid JSON" fi else - echo "❌ Response is not valid JSON" - echo "Response might be HTML error page or other format" - echo "First 200 characters of response:" - echo "$raw_response" | head -c 200 + echo "❌ No response from packages API" fi - name: Success Summary