From 53aa484518ee1b9d4f9a1c028160a81dd2159bbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Kek=C3=A4l=C3=A4inen?= Date: Thu, 2 Aug 2018 11:21:34 +0800 Subject: [PATCH] Add Gitlab-CI definition file that can test each commit to this repository Modeled after what Debian Salsa CI team uses, see https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml Modified a bit to stay under the 4 MB log size limit and 100 MB artefact limit. Attempted to get all of Salsa CI working, but ran into failures and was unable to overcome all of them, so leaving some parts of the pipeline disabled for now. --- debian/.gitlab-ci.yml | 84 +++++++++++++++++++++++++++++++++++++++++++ debian/tests/smoke | 16 +++++++++ 2 files changed, 100 insertions(+) create mode 100644 debian/.gitlab-ci.yml diff --git a/debian/.gitlab-ci.yml b/debian/.gitlab-ci.yml new file mode 100644 index 000000000..9150f20cb --- /dev/null +++ b/debian/.gitlab-ci.yml @@ -0,0 +1,84 @@ +variables: + DEBFULLNAME: "Salsa Pipeline" + DEBEMAIL: "" + DEBIAN_FRONTEND: noninteractive + WORKING_DIR: ./debian/output + DEB_BUILD_OPTIONS: "nocheck noautodbgsym" + RELEASE: unstable + +stages: + - build + - test + +build package: + stage: build + image: registry.salsa.debian.org/salsa-ci-team/images/gbp + services: + - docker:dind + artifacts: + expire_in: 180 day + name: "$CI_BUILD_NAME" + paths: + - ${WORKING_DIR}/ + script: + - gbp pull --ignore-branch --pristine-tar --track-missing + - while true; do sleep 600; echo "10 minutes passed" >&2; done & # Progress keeper since build is long and silent + - gbp buildpackage --git-ignore-branch --git-export-dir=${WORKING_DIR} -us -uc --git-builder="docker-build.sh registry.salsa.debian.org/salsa-ci-team/images/base:${RELEASE}" | tail -n 10000 # Keep log under 4 MB + - du -shc ${WORKING_DIR}/* # Show total file size of artifacts. Must stay are under 100 MB. + +# Autopkgtest must be disabled, because the test 'upstream' will be skipped and +# thus the command returns exit code 2 and is considered failed by Gitlab CI. +# Removing 'breaks-testbed' stanza from tests/control will result in that the +# test is run on Gitlab CI, but then it will fail in multiple tests as it cannot +# bind to network interfaces and other needes stuff inside Gitlab CI containers. +# +#run autopkgtest: +# stage: test +# script: +# - apt-get update && apt-get install autopkgtest eatmydata -y --no-install-recommends +# - eatmydata autopkgtest ${WORKING_DIR}/*.deb -- null + +run lintian: + stage: test + image: registry.salsa.debian.org/salsa-ci-team/images/lintian + script: + - apt-get update + - apt-get install -y dpkg-dev + - lintian -iI ${WORKING_DIR}/*.changes + +# Reprotest exceeds the 2 hour timeout limit on Github CI, so results in failure +# and must be disabled until a quicker (times two) build is possible. +#run reprotest: +# stage: test +# image: genericpipeline/reprotest-docker +# artifacts: +# name: "$CI_BUILD_NAME" +# expire_in: 180 day +# paths: +# - ./reprotest.log +# when: always +# script: +# - apt-get update && apt-get install eatmydata -y +# - eatmydata apt-get build-dep -y . +# - export DEB_BUILD_OPTIONS=nocheck +# - eatmydata reprotest . -- null &> reprotest.log +# tags: +# - privileged + +# Piuparts is passing on official piuparts.debian.org, but fail on Gitlab CI +# with 'FAIL: Package purging left files on system'. Disabling for now. +#run piuparts: +# stage: test +# image: genericpipeline/piuparts-docker +# services: +# - docker:dind +# script: +# - CHROOT_PATH=/tmp/debian-unstable +# - CONTAINER_ID=$(docker run --rm -d debian:unstable sleep infinity) +# - docker exec ${CONTAINER_ID} bash -c "apt-get update && apt-get install eatmydata -y" +# - mkdir -p ${CHROOT_PATH} +# - docker export ${CONTAINER_ID} | tar -C ${CHROOT_PATH} -xf - +# - mknod -m 666 ${CHROOT_PATH}/dev/urandom c 1 9 +# - piuparts --hard-link -e ${CHROOT_PATH} ${WORKING_DIR}/*.deb +# tags: +# - privileged diff --git a/debian/tests/smoke b/debian/tests/smoke index d463b168a..43e3a4ca3 100644 --- a/debian/tests/smoke +++ b/debian/tests/smoke @@ -21,6 +21,22 @@ set -ex # 2) Creates a test table and checks it appears to operate normally # using the test user and test database. +# Start the deamon if it was not running. For example in Docker testing +# environments there might not be any systemd et al and the service needs to +# be started manually. +if ! which systemctl +then + if ! /etc/init.d/mysql status + then + echo "Did not find systemctl and deamon was not running, starting it.." + /etc/init.d/mysql start + fi +else + # If systemd (and systemctl) is available, but the service did not start, then + # this smoke test is supposed to fail if next commands don't work. + echo "Found systemctl, continuing smoke test.." +fi + mysql <