Fix YAML syntax error and simplify upload step to get back to working state
All checks were successful
Build libostree Backport / Build libostree Backport (push) Successful in 9m57s

This commit is contained in:
robojerk 2025-07-21 21:03:57 +00:00
parent 12729630b5
commit 23c2ad7ace

View file

@ -254,39 +254,16 @@ jobs:
run: | run: |
echo "=== Attempting Debian Package Registry upload with ACCESS_TOKEN ===" echo "=== Attempting Debian Package Registry upload with ACCESS_TOKEN ==="
# Basic connectivity tests # Check if ACCESS_TOKEN is available
echo "=== Testing basic connectivity ===" if [ -z "${{ secrets.ACCESS_TOKEN }}" ]; then
echo "Testing DNS resolution..." echo "❌ ACCESS_TOKEN is not set"
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."
exit 1 exit 1
fi 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 for deb_file in release-assets/*.deb; do
if [ -f "$deb_file" ]; then if [ -f "$deb_file" ]; then
@ -294,34 +271,28 @@ jobs:
filename=$(basename "$deb_file") filename=$(basename "$deb_file")
echo "File: $filename" echo "File: $filename"
# Use -v to see the full curl output for every upload attempt # Get HTTP code directly using curl -w
# This will tell us if it's being rejected or accepted (even if not "re-uploaded") http_code=$(curl -s -o /dev/null -w "%{http_code}" \
response_output=$(curl -v -i --user "robojerk:${{ secrets.ACCESS_TOKEN }}" \ --user "robojerk:${{ secrets.ACCESS_TOKEN }}" \
--upload-file "$deb_file" \ --upload-file "$deb_file" \
"https://git.raines.xyz/api/packages/robojerk/debian/pool/noble/main/upload" 2>&1) "https://git.raines.xyz/api/packages/robojerk/debian/pool/noble/main/upload")
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")
echo "HTTP Response Code: $http_code" echo "HTTP Response Code: $http_code"
if [ "$http_code" = "201" ]; then if [ "$http_code" = "201" ]; then
echo "✅ Debian Package Registry upload SUCCESS for $deb_file (auto-assigned by Forgejo)" echo "✅ Debian Package Registry upload SUCCESS for $deb_file"
elif [ "$http_code" = "409" ]; then # Conflict - indicates package already exists elif [ "$http_code" = "409" ]; then
echo "➡️ INFO: Package $deb_file already exists (HTTP 409 Conflict). Skipping re-upload." echo "➡️ INFO: Package $deb_file already exists (HTTP 409 Conflict)"
else else
echo "❌ Debian Package Registry upload FAILED for $deb_file (HTTP $http_code)" 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 # Show verbose output for debugging failures
exit 1 # Fail the step if any unexpected upload error occurs 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
fi fi
done done
# Set output for this step
echo "debian_package_ids=${uploaded_debian_ids[*]}" >> $GITHUB_OUTPUT
# - name: Upload to Generic Package Registry (Fallback) # - name: Upload to Generic Package Registry (Fallback)
# id: generic_upload # id: generic_upload
@ -398,53 +369,30 @@ jobs:
echo " - If HTTP 201, manually assign packages to repository via web UI" echo " - If HTTP 201, manually assign packages to repository via web UI"
echo " - If HTTP 401/403, check token permissions" echo " - If HTTP 401/403, check token permissions"
- name: Debug Package Listing API - name: Check Package Status
shell: bash shell: bash
run: | run: |
echo "=== Debugging Package Listing API ===" echo "=== Checking Package Status ==="
echo "Testing /api/v1/user/packages endpoint..." echo "Testing /api/v1/packages/robojerk endpoint..."
echo "--- Raw response from /api/v1/user/packages ---" response=$(curl -s -H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \
raw_response=$(curl -s -H "Authorization: Bearer ${{ secrets.ACCESS_TOKEN }}" \ "https://git.raines.xyz/api/v1/packages/robojerk")
"https://git.raines.xyz/api/v1/user/packages")
echo "Response length: ${#raw_response} characters" echo "Response length: ${#response} characters"
echo "First 500 characters:" echo "First 200 characters:"
echo "$raw_response" | head -c 500 echo "$response" | head -c 200
echo "..."
echo "--- End raw response ---"
# Check if response is empty if [ -n "$response" ]; then
if [ -z "$raw_response" ]; then echo "✅ Got response from packages API"
echo "❌ Response is empty - likely authentication or permission issue" if echo "$response" | jq -e . > /dev/null 2>&1; then
exit 1 echo "✅ Response is valid JSON"
fi echo "Packages found:"
echo "$response" | jq -r '.[].name + " (" + .[].package_type + ")"' 2>/dev/null || echo "Could not parse package list"
# 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"
else else
echo "❌ Response is JSON but not an array" echo "❌ Response is not valid JSON"
echo "Actual JSON structure:"
echo "$raw_response" | jq -r '.' 2>/dev/null || echo "Could not pretty-print JSON"
fi fi
else else
echo "❌ Response is not valid JSON" echo "❌ No response from packages API"
echo "Response might be HTML error page or other format"
echo "First 200 characters of response:"
echo "$raw_response" | head -c 200
fi fi
- name: Success Summary - name: Success Summary