summaryrefslogtreecommitdiff
path: root/.gitlab-ci
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2019-12-11 15:44:25 +0100
committerBastien Nocera <hadess@hadess.net>2020-02-04 17:27:39 +0100
commit36aacb8ae36db6352a36ffe1bbaf15c79fe41532 (patch)
tree8849f35a695602345c8d92463811577bb94350fd /.gitlab-ci
parentee53245c14f69059c08519eff01d06a95c67696b (diff)
downloadglib-36aacb8ae36db6352a36ffe1bbaf15c79fe41532.tar.gz
ci: Expand podman support
If podman is used, as is usually the case on a Fedora Workstation installation, make sure not to use "sudo" as that's not needed. Also ask podman's backend (buildah) to create Docker compatible images through an environment variable rather than a command-line argument. See https://gitlab.gnome.org/GNOME/glib/merge_requests/1255
Diffstat (limited to '.gitlab-ci')
-rwxr-xr-x.gitlab-ci/run-docker.sh28
1 files changed, 14 insertions, 14 deletions
diff --git a/.gitlab-ci/run-docker.sh b/.gitlab-ci/run-docker.sh
index 10a9b4816..5f03db853 100755
--- a/.gitlab-ci/run-docker.sh
+++ b/.gitlab-ci/run-docker.sh
@@ -15,6 +15,16 @@ read_arg() {
fi
}
+SUDO_CMD="sudo"
+if `docker -v | grep -q podman` ; then
+ # Using podman
+ SUDO_CMD=""
+ # Docker is actually implemented by podman, and its OCI output
+ # is incompatible with some of the dockerd instances on GitLab
+ # CI runners.
+ export BUILDAH_FORMAT=docker
+fi
+
set -e
build=0
@@ -88,18 +98,8 @@ fi
TAG="registry.gitlab.gnome.org/gnome/glib/${base}:${base_version}"
if [ $build == 1 ]; then
- if docker --help |& grep -q podman; then
- # Docker is actually implemented by podman, and its OCI output
- # is incompatible with some of the dockerd instances on GitLab
- # CI runners.
- format="--format docker"
- else
- format=""
- fi
-
echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}"
- sudo docker build \
- ${format} \
+ $SUDO_CMD docker build \
--build-arg HOST_USER_ID="$UID" \
--tag "${TAG}" \
--file "${base}.Dockerfile" .
@@ -110,16 +110,16 @@ if [ $push == 1 ]; then
echo -e "\e[1;32mPUSHING\e[0m: ${base} as ${TAG}"
if [ $no_login == 0 ]; then
- sudo docker login registry.gitlab.gnome.org
+ $SUDO_CMD docker login registry.gitlab.gnome.org
fi
- sudo docker push $TAG
+ $SUDO_CMD docker push $TAG
exit $?
fi
if [ $run == 1 ]; then
echo -e "\e[1;32mRUNNING\e[0m: ${base} as ${TAG}"
- sudo docker run \
+ $SUDO_CMD docker run \
--rm \
--volume "$(pwd)/..:/home/user/app" \
--workdir "/home/user/app" \