opm-common/jenkins/setup-opm-tests.sh
Arne Morten Kvarving 93b8d26f86 fixed: allow using update_data with a opm-tests PR
the update_data command needs a full opm-tests checkout,
not just a shallow clone of the PR branch. we thus first
copy the shared copy, then we pull the PR branch into that copy.
2018-08-03 10:19:08 +02:00

35 lines
1.0 KiB
Bash
Executable File

#!/bin/bash
# Predefined by environment
if test -z "$OPM_TESTS_ROOT"
then
OPM_TESTS_REVISION="master"
if grep -q "opm-tests=" <<< $ghprbCommentBody
then
OPM_TESTS_REVISION=pull/`echo $ghprbCommentBody | sed -r 's/.*opm-tests=([0-9]+).*/\1/g'`/merge
fi
# Not specified in trigger, use shared copy
if [[ "$OPM_TESTS_REVISION" = "master" ]] && [[ ! "$OPM_TESTS_ROOT_PREDEFINED" = "" ]]
then
if ! test -d $WORKSPACE/deps/opm-tests
then
cp $OPM_TESTS_ROOT_PREDEFINED $WORKSPACE/deps/opm-tests -R
fi
else
# We need a full repo checkout
cp $OPM_TESTS_ROOT_PREDEFINED $WORKSPACE/deps/opm-tests -R
pushd $WORKSPACE/deps/opm-tests
# Then we fetch the PR branch
git remote add PR https://github.com/OPM/opm-tests
git fetch --depth 1 PR $OPM_TESTS_REVISION:branch_to_build
git checkout branch_to_build
popd
fi
else
if ! test -d $WORKSPACE/deps/opm-tests
then
cp $OPM_TESTS_ROOT $WORKSPACE/deps/opm-tests -R
fi
fi
OPM_TESTS_ROOT=$WORKSPACE/deps/opm-tests