Simplify CI to use Docker build approach
Some checks failed
Build ostree packages from sid to trixie / Build ostree packages (push) Failing after 2m30s

- Remove container from job definition to avoid network issues
- Use Docker-in-Docker approach with proper Debian unstable environment
- Create build script that runs inside Docker container
- This should resolve the 'forgejo hostname not found' issue
- Simpler and more reliable than trying to mix Ubuntu runner with Debian packages
This commit is contained in:
robojerk 2025-09-06 11:21:11 -07:00
parent 26155427bf
commit a6b65be912

View file

@ -10,152 +10,116 @@ jobs:
build:
name: Build ostree packages
runs-on: ubuntu-latest
container:
image: docker.io/node:iron-trixie
permissions:
contents: read
packages: write
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup environment
run: |
# Try apt-cacher-ng first, fallback to Debian's automatic mirror selection
echo "Checking for apt-cacher-ng availability..."
echo "Cloning repository..."
git clone https://git.raines.xyz/particle-os/ostree.git /tmp/ostree
cd /tmp/ostree
git fetch --all
git checkout ${{ github.sha || gitea.sha || 'main' }}
# Quick check with timeout to avoid hanging
if timeout 10 curl -s --connect-timeout 5 http://192.168.1.101:3142/acng-report.html > /dev/null 2>&1; then
echo "✅ apt-cacher-ng is available, configuring proxy sources..."
echo "deb http://192.168.1.101:3142/ftp.debian.org/debian unstable main contrib non-free" > /etc/apt/sources.list
echo "deb-src http://192.168.1.101:3142/ftp.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list
else
echo "⚠️ apt-cacher-ng not available, using standard Debian mirrors..."
echo "deb http://deb.debian.org/debian unstable main contrib non-free" > /etc/apt/sources.list
echo "deb-src http://deb.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list
fi
# Update package lists
echo "Updating package lists..."
apt update -y
# Install build dependencies
echo "Installing build dependencies..."
apt-get install -y build-essential fakeroot devscripts debian-keyring equivs
- name: Build ostree packages in Docker
run: |
echo "Building ostree packages using Docker..."
- name: Clone ostree from sid
run: |
# Create a Dockerfile for the build environment
cat > /tmp/ostree/Dockerfile.build << 'EOF'
FROM debian:unstable
# Install build dependencies
RUN apt-get update && apt-get install -y \
build-essential \
fakeroot \
devscripts \
debian-keyring \
equivs \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Add Debian sources
RUN echo "deb http://deb.debian.org/debian unstable main" > /etc/apt/sources.list && \
echo "deb-src http://deb.debian.org/debian unstable main" >> /etc/apt/sources.list
# Set working directory
WORKDIR /workspace
# Copy the CI script
COPY build-ostree.sh /workspace/
RUN chmod +x /workspace/build-ostree.sh
CMD ["/workspace/build-ostree.sh"]
EOF
# Create the build script
cat > /tmp/ostree/build-ostree.sh << 'EOF'
#!/bin/bash
set -e
echo "Starting ostree build process..."
# Update package lists
apt-get update
# Clone ostree from Debian sid
echo "Cloning ostree from Debian sid..."
cd /tmp
echo "Current directory before apt source:"
pwd
ls -la
echo "Running apt source ostree..."
if apt source ostree; then
echo "apt source ostree succeeded"
else
echo "apt source ostree failed!"
echo "Checking available packages:"
apt search ostree | head -10
echo "Checking sources:"
cat /etc/apt/sources.list
exit 1
fi
echo "After apt source, checking directory:"
ls -la
echo "Looking for ostree directory:"
ls -la ostree-* || echo "No ostree directory found"
apt source ostree
cd ostree-*
echo "Changed to ostree directory:"
pwd
ls -la
- name: Install build dependencies
run: |
cd /tmp/ostree-*
# Install build dependencies
echo "Installing build dependencies..."
mk-build-deps -i -t 'apt-get -y' debian/control || echo "Build deps installation failed, continuing..."
apt-get update
apt-get build-dep -y . || echo "Build deps installation failed, continuing..."
mk-build-deps -i -t 'apt-get -y' debian/control
apt-get build-dep -y .
# Ensure we have all necessary build tools
echo "Installing additional build tools..."
apt-get install -y build-essential fakeroot devscripts || echo "Additional tools installation failed"
- name: Check source package structure
run: |
cd /tmp/ostree-*
echo "Checking source package structure..."
ls -la
echo "Debian directory contents:"
ls -la debian/
echo "Control file:"
cat debian/control
echo "Rules file:"
cat debian/rules
echo "Changelog:"
head -20 debian/changelog
- name: Add backport revision number
run: |
cd /tmp/ostree-*
# Add backport revision number
echo "Adding backport revision number..."
dch --bpo || echo "dch --bpo failed, continuing..."
- name: Test build
run: |
cd /tmp/ostree-*
dch --bpo
# Test build
echo "Testing build with fakeroot debian/rules binary..."
if fakeroot debian/rules binary; then
echo "Test build successful!"
else
echo "Test build failed!"
exit 1
fi
- name: Build packages
run: |
cd /tmp/ostree-*
fakeroot debian/rules binary
# Build packages
echo "Building ostree packages..."
echo "Current directory before build:"
pwd
ls -la
echo "Running dpkg-buildpackage..."
echo "Build dependencies check:"
echo "Checking if key dependencies are installed..."
dpkg -l | grep libglib2.0-dev || echo "libglib2.0-dev not found"
dpkg -l | grep libfuse3-dev || echo "libfuse3-dev not found"
dpkg -l | grep libsystemd-dev || echo "libsystemd-dev not found"
echo "Running dpkg-buildpackage with proper Debian backport flags..."
echo "Using --build=binary --unsigned-changes as per Debian guidelines..."
if dpkg-buildpackage --build=binary --unsigned-changes; then
echo "Build successful!"
else
echo "Build failed! Checking for any partial packages..."
ls -la /tmp/*.deb 2>/dev/null || echo "No .deb files found after failed build"
echo "Checking build logs..."
ls -la /tmp/ostree-*/ 2>/dev/null || echo "No build directory found"
echo "Checking for build errors..."
find /tmp -name "*.log" -exec echo "=== {} ===" \; -exec cat {} \; 2>/dev/null || echo "No log files found"
echo "Checking debian/rules..."
cat debian/rules 2>/dev/null || echo "No debian/rules found"
echo "Checking debian/control..."
cat debian/control 2>/dev/null || echo "No debian/control found"
exit 1
fi
dpkg-buildpackage --build=binary --unsigned-changes
echo "Build completed! Checking for generated packages..."
ls -la /tmp/*.deb 2>/dev/null || echo "No .deb files found"
echo "Copying packages to workspace..."
cp /tmp/*.deb /workspace/ 2>/dev/null || echo "No .deb files to copy"
cp /tmp/*.dsc /workspace/ 2>/dev/null || echo "No .dsc files to copy"
cp /tmp/*.tar.xz /workspace/ 2>/dev/null || echo "No .tar.xz files to copy"
echo "Workspace contents after copy:"
ls -la ../*.deb
# Copy packages to workspace
cp ../*.deb /workspace/
cp ../*.dsc /workspace/ 2>/dev/null || true
cp ../*.tar.xz /workspace/ 2>/dev/null || true
echo "Packages copied to workspace:"
ls -la /workspace/
EOF
# Build and run the Docker container
cd /tmp/ostree
docker build -f Dockerfile.build -t ostree-builder .
# Run the build
docker run --rm -v /tmp/ostree:/workspace ostree-builder
# Check results
echo "Build completed. Checking for packages..."
ls -la /tmp/ostree/*.deb || echo "No .deb files found"
- name: Upload to Forgejo Debian Registry
run: |
echo "Uploading to Forgejo Debian Registry..."
cd /tmp/ostree
echo "Files in current directory:"
ls -la
@ -176,12 +140,4 @@ jobs:
echo "🎯 Debian package publishing complete!"
echo "📦 Packages are now available in Forgejo Debian Registry"
echo "🔧 To install: apt install ostree libostree-1-1"
- name: Create artifacts
run: |
echo "Creating artifacts..."
mkdir -p /tmp/artifacts
cp *.deb *.dsc *.tar.xz /tmp/artifacts/ 2>/dev/null || echo "No packages to copy"
echo "Artifacts created in /tmp/artifacts/"
ls -la /tmp/artifacts/
echo "🔧 To install: apt install ostree libostree-1-1"