Clean up to illustrate handoff to repo build scripts

Signed-off-by: Russ Magee <rmagee@gmail.com>
This commit is contained in:
Russ Magee 2020-01-29 17:20:38 -08:00
parent 3775fda955
commit 58b205cab7
2 changed files with 18 additions and 77 deletions

View File

@ -101,4 +101,5 @@ bacillus -D="${DEMO}"\
onPush-bacillus-build:kD::"../bacillus_pushbuild.sh" \
onPush-xs-build:kD:FOO=bar,BAZ=buzz:"../xs_pushbuild.sh" \
onPush-bacillus-artifact:kW:BACILLUS_FOO=foo,BACILLUS_BAR=bar:"../artifact.sh" \
onPush-brevity-build:kD::"../brevity_pushbuild.sh"
onPush-brevity-build:kD::"../brevity_pushbuild.sh" \
onPush-anyrepo-script:kD::"../pushbuild.sh"

View File

@ -1,24 +1,16 @@
#!/bin/bash
##
# Example script to clone a specific hardcoded repo and chain to its
# build/test/whatever script.
#
# For a similar, parameterized example that can run from a variety of repos
# and launch different scripts, see pushbuild.sh in this directory.
##
#Exit on error
set -e
export PATH=/usr/local/bin:/usr/bin:/usr/lib/ccache/bin:/bin
echo "workdir: ${BACILLUS_WORKDIR}"
mkdir -p "${BACILLUS_ARTFDIR}"
export GO111MODULE=on
export GOPATH="${HOME}/go"
# GOCACHE will be phased out in v1.12. [github.com/golang/go/issues/26809]
export GOCACHE="${HOME}/.cache/go-build"
echo "---"
go env
echo "---"
echo "passed env:"
env
echo "---"
#################################################
function stage {
local _stage="${BACILLUS_WORKDIR}"/_stage
@ -29,71 +21,19 @@ function stage {
echo -n ":$1" >>"${BACILLUS_WORKDIR}"/_stage
fi
}
#################################################
export REPO=xs
export REPO_URI=https://gogs.blitter.com/RLabs/${REPO}
#cd ${BACILLUS_WORKDIR}
stage "Clone"
echo "curDir: $PWD"
rm -rf build
mkdir -p build
cd build
git clone https://gogs.blitter.com/RLabs/xs
cd xs
branch=$(git for-each-ref --sort=-committerdate --format='%(refname)' | head -n 1)
echo "Building most recent push on branch $branch"
git checkout "$branch"
ls
git clone ${REPO_URI}
#stage "Stuff"
#
#for i in $(seq 1 20); do echo Doing stuff ${i}...; sleep 1; done
## Hand off to project's build/test script
. ${REPO}/bacillus/ci_pushbuild.sh
stage "Build"
make all
stage "Test(Authtoken)"
echo "Clearing test user $USER ~/.xs_id file ..."
rm -f ~/.xs_id
echo "Setting dummy authtoken in ~/.xs_id ..."
echo "localhost:asdfasdfasdf" >~/.xs_id
echo "Performing remote command on @localhost via authtoken login ..."
tokentest=$(timeout 10 xs -x "echo -n FOO" @localhost)
if [ "${tokentest}" != "FOO" ]; then
echo "AUTHTOKEN LOGIN FAILED"
exit 1
else
echo "client cmd performed OK."
unset tokentest
fi
stage "Test(S->C)"
echo "Testing secure copy from server -> client ..."
tmpdir=$$
mkdir -p /tmp/$tmpdir
cd /tmp/$tmpdir
xc @localhost:${BACILLUS_WORKDIR}/build/xs/cptest .
echo -n "Integrity check on copied files (sha1sum) ..."
sha1sum $(find cptest -type f | sort) >sc.sha1sum
diff sc.sha1sum ${BACILLUS_WORKDIR}/build/xs/cptest.sha1sum
stat=$?
cd -
rm -rf /tmp/$tmpdir
if [ $stat -eq "0" ]; then
echo "OK."
else
echo "FAILED!"
exit $stat
fi
stage "Test(C->S)"
echo "TODO ..."
stage "Artifacts"
echo -n "Creating tarfile ..."
tar -cz --exclude=.git --exclude=cptest -f ${BACILLUS_ARTFDIR}/xs.tgz .
stage "Cleanup"
rm -f ~/.xs_id
echo
echo "--Done--"