summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorChris Evich <cevich@redhat.com>2021-09-15 13:45:08 -0400
committerChris Evich <cevich@redhat.com>2021-09-27 10:37:31 -0400
commitf76fa3475d247bb60f7d1fd40eecc487b97b9c18 (patch)
treeaa3e02e8b2350872f1e1f1fc1945d215190e7959 /contrib
parente27470ba97ae3dda32fb06b408da786f2b25a25d (diff)
downloadpodman-f76fa3475d247bb60f7d1fd40eecc487b97b9c18.tar.gz
podman-f76fa3475d247bb60f7d1fd40eecc487b97b9c18.tar.bz2
podman-f76fa3475d247bb60f7d1fd40eecc487b97b9c18.zip
Cirrus: Add gitlab podman runner test
Add execution of the downstream gitlab-runner tests using rootless podman through the magic of socket-level docker compatibility. Include a comment suggesting how to temporarily disable the test in case it fails beyond podman code scope. Signed-off-by: Chris Evich <cevich@redhat.com>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/cirrus/runner.sh17
-rwxr-xr-xcontrib/cirrus/setup_environment.sh38
2 files changed, 55 insertions, 0 deletions
diff --git a/contrib/cirrus/runner.sh b/contrib/cirrus/runner.sh
index 128398c38..22a66dd08 100755
--- a/contrib/cirrus/runner.sh
+++ b/contrib/cirrus/runner.sh
@@ -286,6 +286,23 @@ function _run_release() {
msg "All OK"
}
+
+function _run_gitlab() {
+ rootless_uid=$(id -u)
+ systemctl enable --now --user podman.socket
+ export DOCKER_HOST=unix:///run/user/${rootless_uid}/podman/podman.sock
+ export CONTAINER_HOST=$DOCKER_HOST
+ cd $GOPATH/src/gitlab.com/gitlab-org/gitlab-runner
+ set +e
+ go test -v ./executors/docker |& tee $GOSRC/gitlab-runner-podman.log
+ ret=$?
+ set -e
+ # This file is collected and parsed by Cirrus-CI so must be in $GOSRC
+ cat $GOSRC/gitlab-runner-podman.log | \
+ go-junit-report > $GOSRC/gitlab-runner-podman.xml
+ return $ret
+}
+
logformatter() {
if [[ "$CI" == "true" ]]; then
# Use similar format as human-friendly task name from .cirrus.yml
diff --git a/contrib/cirrus/setup_environment.sh b/contrib/cirrus/setup_environment.sh
index 41b155943..ef1f83024 100755
--- a/contrib/cirrus/setup_environment.sh
+++ b/contrib/cirrus/setup_environment.sh
@@ -243,6 +243,44 @@ case "$TEST_FLAVOR" in
install_test_configs
;;
+ gitlab)
+ # This only runs on Ubuntu for now
+ if [[ "$OS_RELEASE_ID" != "ubuntu" ]]; then
+ die "This test only runs on Ubuntu due to sheer laziness"
+ fi
+
+ # Ref: https://gitlab.com/gitlab-org/gitlab-runner/-/issues/27270#note_499585550
+
+ remove_packaged_podman_files
+ make install PREFIX=/usr ETCDIR=/etc
+
+ # Need to re-build lists (removed during image production)
+ ooe.sh apt-get -qq -y update
+ msg "Installing previously downloaded/cached packages"
+ # N/B: Tests check/expect `docker info` output, and this `!= podman info`
+ ooe.sh apt-get install --yes --no-download --ignore-missing containerd.io docker-ce docker-ce-cli
+
+ msg "Disabling docker service and socket activation"
+ systemctl stop docker.service docker.socket
+ systemctl disable docker.service docker.socket
+ rm -rf /run/docker*
+ # Guarantee the docker daemon can't be started, even by accident
+ rm -vf $(type -P dockerd)
+
+ msg "Obtaining necessary gitlab-runner testing bits"
+ slug="gitlab.com/gitlab-org/gitlab-runner"
+ helper_fqin="registry.gitlab.com/gitlab-org/gitlab-runner/gitlab-runner-helper:x86_64-latest-pwsh"
+ ssh="ssh $ROOTLESS_USER@localhost -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -o CheckHostIP=no env GOPATH=$GOPATH"
+ showrun $ssh go get -u github.com/jstemmer/go-junit-report
+ showrun $ssh git clone https://$slug $GOPATH/src/$slug
+ showrun $ssh make -C $GOPATH/src/$slug development_setup
+ showrun $ssh bash -c "'cd $GOPATH/src/$slug && GOPATH=$GOPATH go get .'"
+
+ showrun $ssh podman pull $helper_fqin
+ # Tests expect image with this exact name
+ showrun $ssh podman tag $helper_fqin \
+ docker.io/gitlab/gitlab-runner-helper:x86_64-latest-pwsh
+ ;;
swagger) ;& # use next item
consistency) make clean ;;
release) ;;