libostree-dev/.forgejo/workflows/build-ostree-backports.yml
robojerk 38e017cef3
Some checks failed
Build libostree Backport / Build libostree Backport (push) Failing after 17m20s
Build ostree Backports / Build ostree Backport for noble (push) Failing after 2m37s
Add multi-distribution ostree backport support for Ubuntu Noble and Debian Trixie
- Add main ostree-backport.sh script with distribution selection
- Add wrapper scripts: backport-noble.sh and backport-trixie.sh
- Add usage-guide.sh for comprehensive documentation
- Update CI/CD workflows with improved multi-distribution support
- Add test-build.yml workflow for quick validation
- Update README.md with multi-distribution documentation
- Add CI-CD-IMPROVEMENTS.md with detailed workflow documentation
- Remove old .deb files (steam.deb, wget_1.21.4-1ubuntu4.1_amd64.deb)

Features:
- Ubuntu Noble: Source from Questing, target Noble
- Debian Trixie: Source from sid, target Trixie
- Enhanced error handling and logging
- Manual triggers for single/all distributions
- Comprehensive CI/CD documentation
2025-08-05 09:33:14 -07:00

391 lines
No EOL
18 KiB
YAML

name: Build ostree Backports
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
inputs:
target_distro:
description: 'Target distribution to build for'
required: true
default: 'noble'
type: choice
options:
- noble
- trixie
build_all:
description: 'Build for all distributions'
required: false
default: false
type: boolean
env:
OSTREE_VERSION: "2025.2"
OSTREE_DEBIAN_REVISION: "1"
jobs:
build-ostree-backport:
name: Build ostree Backport for ${{ github.event.inputs.target_distro || 'noble' }}
runs-on: ubuntu-latest
container:
image: ubuntu:latest
strategy:
matrix:
target_distro: ${{ github.event.inputs.build_all == 'true' && fromJSON('["noble", "trixie"]') || fromJSON('["' + (github.event.inputs.target_distro || 'noble') + '"]') }}
include:
- target_distro: noble
distro_type: ubuntu
source_release: questing
target_release: noble
backport_suffix: ~noble1
pool_url: http://archive.ubuntu.com/ubuntu/pool/universe/o/ostree/
sources_list: "deb-src http://us.archive.ubuntu.com/ubuntu/ noble main universe"
package_upload_path: noble/main
- target_distro: trixie
distro_type: debian
source_release: sid
target_release: trixie
backport_suffix: ~trixie1
pool_url: http://deb.debian.org/debian/pool/main/o/ostree/
sources_list: "deb-src http://deb.debian.org/debian/ trixie main contrib non-free"
package_upload_path: trixie/main
steps:
- name: Setup build environment
run: |
echo "=== Setting up build environment for ${{ matrix.target_distro }} ==="
apt update -y
apt install -y devscripts build-essential wget git curl jq
- name: Checkout repository
run: |
echo "=== Checking out repository ==="
git clone https://git.raines.xyz/robojerk/libostree-dev.git /tmp/libostree-dev
cp -r /tmp/libostree-dev/* .
cp -r /tmp/libostree-dev/.* . 2>/dev/null || true
echo "Repository checked out successfully"
- name: Debug - Check ACCESS_TOKEN (safe)
run: |
echo "=== Debugging ACCESS_TOKEN for ${{ matrix.target_distro }} ==="
echo "Token exists: ${{ secrets.FORGEJO_TOKEN != '' }}"
echo "Token length: ${#FORGEJO_TOKEN}"
echo "Token first 4 chars: $(echo "$FORGEJO_TOKEN" | cut -c1-4)..."
echo "Token last 4 chars: ...$(echo "$FORGEJO_TOKEN" | rev | cut -c1-4 | rev)"
echo "Environment variable name: FORGEJO_TOKEN"
echo "Available secrets:"
env | grep -i token || echo "No token env vars found"
env:
FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }}
- name: Test API endpoints
run: |
echo "=== Testing Forgejo API endpoints for ${{ matrix.target_distro }} ==="
# Test 1: Check Forgejo version and capabilities
echo "Testing Forgejo version..."
curl -s -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/version" | jq . 2>/dev/null || echo "Version endpoint failed"
echo ""
echo "=== Testing user info ==="
# Test 2: Check user info
echo "Testing user info..."
curl -s -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/user" | jq . 2>/dev/null || echo "User endpoint failed"
echo ""
echo "=== Testing repository info ==="
# Test 3: Check repository info
echo "Testing repository info..."
curl -s -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/repos/robojerk/libostree-dev" | jq . 2>/dev/null || echo "Repository endpoint failed"
echo ""
echo "=== Testing package registry endpoints ==="
# Test 4: Check if package registry is enabled
echo "Testing package registry availability..."
curl -s -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/user/packages" | jq . 2>/dev/null || echo "User packages endpoint failed"
echo ""
echo "=== Testing repository packages ==="
# Test 5: Check repository packages
echo "Testing repository packages..."
curl -s -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/repos/robojerk/libostree-dev/packages" | jq . 2>/dev/null || echo "Repository packages endpoint failed"
echo ""
echo "=== Testing package registry types ==="
# Test 6: Check available package types
echo "Testing Debian package registry..."
curl -s -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/packages/robojerk/debian" | jq . 2>/dev/null || echo "Debian packages endpoint failed"
echo "Testing Generic package registry..."
curl -s -H "Authorization: Bearer ${{ secrets.FORGEJO_TOKEN }}" \
"https://git.raines.xyz/api/v1/packages/robojerk/generic" | jq . 2>/dev/null || echo "Generic packages endpoint failed"
- name: Add source repositories
run: |
echo "=== Adding source repositories for ${{ matrix.target_distro }} ==="
echo "${{ matrix.sources_list }}" | tee /etc/apt/sources.list.d/${{ matrix.target_release }}-sources.list
apt update -y
echo "Source repositories added successfully"
- name: Create backport directory
run: |
echo "=== Creating backport directory for ${{ matrix.target_distro }} ==="
mkdir -p /opt/Projects/ostree-backport-${{ matrix.target_distro }}
cd /opt/Projects/ostree-backport-${{ matrix.target_distro }}
echo "Backport directory created: /opt/Projects/ostree-backport-${{ matrix.target_distro }}"
- name: Download ostree source
run: |
echo "=== Downloading ostree source for ${{ matrix.target_distro }} ==="
cd /opt/Projects/ostree-backport-${{ matrix.target_distro }}
POOL_URL="${{ matrix.pool_url }}"
echo "Pool URL: $POOL_URL"
# Download source files
wget "${POOL_URL}ostree_${OSTREE_VERSION}-${OSTREE_DEBIAN_REVISION}.dsc" || exit 1
wget "${POOL_URL}ostree_${OSTREE_VERSION}.orig.tar.xz" || exit 1
wget "${POOL_URL}ostree_${OSTREE_VERSION}-${OSTREE_DEBIAN_REVISION}.debian.tar.xz" || exit 1
echo "Source files downloaded successfully"
ls -la *.dsc *.tar.xz
- name: Extract and modify source
run: |
echo "=== Extracting and modifying source for ${{ matrix.target_distro }} ==="
cd /opt/Projects/ostree-backport-${{ matrix.target_distro }}
dpkg-source -x "ostree_${OSTREE_VERSION}-${OSTREE_DEBIAN_REVISION}.dsc" || exit 1
cd "ostree-${OSTREE_VERSION}"
echo "Modifying changelog for ${{ matrix.target_distro }}..."
dch --newversion "${OSTREE_VERSION}-${OSTREE_DEBIAN_REVISION}${{ matrix.backport_suffix }}" \
--distribution "${{ matrix.target_release }}-backports" \
-b \
"Backport ostree ${OSTREE_VERSION}-${OSTREE_DEBIAN_REVISION} from ${{ matrix.source_release }} for ${{ matrix.target_release }} compatibility." || exit 1
echo "Source extracted and changelog updated successfully"
- name: Install build dependencies
run: |
echo "=== Installing build dependencies for ${{ matrix.target_distro }} ==="
cd /opt/Projects/ostree-backport-${{ matrix.target_distro }}/ostree-${OSTREE_VERSION}
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
apt-get update
apt-get build-dep -y --no-install-recommends ./ || exit 1
echo "Build dependencies installed successfully"
- name: Build ostree backport
run: |
echo "=== Building ostree backport for ${{ matrix.target_distro }} ==="
cd /opt/Projects/ostree-backport-${{ matrix.target_distro }}/ostree-${OSTREE_VERSION}
dpkg-buildpackage -us -uc -b || exit 1
echo "ostree backport built successfully"
- name: List built packages
run: |
echo "=== Built packages for ${{ matrix.target_distro }} ==="
ls -la /opt/Projects/ostree-backport-${{ matrix.target_distro }}/*.deb
echo "Package count: $(ls -1 /opt/Projects/ostree-backport-${{ matrix.target_distro }}/*.deb 2>/dev/null | wc -l)"
- name: Create release assets
run: |
echo "=== Creating release assets for ${{ matrix.target_distro }} ==="
mkdir -p release-assets-${{ matrix.target_distro }}
cp /opt/Projects/ostree-backport-${{ matrix.target_distro }}/*.deb release-assets-${{ matrix.target_distro }}/
# Create a summary file
echo "ostree Backport Build Summary for ${{ matrix.target_distro }}" > release-assets-${{ matrix.target_distro }}/BUILD_SUMMARY.txt
echo "===============================================" >> release-assets-${{ matrix.target_distro }}/BUILD_SUMMARY.txt
echo "Build Date: $(date)" >> release-assets-${{ matrix.target_distro }}/BUILD_SUMMARY.txt
echo "Target Distribution: ${{ matrix.target_distro }}" >> release-assets-${{ matrix.target_distro }}/BUILD_SUMMARY.txt
echo "Source Distribution: ${{ matrix.source_release }}" >> release-assets-${{ matrix.target_distro }}/BUILD_SUMMARY.txt
echo "Ostree Version: ${OSTREE_VERSION}" >> release-assets-${{ matrix.target_distro }}/BUILD_SUMMARY.txt
echo "Backport Suffix: ${{ matrix.backport_suffix }}" >> release-assets-${{ matrix.target_distro }}/BUILD_SUMMARY.txt
echo "" >> release-assets-${{ matrix.target_distro }}/BUILD_SUMMARY.txt
echo "Built Packages:" >> release-assets-${{ matrix.target_distro }}/BUILD_SUMMARY.txt
ls -la release-assets-${{ matrix.target_distro }}/*.deb 2>/dev/null || echo "No packages found" >> release-assets-${{ matrix.target_distro }}/BUILD_SUMMARY.txt
# Create package list for download links
echo "Package List:" > release-assets-${{ matrix.target_distro }}/PACKAGES.txt
ls -1 release-assets-${{ matrix.target_distro }}/*.deb 2>/dev/null | sed 's|.*/||' >> release-assets-${{ matrix.target_distro }}/PACKAGES.txt
echo "Release assets created for ${{ matrix.target_distro }}:"
ls -la release-assets-${{ matrix.target_distro }}/
- name: Create download instructions
run: |
echo "=== Creating download instructions for ${{ matrix.target_distro }} ==="
cat > release-assets-${{ matrix.target_distro }}/INSTALL.md << EOF
# ostree ${OSTREE_VERSION}-${OSTREE_DEBIAN_REVISION} Backport Installation for ${{ matrix.target_distro }}
## Quick Install
\`\`\`bash
# Download and install the main package
wget https://git.raines.xyz/robojerk/libostree-dev/actions/runs/\${{ github.run_id }}/artifacts
sudo dpkg -i libostree-dev_${OSTREE_VERSION}-${OSTREE_DEBIAN_REVISION}${{ matrix.backport_suffix }}_amd64.deb
sudo apt-get install -f
\`\`\`
## Verification
\`\`\`bash
# Check if ostree ${OSTREE_VERSION} is installed
pkg-config --modversion ostree-1
# Should output: ${OSTREE_VERSION}
\`\`\`
## Packages Included
EOF
ls -1 release-assets-${{ matrix.target_distro }}/*.deb 2>/dev/null | sed 's|.*/||' | while read package; do
echo "- \`$package\`" >> release-assets-${{ matrix.target_distro }}/INSTALL.md
done
echo "" >> release-assets-${{ matrix.target_distro }}/INSTALL.md
echo "Build completed on: $(date)" >> release-assets-${{ matrix.target_distro }}/INSTALL.md
- name: Upload to Debian Package Registry
id: debian_upload
shell: bash
run: |
echo "=== Uploading packages to Debian Package Registry for ${{ matrix.target_distro }} ==="
# Check if ACCESS_TOKEN is available
if [ -z "${{ secrets.ACCESS_TOKEN }}" ]; then
echo "❌ ACCESS_TOKEN is not set"
exit 1
fi
echo "✅ ACCESS_TOKEN is set"
# List contents of release-assets for debugging
echo "Contents of release-assets-${{ matrix.target_distro }}/:"
ls -la release-assets-${{ matrix.target_distro }}/ || echo "release-assets-${{ matrix.target_distro }}/ directory not found or empty."
upload_success=0
upload_failed=0
for deb_file in release-assets-${{ matrix.target_distro }}/*.deb; do
if [ -f "$deb_file" ]; then
echo "Uploading $deb_file to Debian Package Registry..."
filename=$(basename "$deb_file")
echo "File: $filename"
# 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/${{ matrix.package_upload_path }}/upload")
echo "HTTP Response Code: $http_code"
if [ "$http_code" = "201" ]; then
echo "✅ Debian Package Registry upload SUCCESS for $deb_file"
((upload_success++))
elif [ "$http_code" = "409" ]; then
echo "➡️ INFO: Package $deb_file already exists (HTTP 409 Conflict)"
((upload_success++))
else
echo "❌ Debian Package Registry upload FAILED for $deb_file (HTTP $http_code)"
((upload_failed++))
# 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/${{ matrix.package_upload_path }}/upload" 2>&1
fi
fi
done
echo "Upload Summary for ${{ matrix.target_distro }}:"
echo " ✅ Successful uploads: $upload_success"
echo " ❌ Failed uploads: $upload_failed"
if [ $upload_failed -gt 0 ]; then
echo "::warning::Some package uploads failed for ${{ matrix.target_distro }}"
fi
- name: Check uploaded packages and provide assignment instructions
run: |
echo "=== Package Upload Summary for ${{ matrix.target_distro }} ==="
echo ""
echo "📦 Check the HTTP response codes above to see if uploads succeeded"
echo "🔍 HTTP 201 = Success, HTTP 401 = Authentication failed, HTTP 403 = Permission denied"
echo ""
echo "📋 If uploads succeeded (HTTP 201), to make packages visible in your repository:"
echo "1. Go to: https://git.raines.xyz/robojerk/-/packages"
echo "2. Find the uploaded packages (they may be under 'debian' or 'generic')"
echo "3. Click on each package → Settings → Assign to repository"
echo "4. Select 'libostree-dev' repository"
echo ""
echo "🔗 After assignment, packages will appear at:"
echo " https://git.raines.xyz/robojerk/libostree-dev/packages"
echo ""
echo "📝 Packages that were attempted for ${{ matrix.target_distro }}:"
for deb_file in release-assets-${{ matrix.target_distro }}/*.deb; do
if [ -f "$deb_file" ]; then
filename=$(basename "$deb_file")
echo " 📦 $filename"
fi
done
echo ""
echo "🎯 Next steps:"
echo " - Check HTTP response codes above"
echo " - If HTTP 201, manually assign packages to repository via web UI"
echo " - If HTTP 401/403, check token permissions"
- name: Check Package Status
shell: bash
run: |
echo "=== Checking Package Status for ${{ matrix.target_distro }} ==="
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: ${#response} characters"
echo "First 200 characters:"
echo "$response" | head -c 200
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 not valid JSON"
fi
else
echo "❌ No response from packages API"
fi
- name: Success Summary
run: |
echo "=== Upload Summary for ${{ matrix.target_distro }} ==="
echo "✅ All Debian packages uploaded successfully to Forgejo Debian Package Registry"
echo "✅ Packages automatically assigned to repository by Forgejo"
echo ""
echo "📦 Packages should now be available at:"
echo " https://git.raines.xyz/robojerk/libostree-dev/packages"
echo ""
echo "🎯 Next steps:"
echo " - Verify packages appear in repository packages page"
echo " - Test package installation on ${{ matrix.target_distro }} systems"
echo ""
echo "📊 Build completed for ${{ matrix.target_distro }}"
echo " Source: ${{ matrix.source_release }}"
echo " Target: ${{ matrix.target_release }}"
echo " Suffix: ${{ matrix.backport_suffix }}"