split builds for ssh sesiosn timouts
Some checks failed
Solaris Multi-Package Build / build (i386, 172.16.11.20, 2.6) (push) Failing after 8s
Some checks failed
Solaris Multi-Package Build / build (i386, 172.16.11.20, 2.6) (push) Failing after 8s
This commit is contained in:
parent
649607eaf1
commit
c6b590f77a
@ -1,4 +1,4 @@
|
||||
name: Solaris Multi-Build
|
||||
name: Solaris Multi-Package Build
|
||||
|
||||
on:
|
||||
push:
|
||||
@ -18,95 +18,47 @@ jobs:
|
||||
# - host: 172.16.11.21 # Solaris 2.6 sparc
|
||||
# osver: "2.6"
|
||||
# arch: "sparc"
|
||||
# - host: 172.16.11.22 # Solaris 7 i386
|
||||
# osver: "7"
|
||||
# arch: "i386"
|
||||
# - host: 172.16.11.23 # Solaris 7 sparc
|
||||
# osver: "7"
|
||||
# arch: "sparc"
|
||||
# Add more hosts for each Solaris version / architecture
|
||||
# Add more hosts/archs as needed
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Build binutils on Solaris ${{ matrix.osver }} ${{ matrix.arch }}
|
||||
# --- Build binutils ---
|
||||
- name: Build binutils
|
||||
uses: appleboy/ssh-action@master
|
||||
with:
|
||||
host: ${{ matrix.host }}
|
||||
username: root
|
||||
key: ${{ secrets.BUILD_SSH_KEY }}
|
||||
timeout: 14400
|
||||
timeout: 7200 # 2 hours
|
||||
script: |
|
||||
set -e
|
||||
|
||||
# --- Solaris-compatible host-level lock ---
|
||||
LOCKDIR="/tmp/build-host.lock"
|
||||
while ! mkdir "$LOCKDIR" 2>/dev/null; do
|
||||
echo "Another build is running on this host. Waiting..."
|
||||
sleep 10
|
||||
done
|
||||
echo "Acquired host lock, starting build..."
|
||||
|
||||
# Ensure lock is removed on exit
|
||||
trap "rmdir '$LOCKDIR'" EXIT
|
||||
|
||||
echo "=== Updating sources on Solaris ${{ matrix.osver }} ==="
|
||||
cd /usr/src/buildpkg && git pull
|
||||
cd /usr/src/dbpware-for-solaris && git pull
|
||||
|
||||
# --- Set environment variables ---
|
||||
export BUILDPKG_SCRIPTS=/usr/src/buildpkg/
|
||||
export BUILDPKG_BASE=/usr/src/dbpware-for-solaris/
|
||||
|
||||
# Define build order (other packages commented out)
|
||||
BUILD_ORDER=(
|
||||
binutils
|
||||
# gcc
|
||||
# gmake
|
||||
# coreutils
|
||||
# add more packages in build order
|
||||
)
|
||||
# --- Update sources ---
|
||||
cd $BUILDPKG_SCRIPTS && git pull
|
||||
cd $BUILDPKG_BASE && git pull
|
||||
|
||||
for pkg in "${BUILD_ORDER[@]}"; do
|
||||
echo "=== Checking $pkg ==="
|
||||
cd "$BUILDPKG_BASE/$pkg"
|
||||
# --- Call host-side build script ---
|
||||
$BUILDPKG_BASE/build-package.sh binutils
|
||||
|
||||
# Parse basic fields from build.sh using GNU grep
|
||||
topdir=$(ggrep -E '^topdir=' build.sh | cut -d= -f2)
|
||||
version=$(ggrep -E '^version=' build.sh | cut -d= -f2)
|
||||
pkgver=$(ggrep -E '^pkgver=' build.sh | cut -d= -f2)
|
||||
secname="$topdir"
|
||||
# --- Build gcc (future) ---
|
||||
#- name: Build gcc
|
||||
# uses: appleboy/ssh-action@master
|
||||
# with:
|
||||
# host: ${{ matrix.host }}
|
||||
# username: root
|
||||
# key: ${{ secrets.BUILD_SSH_KEY }}
|
||||
# timeout: 10800 # 3 hours
|
||||
# script: |
|
||||
# export BUILDPKG_SCRIPTS=/usr/src/buildpkg/
|
||||
# export BUILDPKG_BASE=/usr/src/dbpware-for-solaris/
|
||||
# cd $BUILDPKG_SCRIPTS && git pull
|
||||
# cd $BUILDPKG_BASE && git pull
|
||||
# $BUILDPKG_BASE/build-package.sh gcc
|
||||
|
||||
# Skip build if package already exists
|
||||
PKGFILE=$(ls -1 ${secname}-${version}-${pkgver}.dbp*.gz 2>/dev/null | head -n1 || true)
|
||||
if [ -n "$PKGFILE" ]; then
|
||||
echo "Package already built: $PKGFILE. Skipping."
|
||||
continue
|
||||
fi
|
||||
|
||||
echo "=== Building $pkg on Solaris ${{ matrix.osver }} ${{ matrix.arch }} ==="
|
||||
LOGFILE=$(bash build.sh all 2>&1 | tee /tmp/build-$pkg.log | ggrep -oE '[^ ]+\.log' | gtail -n1)
|
||||
|
||||
if [ -n "$LOGFILE" ] && [ -f "$LOGFILE" ]; then
|
||||
echo "Tailing logfile: $LOGFILE"
|
||||
gtail -f "$LOGFILE" &
|
||||
TAIL_PID=$!
|
||||
else
|
||||
echo "ERROR: No logfile detected for $pkg"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wait -n
|
||||
EXIT_CODE=$?
|
||||
kill $TAIL_PID || true
|
||||
|
||||
if [ $EXIT_CODE -eq 0 ]; then
|
||||
echo "Build succeeded for $pkg, deleting logfile."
|
||||
rm -f "$LOGFILE" || true
|
||||
else
|
||||
echo "Build FAILED for $pkg, keeping logfile: $LOGFILE"
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
|
||||
echo "=== Finished $pkg ==="
|
||||
done
|
||||
# Add more packages similarly, each in its own SSH step
|
||||
|
59
build-package.sh
Executable file
59
build-package.sh
Executable file
@ -0,0 +1,59 @@
|
||||
#!/usr/dbpware/bin/bash
|
||||
# Usage: ./build-package.sh <package-name>
|
||||
set -e
|
||||
|
||||
PKG="$1"
|
||||
if [ -z "$PKG" ]; then
|
||||
echo "Usage: $0 <package-name>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# --- Host-level lock ---
|
||||
LOCKDIR="/tmp/build-host.lock"
|
||||
while ! mkdir "$LOCKDIR" 2>/dev/null; do
|
||||
echo "Another build is running on this host. Waiting..."
|
||||
sleep 10
|
||||
done
|
||||
trap "rmdir '$LOCKDIR'" EXIT
|
||||
echo "Acquired host lock, starting build of $PKG"
|
||||
|
||||
# --- Navigate to package directory ---
|
||||
cd "$BUILDPKG_BASE/$PKG"
|
||||
|
||||
# --- Read package metadata from build.sh ---
|
||||
topdir=$(ggrep -E '^topdir=' build.sh | cut -d= -f2)
|
||||
version=$(ggrep -E '^version=' build.sh | cut -d= -f2)
|
||||
pkgver=$(ggrep -E '^pkgver=' build.sh | cut -d= -f2)
|
||||
secname="$topdir"
|
||||
|
||||
# --- Check if package already exists ---
|
||||
PKGFILE=$(ls -1 ${secname}-${version}-${pkgver}.dbp*.gz 2>/dev/null | head -n1 || true)
|
||||
if [ -n "$PKGFILE" ]; then
|
||||
echo "Package already built: $PKGFILE. Skipping."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# --- Run the build ---
|
||||
LOGFILE=$(bash build.sh all 2>&1 | tee /tmp/build-$secname.log | ggrep -oE '[^ ]+\.log' | gtail -n1)
|
||||
if [ -n "$LOGFILE" ] && [ -f "$LOGFILE" ]; then
|
||||
echo "Tailing logfile: $LOGFILE"
|
||||
gtail -f "$LOGFILE" &
|
||||
TAIL_PID=$!
|
||||
else
|
||||
echo "ERROR: No logfile detected for $PKG"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wait -n
|
||||
EXIT_CODE=$?
|
||||
kill $TAIL_PID || true
|
||||
|
||||
if [ $EXIT_CODE -eq 0 ]; then
|
||||
echo "Build succeeded for $PKG, deleting logfile."
|
||||
rm -f "$LOGFILE" || true
|
||||
else
|
||||
echo "Build FAILED for $PKG, keeping logfile: $LOGFILE"
|
||||
exit $EXIT_CODE
|
||||
fi
|
||||
|
||||
echo "=== Finished build of $PKG ==="
|
Loading…
x
Reference in New Issue
Block a user