support building merge request branches

CI_COMMIT_TAG is only present when building a tag, in which case the var
CI_COMMIT_REF_NAME is set to the tag name rather than the branch name.  gbp
does not build from tags, only branches.
This commit is contained in:
Hans-Christoph Steiner 2018-05-18 15:29:12 +02:00
parent aaefe38f84
commit cbb63b4343
1 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,10 @@
#!/bin/bash
if [ "$CI_COMMIT_REF_NAME" == "upstream" ] || [ "$CI_COMMIT_REF_NAME" == "pristine-tar" ]; then
echo No builds run on the $CI_COMMIT_REF_NAME branch, exiting
exit 0
fi
set -e
set -x
@ -18,6 +23,10 @@ git remote -v
git branch --track pristine-tar origin/pristine-tar || true
echo "make master branch current for gbp"
git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA"
gbp buildpackage -us -uc
if [ -z "$CI_COMMIT_TAG" ]; then
gbp buildpackage -uc -us --git-debian-branch="$CI_COMMIT_REF_NAME"
else
gbp buildpackage -uc -us
fi
exec "$@"