summaryrefslogtreecommitdiff
path: root/.gitlab-ci
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@gnome.org>2020-02-25 19:05:07 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2020-02-25 19:05:07 +0000
commit7bc50b746600646b5cbadcd614f4a0b90a3a35fa (patch)
treefd252cba95cf384c2e9db887d25f7f4fef3c386d /.gitlab-ci
parentd9608a03572e061f04c5c5b84b3baf97a93be21f (diff)
downloadgtk+-7bc50b746600646b5cbadcd614f4a0b90a3a35fa.tar.gz
ci: Update the docker wrapper script
Do a better job at detecting whether we have Docker installed.
Diffstat (limited to '.gitlab-ci')
-rwxr-xr-x.gitlab-ci/run-docker.sh33
1 files changed, 19 insertions, 14 deletions
diff --git a/.gitlab-ci/run-docker.sh b/.gitlab-ci/run-docker.sh
index dc9647bd4b..ef0f56154e 100755
--- a/.gitlab-ci/run-docker.sh
+++ b/.gitlab-ci/run-docker.sh
@@ -85,20 +85,25 @@ else
base_version="v$base_version"
fi
-TAG="registry.gitlab.gnome.org/gnome/gtk/${base}:${base_version}"
+if [ ! -x "$(command -v docker)" ] || [ 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.
+ echo "Using: Podman"
+ format="--format docker"
+ CMD="podman"
+else
+ echo "Using: Docker"
+ format=""
+ CMD="sudo socker"
+fi
-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
+REGISTRY="registry.gitlab.gnome.org"
+TAG="${REGISTRY}/gnome/gtk/${base}:${base_version}"
+if [ $build == 1 ]; then
echo -e "\e[1;32mBUILDING\e[0m: ${base} as ${TAG}"
- sudo docker build \
+ ${CMD} build \
${format} \
--build-arg HOST_USER_ID="$UID" \
--tag "${TAG}" \
@@ -110,16 +115,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
+ ${CMD} login ${REGISTRY}
fi
- sudo docker push $TAG
+ ${CMD} push ${TAG}
exit $?
fi
if [ $run == 1 ]; then
echo -e "\e[1;32mRUNNING\e[0m: ${base} as ${TAG}"
- sudo docker run \
+ ${CMD} run \
--rm \
--volume "$(pwd)/..:/home/user/app" \
--workdir "/home/user/app" \