bootc-deb/.forgejo/workflows/build-packages.yml
robojerk 6bc8f501a9
Some checks failed
Build Packages / Build libostree Backport (push) Successful in 10m11s
Test Build / Test bootc Build (with existing libostree) (push) Failing after 1m7s
Build Packages / Build bootc Package (push) Failing after 1m13s
Build Packages / Create Combined Artifacts (push) Has been skipped
Fix CI/CD patch application and interactive prompt issues
- Update patch file to use correct path: lib/src/cli.rs instead of crates/lib/src/cli.rs
- Simplify patch application to use patch -p1 with correct strip level
- Fix debug step to check correct directory structure
- Add -y flag to all apt update commands to prevent interactive prompts
- Ensure all apt commands use non-interactive mode with proper environment variables

This resolves the "can't find file to patch" error and prevents
interactive prompts that were causing CI/CD failures.
2025-07-21 01:40:25 +00:00

224 lines
No EOL
8.4 KiB
YAML

name: Build Packages
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
env:
UBUNTU_VERSION: "24.04"
OSTREE_VERSION: "2025.2"
BOOTC_VERSION: "1.5.1"
BACKPORT_SUFFIX: "~noble1"
jobs:
build-libostree-backport:
name: Build libostree Backport
runs-on: ubuntu-latest
container:
image: ubuntu:latest
steps:
- name: Setup build environment
run: |
apt update -y
apt install -y devscripts build-essential wget git
- name: Checkout repository manually
run: |
# Clone the repository manually instead of using actions/checkout
git clone https://git.raines.xyz/robojerk/bootc-deb.git /tmp/bootc-deb
cp -r /tmp/bootc-deb/* .
cp -r /tmp/bootc-deb/.* . 2>/dev/null || true
- name: Add source repositories
run: |
echo "deb-src http://us.archive.ubuntu.com/ubuntu/ noble main universe" | tee /etc/apt/sources.list.d/noble-sources.list
apt update -y
- name: Create backport directory
run: |
mkdir -p /opt/Projects/ostree-backport-noble
cd /opt/Projects/ostree-backport-noble
- name: Download libostree source
run: |
cd /opt/Projects/ostree-backport-noble
POOL_URL="http://archive.ubuntu.com/ubuntu/pool/universe/o/ostree/"
wget "${POOL_URL}ostree_${OSTREE_VERSION}-1.dsc"
wget "${POOL_URL}ostree_${OSTREE_VERSION}.orig.tar.xz"
wget "${POOL_URL}ostree_${OSTREE_VERSION}-1.debian.tar.xz"
- name: Extract and modify source
run: |
cd /opt/Projects/ostree-backport-noble
dpkg-source -x "ostree_${OSTREE_VERSION}-1.dsc"
cd "ostree-${OSTREE_VERSION}"
dch --newversion "${OSTREE_VERSION}-1${BACKPORT_SUFFIX}" \
--distribution "noble-backports" \
-b \
"Backport libostree ${OSTREE_VERSION}-1 from Ubuntu questing for bootc compatibility."
- name: Install build dependencies
run: |
cd /opt/Projects/ostree-backport-noble/ostree-${OSTREE_VERSION}
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
apt-get update
apt-get build-dep -y --no-install-recommends ./
- name: Build libostree backport
run: |
cd /opt/Projects/ostree-backport-noble/ostree-${OSTREE_VERSION}
dpkg-buildpackage -us -uc -b
- name: List built packages
run: |
echo "Built libostree packages:"
ls -la /opt/Projects/ostree-backport-noble/*.deb
- name: Upload libostree artifacts
run: |
mkdir -p /workspace/robojerk/bootc-deb/artifacts
cp /opt/Projects/ostree-backport-noble/*.deb /workspace/robojerk/bootc-deb/artifacts/
echo "Libostree artifacts copied to workspace"
ls -la /workspace/robojerk/bootc-deb/artifacts/
build-bootc:
name: Build bootc Package
runs-on: ubuntu-latest
container:
image: ubuntu:latest
needs: build-libostree-backport
steps:
- name: Setup build environment
run: |
apt update -y
apt install -y git cargo rustc pkg-config build-essential
- name: Checkout repository manually
run: |
# Clone the repository manually instead of using actions/checkout
git clone https://git.raines.xyz/robojerk/bootc-deb.git /tmp/bootc-deb
cp -r /tmp/bootc-deb/* .
cp -r /tmp/bootc-deb/.* . 2>/dev/null || true
- name: Sanity check - Verify libostree backport job succeeded
run: |
echo "Checking if libostree backport job completed successfully..."
# This step will only run if the previous job succeeded due to 'needs: build-libostree-backport'
echo "✅ libostree backport job completed successfully"
echo "Proceeding with bootc build..."
- name: Setup build environment for bootc
run: |
apt update -y
apt install -y git cargo rustc pkg-config build-essential
- name: Clone bootc source
run: |
git clone --depth 1 --branch v${BOOTC_VERSION} https://github.com/containers/bootc.git bootc-${BOOTC_VERSION}
cd bootc-${BOOTC_VERSION}
- name: Debug - List files before patching
run: |
cd bootc-${BOOTC_VERSION}
echo "Current directory: $(pwd)"
echo "Files in current directory:"
ls -la
echo "Files in lib/src/ (if it exists):"
ls -la lib/src/ 2>/dev/null || echo "Directory does not exist"
echo "Patch file location:"
ls -la ../bootc-libostree-compatibility.patch
- name: Apply compatibility patch
run: |
cd bootc-${BOOTC_VERSION}
if [ ! -f ../bootc-libostree-compatibility.patch ]; then
echo "❌ ERROR: bootc-libostree-compatibility.patch not found!"
echo "This patch is required for bootc to work with the libostree backport."
exit 1
fi
# Apply patch with correct strip level for lib/src/cli.rs
echo "Applying patch to lib/src/cli.rs..."
patch -p1 < ../bootc-libostree-compatibility.patch
- name: Copy debian packaging
run: |
cd bootc-${BOOTC_VERSION}
if [ ! -d ../debian ]; then
echo "❌ ERROR: debian packaging directory not found!"
echo "The debian/ directory is required for building the package."
exit 1
fi
cp -r ../debian .
- name: Build bootc package
run: |
cd bootc-${BOOTC_VERSION}
echo "Building bootc package with libostree compatibility patch..."
dpkg-buildpackage -us -uc -b
- name: List built packages
run: |
echo "Built bootc packages:"
ls -la bootc-${BOOTC_VERSION}/../*.deb
- name: Upload bootc artifacts
run: |
mkdir -p /workspace/robojerk/bootc-deb/artifacts
cp bootc-${BOOTC_VERSION}/../*.deb /workspace/robojerk/bootc-deb/artifacts/
echo "Bootc artifacts copied to workspace"
ls -la /workspace/robojerk/bootc-deb/artifacts/
create-artifacts:
name: Create Combined Artifacts
runs-on: ubuntu-latest
container:
image: ubuntu:latest
needs: [build-libostree-backport, build-bootc]
steps:
- name: Setup environment
run: |
apt update -y
apt install -y git
- name: Checkout repository manually
run: |
# Clone the repository manually instead of using actions/checkout
git clone https://git.raines.xyz/robojerk/bootc-deb.git /tmp/bootc-deb
cp -r /tmp/bootc-deb/* .
cp -r /tmp/bootc-deb/.* . 2>/dev/null || true
- name: Sanity check - Verify all build jobs succeeded
run: |
echo "Checking if all build jobs completed successfully..."
# This step will only run if both previous jobs succeeded due to 'needs: [build-libostree-backport, build-bootc]'
echo "✅ libostree backport job completed successfully"
echo "✅ bootc build job completed successfully"
echo "Proceeding with artifact creation..."
- name: Create combined artifacts
run: |
mkdir -p release-assets
echo "Creating release assets directory"
# Copy all artifacts from previous jobs
if [ -d "artifacts" ]; then
cp artifacts/*.deb release-assets/ 2>/dev/null || echo "No .deb files found in artifacts"
fi
# Create a summary file
echo "Bootc Debian Package Build Summary" > release-assets/BUILD_SUMMARY.txt
echo "=================================" >> release-assets/BUILD_SUMMARY.txt
echo "Build Date: $(date)" >> release-assets/BUILD_SUMMARY.txt
echo "Ubuntu Version: ${UBUNTU_VERSION}" >> release-assets/BUILD_SUMMARY.txt
echo "Ostree Version: ${OSTREE_VERSION}" >> release-assets/BUILD_SUMMARY.txt
echo "Bootc Version: ${BOOTC_VERSION}" >> release-assets/BUILD_SUMMARY.txt
echo "" >> release-assets/BUILD_SUMMARY.txt
echo "Built Packages:" >> release-assets/BUILD_SUMMARY.txt
ls -la release-assets/*.deb 2>/dev/null || echo "No packages found" >> release-assets/BUILD_SUMMARY.txt
echo "Release assets created:"
ls -la release-assets/