split out functionality from entrypoint into individual scripts
This commit is contained in:
parent
213709b138
commit
2caa367232
|
|
@ -25,12 +25,14 @@ RUN mkdir -p /usr/share/man/man1 \
|
||||||
&& apt-get clean \
|
&& apt-get clean \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
COPY gitlab-ci-git-buildpackage /
|
|
||||||
COPY gitlab-ci-common /usr/share/
|
COPY gitlab-ci-common /usr/share/
|
||||||
COPY gitlab-ci-aptly /usr/bin/
|
COPY gitlab-ci-aptly /usr/bin/
|
||||||
COPY gitlab-ci-autopkgtest /usr/bin/
|
COPY gitlab-ci-autopkgtest /usr/bin/
|
||||||
|
COPY gitlab-ci-entrypoint /usr/bin/
|
||||||
|
COPY gitlab-ci-git-buildpackage /usr/bin/
|
||||||
|
COPY gitlab-ci-git-buildpackage-all /usr/bin/
|
||||||
COPY gitlab-ci-lintian /usr/bin/
|
COPY gitlab-ci-lintian /usr/bin/
|
||||||
COPY gitlab-ci-enable-sid /usr/bin/
|
COPY gitlab-ci-enable-sid /usr/bin/
|
||||||
COPY gitlab-ci-enable-experimental /usr/bin/
|
COPY gitlab-ci-enable-experimental /usr/bin/
|
||||||
|
|
||||||
ENTRYPOINT ["/gitlab-ci-git-buildpackage"]
|
ENTRYPOINT ["/usr/bin/gitlab-ci-entrypoint"]
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
! test -z "$CI_COMMIT_REF_NAME"
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
exec "$@"
|
||||||
|
|
@ -1,63 +1,37 @@
|
||||||
#!/bin/bash
|
#!/bin/bash -e
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
. /usr/share/gitlab-ci-common
|
. /usr/share/gitlab-ci-common
|
||||||
|
|
||||||
# https://gitlab.com/gitlab-org/gitlab-runner/issues/1380#note_48552305
|
# these are all required
|
||||||
lockfile=/.lock
|
! test -z "$CI_PROJECT_DIR"
|
||||||
if [[ ! -f $lockfile ]] ; then
|
! test -z "$CI_COMMIT_SHA"
|
||||||
set -e
|
! test -z "$CI_COMMIT_TAG"
|
||||||
set -x
|
! test -z "$CI_COMMIT_REF_NAME"
|
||||||
|
|
||||||
gitlab-ci-enable-sid
|
set -x
|
||||||
gitlab-ci-enable-experimental
|
|
||||||
|
|
||||||
if [ ! -z "$EXTRA_APT_SOURCE" ]; then
|
$apt_get update
|
||||||
printf "\n$EXTRA_APT_SOURCE\n" >> /etc/apt/sources.list
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -z "$DEBIAN_RELEASE" ]; then
|
cd $CI_PROJECT_DIR
|
||||||
sed -i "s, testing , $DEBIAN_RELEASE ," /etc/apt/sources.list
|
if dpkg --compare-versions `dpkg -s apt |sed -n 's,^Version: \(.*\),\1,p'` ge 1.1; then
|
||||||
fi
|
$apt_get build-dep $CI_PROJECT_DIR
|
||||||
|
else
|
||||||
$apt_get update
|
# this is running on an older version, like jessie-backports
|
||||||
$apt_get dist-upgrade
|
export BUILD_DEPENDS=`sed 's/\s*|[^,]*,/,/g' debian/control | perl -ne 'next if /^#/; $p=(s/^Build-Depends:\s*/ / or (/^ / and $p)); s/,|\n|\([^)]+\)//mg; print if $p'`
|
||||||
|
$apt_get install --no-install-recommends \
|
||||||
cd $CI_PROJECT_DIR
|
build-essential fakeroot git-buildpackage pristine-tar $BUILD_DEPENDS
|
||||||
if dpkg --compare-versions `dpkg -s apt |sed -n 's,^Version: \(.*\),\1,p'` ge 1.1; then
|
fi
|
||||||
$apt_get build-dep $CI_PROJECT_DIR
|
$apt_get autoremove --purge
|
||||||
else
|
dpkg-checkbuilddeps
|
||||||
# this is running on an older version, like jessie-backports
|
echo "ensure pristine-tar branch exists and is current"
|
||||||
export BUILD_DEPENDS=`sed 's/\s*|[^,]*,/,/g' debian/control | perl -ne 'next if /^#/; $p=(s/^Build-Depends:\s*/ / or (/^ / and $p)); s/,|\n|\([^)]+\)//mg; print if $p'`
|
git clean -fdx
|
||||||
$apt_get install --no-install-recommends \
|
git reset --hard
|
||||||
build-essential fakeroot git-buildpackage pristine-tar $BUILD_DEPENDS
|
git fetch --all
|
||||||
fi
|
git checkout -B pristine-tar origin/pristine-tar
|
||||||
$apt_get autoremove --purge
|
echo "make $CI_COMMIT_REF_NAME branch current for gbp"
|
||||||
dpkg-checkbuilddeps
|
git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA"
|
||||||
echo "ensure pristine-tar branch exists and is current"
|
if [ -z "$CI_COMMIT_TAG" ]; then
|
||||||
git clean -fdx
|
gbp buildpackage -uc -us --git-debian-branch="$CI_COMMIT_REF_NAME"
|
||||||
git reset --hard
|
else
|
||||||
git fetch --all
|
gbp buildpackage -uc -us
|
||||||
git checkout -B pristine-tar origin/pristine-tar
|
|
||||||
echo "make $CI_COMMIT_REF_NAME branch current for gbp"
|
|
||||||
git checkout -B "$CI_COMMIT_REF_NAME" "$CI_COMMIT_SHA"
|
|
||||||
if [ -z "$CI_COMMIT_TAG" ]; then
|
|
||||||
gbp buildpackage -uc -us --git-debian-branch="$CI_COMMIT_REF_NAME"
|
|
||||||
else
|
|
||||||
gbp buildpackage -uc -us
|
|
||||||
fi
|
|
||||||
|
|
||||||
gitlab-ci-lintian
|
|
||||||
|
|
||||||
if [ -e $CI_PROJECT_DIR/debian/tests/control ]; then
|
|
||||||
gitlab-ci-autopkgtest
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ $CI ]] && touch $lockfile
|
|
||||||
|
|
||||||
exec "$@"
|
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
#!/bin/bash -e
|
||||||
|
|
||||||
|
. /usr/share/gitlab-ci-common
|
||||||
|
|
||||||
|
# these are all required
|
||||||
|
! test -z "$CI_PROJECT_DIR"
|
||||||
|
! test -z "$CI_COMMIT_SHA"
|
||||||
|
! test -z "$CI_COMMIT_TAG"
|
||||||
|
! test -z "$CI_COMMIT_REF_NAME"
|
||||||
|
|
||||||
|
set -x
|
||||||
|
|
||||||
|
gitlab-ci-enable-sid
|
||||||
|
gitlab-ci-enable-experimental
|
||||||
|
|
||||||
|
$apt_get update
|
||||||
|
$apt_get dist-upgrade
|
||||||
|
|
||||||
|
gitlab-ci-git-buildpackage
|
||||||
|
gitlab-ci-lintian
|
||||||
|
|
||||||
|
if [ -e $CI_PROJECT_DIR/debian/tests/control ]; then
|
||||||
|
gitlab-ci-autopkgtest
|
||||||
|
fi
|
||||||
Loading…
Reference in New Issue