btrfs-progs/ci/ci-build-centos8
David Sterba cb0bf52edc btrfs-progs: ci: fix parameter parsing in image running scripts
There's an unconditional 'shift' in the scripts that will lead to an
error "cannot shift" and this would fail inside CI. We want an implicit
run on current HEAD so shift only when there are more parameters.

Signed-off-by: David Sterba <dsterba@suse.com>
2023-04-12 18:27:19 +02:00

35 lines
915 B
Bash
Executable File

#!/bin/sh
# Usage: $0 [branch] [configure options]
# Create source tarball from HEAD or given branch and build it in Centos 8 CI
# environment. Configure options follow branch name that can be empty.
HERE=`pwd`
if [ -f "configure.ac" ]; then
SOURCEDIR=`pwd`
elif [ -f "../configure.ac" ]; then
cd ..
SOURCEDIR=`pwd`
else
echo "ERROR: cannot determine source directory from `pwd`"
exit 1
fi
CIIMAGEDIR=ci/images/ci-centos-8-x86_64
BRANCH=${1:-HEAD}
if [ "$#" -ge 1 ]; then
shift
fi
HASH=$(git log -1 --format='%h %s' "$BRANCH")
echo "CI: Generate archive from $BRANCH ($HASH)"
git archive --prefix=btrfs-progs-devel/ -o devel.tar "$BRANCH"
echo "$BRANCH $HASH" > GITCOMMIT
tar uvf devel.tar GITCOMMIT
#rm GITCOMMIT
gzip --force --best devel.tar
cd "$CIIMAGEDIR"
cp "$SOURCEDIR/devel.tar.gz" .
./docker-build
./docker-run -- ./test-build devel --disable-documentation --disable-libudev --disable-zoned "$@"