Move Debian packaging inside Docker container
Some checks failed
Build bootupd with systemd-boot / build (push) Failing after 1m21s

- Integrate Debian package creation into Docker build step
- Fixes 'cannot stat /usr/bin/bootupd' error
- Binaries are now accessible inside container where they're built
- Remove separate packaging steps that ran outside container
- Complete build and package creation in single Docker run
This commit is contained in:
robojerk 2025-09-05 10:39:34 -07:00
parent a2ba3f941f
commit 7ad5a4c5cb

View file

@ -93,131 +93,32 @@ jobs:
install -Dpm0755 -t /usr/bin ./target/release/bootupd && \
ln -s ./bootupd /usr/bin/bootupctl && \
cp /usr/bin/bootupd /workspace/ && \
cp /usr/bin/bootupctl /workspace/
cp /usr/bin/bootupctl /workspace/ && \
echo 'Creating Debian package...' && \
cd /workspace && \
BUILD_NUMBER=\"${FORGEJO_RUN_NUMBER:-${GITEA_RUN_NUMBER:-$(date +%Y%m%d%H%M%S)}}\" && \
COMMIT_HASH=\"$(git rev-parse HEAD 2>/dev/null || echo unknown)\" && \
SHORT_COMMIT=\"$(echo \"$COMMIT_HASH\" | cut -c1-10)\" && \
mkdir -p bootupd-package/usr/bin bootupd-package/DEBIAN && \
cp /usr/bin/bootupd bootupd-package/usr/bin/ && \
cp /usr/bin/bootupctl bootupd-package/usr/bin/ && \
chmod +x bootupd-package/usr/bin/bootupd bootupd-package/usr/bin/bootupctl && \
printf 'Package: bootupd\\nVersion: 0.1.0+%s+%s\\nSection: admin\\n' \"$BUILD_NUMBER\" \"$SHORT_COMMIT\" > bootupd-package/DEBIAN/control && \
printf 'Priority: optional\\nArchitecture: amd64\\n' >> bootupd-package/DEBIAN/control && \
printf 'Maintainer: CI Build <ci@example.com>\\n' >> bootupd-package/DEBIAN/control && \
printf 'Depends: libc6 (>= 2.39), libgcc-s1 (>= 3.0), ' >> bootupd-package/DEBIAN/control && \
printf 'libssl3t64 (>= 3.0.0), systemd (>= 250)\\n' >> bootupd-package/DEBIAN/control && \
printf 'Description: Distribution-independent bootloader update tool ' >> bootupd-package/DEBIAN/control && \
printf 'with systemd-boot support\\n' >> bootupd-package/DEBIAN/control && \
printf ' Bootupd is a distribution-independent tool for managing ' >> bootupd-package/DEBIAN/control && \
printf 'bootloader updates.\\n' >> bootupd-package/DEBIAN/control && \
printf ' This package includes systemd-boot support.\\n .\\n' >> bootupd-package/DEBIAN/control && \
printf ' Features:\\n - systemd-boot support\\n' >> bootupd-package/DEBIAN/control && \
printf ' - Distribution-independent\\n - Safe bootloader updates\\n' >> bootupd-package/DEBIAN/control && \
dpkg-deb --build bootupd-package bootupd_0.1.0+${BUILD_NUMBER}+${SHORT_COMMIT}_amd64.deb && \
echo '✅ Debian package created: bootupd_0.1.0+${BUILD_NUMBER}+${SHORT_COMMIT}_amd64.deb'
"
- name: Create Debian packaging structure
run: |
cd /tmp/bootupd-sdboot
echo "Creating Debian packaging structure..."
# Create debian directory structure
mkdir -p debian
touch debian/changelog
touch debian/control
touch debian/copyright
touch debian/bootupd.dirs
# Get build information
BUILD_NUMBER="${FORGEJO_RUN_NUMBER:-${GITEA_RUN_NUMBER:-$(date +%Y%m%d%H%M%S)}}"
COMMIT_HASH=$(git rev-parse HEAD 2>/dev/null || echo "unknown")
SHORT_COMMIT=$(echo "$COMMIT_HASH" | cut -c1-10)
# Create changelog
printf 'bootupd (0.1.0+%s+%s) unstable; urgency=medium\n\n' \
"$BUILD_NUMBER" "$SHORT_COMMIT" > debian/changelog
printf ' * CI build %s\n * Commit: %s\n' \
"$BUILD_NUMBER" "$SHORT_COMMIT" >> debian/changelog
printf ' * Built with systemd-boot support\n\n' >> debian/changelog
printf " -- CI Build <ci@example.com> %s\n" \
"$(date -R)" >> debian/changelog
# Create control file
printf "Source: bootupd\nSection: admin\nPriority: optional\n" \
> debian/control
printf 'Maintainer: CI Build <ci@example.com>\n' >> debian/control
printf "Build-Depends: debhelper (>= 13), cargo, rustc\n" >> debian/control
printf 'Standards-Version: 4.6.2\n' >> debian/control
printf 'Homepage: https://github.com/p5/coreos-bootupd\n\n' >> debian/control
printf 'Package: bootupd\nArchitecture: amd64\n' >> debian/control
printf 'Depends: libc6 (>= 2.39), libgcc-s1 (>= 3.0), ' >> debian/control
printf 'libssl3t64 (>= 3.0.0), systemd (>= 250)\n' >> debian/control
printf 'Description: Distribution-independent bootloader update tool ' >> debian/control
printf 'with systemd-boot support\n' >> debian/control
printf ' Bootupd is a distribution-independent tool for managing ' >> debian/control
printf 'bootloader updates.\n' >> debian/control
printf ' This package includes systemd-boot support.\n .\n' >> debian/control
printf ' Features:\n - systemd-boot support\n' >> debian/control
printf ' - Distribution-independent\n - Safe bootloader updates\n' >> debian/control
# Create copyright file
printf 'Format: https://www.debian.org/doc/packaging-manuals/' > debian/copyright
printf 'copyright-format/1.0/\n' >> debian/copyright
printf 'Upstream-Name: bootupd\n' >> debian/copyright
printf 'Upstream-Contact: https://github.com/p5/coreos-bootupd\n' >> debian/copyright
printf 'Source: https://github.com/p5/coreos-bootupd\n\n' >> debian/copyright
printf 'Files: *\nCopyright: 2024 CI Build\nLicense: Apache-2.0\n' >> debian/copyright
printf ' Permission is hereby granted, free of charge, to any person ' >> debian/copyright
printf 'obtaining a copy\n' >> debian/copyright
printf ' of this software and associated documentation files (the "Software"), ' >> debian/copyright
printf 'to deal\n' >> debian/copyright
printf ' in the Software without restriction, including without limitation ' >> debian/copyright
printf 'the rights\n' >> debian/copyright
printf ' to use, copy, modify, merge, publish, distribute, sublicense, ' >> debian/copyright
printf 'and/or sell\n' >> debian/copyright
printf ' copies of the Software, and to permit persons to whom the Software is\n' >> debian/copyright
printf ' furnished to do so, subject to the following conditions:\n .\n' >> debian/copyright
printf ' The above copyright notice and this permission notice shall be ' >> debian/copyright
printf 'included in all\n' >> debian/copyright
printf ' copies or substantial portions of the Software.\n .\n' >> debian/copyright
printf ' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ' >> debian/copyright
printf 'EXPRESS OR\n' >> debian/copyright
printf ' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ' >> debian/copyright
printf 'MERCHANTABILITY,\n' >> debian/copyright
printf ' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT ' >> debian/copyright
printf 'SHALL THE\n' >> debian/copyright
printf ' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n' >> debian/copyright
printf ' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ' >> debian/copyright
printf 'ARISING FROM,\n' >> debian/copyright
printf ' OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER ' >> debian/copyright
printf 'DEALINGS IN THE\n' >> debian/copyright
printf ' SOFTWARE.\n' >> debian/copyright
# Create dirs file
echo "usr/bin" > debian/bootupd.dirs
echo "✅ Debian packaging structure created"
- name: Create Debian package
run: |
cd /tmp/bootupd-sdboot
echo "Creating Debian package for bootupd..."
# Get build information
BUILD_NUMBER="${FORGEJO_RUN_NUMBER:-${GITEA_RUN_NUMBER:-$(date +%Y%m%d%H%M%S)}}"
COMMIT_HASH=$(git rev-parse HEAD 2>/dev/null || echo "unknown")
SHORT_COMMIT=$(echo "$COMMIT_HASH" | cut -c1-10)
# Create package directory structure
mkdir -p bootupd-package/usr/bin
mkdir -p bootupd-package/DEBIAN
# Copy binaries from /usr/bin where they were installed
cp /usr/bin/bootupd bootupd-package/usr/bin/
cp /usr/bin/bootupctl bootupd-package/usr/bin/
chmod +x bootupd-package/usr/bin/bootupd
chmod +x bootupd-package/usr/bin/bootupctl
# Create control file
printf 'Package: bootupd\nVersion: 0.1.0+%s+%s\nSection: admin\n' \
"$BUILD_NUMBER" "$SHORT_COMMIT" > bootupd-package/DEBIAN/control
printf 'Priority: optional\nArchitecture: amd64\n' >> bootupd-package/DEBIAN/control
printf 'Maintainer: CI Build <ci@example.com>\n' >> bootupd-package/DEBIAN/control
printf 'Depends: libc6 (>= 2.39), libgcc-s1 (>= 3.0), ' >> bootupd-package/DEBIAN/control
printf 'libssl3t64 (>= 3.0.0), systemd (>= 250)\n' >> bootupd-package/DEBIAN/control
printf 'Description: Distribution-independent bootloader update tool ' >> bootupd-package/DEBIAN/control
printf 'with systemd-boot support\n' >> bootupd-package/DEBIAN/control
printf ' Bootupd is a distribution-independent tool for managing ' >> bootupd-package/DEBIAN/control
printf 'bootloader updates.\n' >> bootupd-package/DEBIAN/control
printf ' This package includes systemd-boot support.\n .\n' >> bootupd-package/DEBIAN/control
printf ' Features:\n - systemd-boot support\n' >> bootupd-package/DEBIAN/control
printf ' - Distribution-independent\n - Safe bootloader updates\n' >> bootupd-package/DEBIAN/control
# Build Debian package
dpkg-deb --build bootupd-package \
bootupd_0.1.0+${BUILD_NUMBER}+${SHORT_COMMIT}_amd64.deb
echo "✅ Debian package created: bootupd_0.1.0+${BUILD_NUMBER}+${SHORT_COMMIT}_amd64.deb"
- name: Upload to Forgejo Debian Registry
run: |