[gobject-introspection/ebassi/issue-319: 14/20] ci: Update run-docker scripts to work with Podman
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/ebassi/issue-319: 14/20] ci: Update run-docker scripts to work with Podman
- Date: Wed, 23 Jun 2021 22:50:28 +0000 (UTC)
commit ae0bb235c8de10ffcdd471d3f65b20b17e3c36bd
Author: Emmanuele Bassi <ebassi gnome org>
Date: Wed Jun 2 12:11:48 2021 +0100
ci: Update run-docker scripts to work with Podman
Not every Linux distro ships with Docker, and Podman is nicer.
.gitlab-ci/run-docker-minimal.sh | 33 +++++++++++++++++++++++++++------
.gitlab-ci/run-docker.sh | 32 ++++++++++++++++++++++++++------
2 files changed, 53 insertions(+), 12 deletions(-)
---
diff --git a/.gitlab-ci/run-docker-minimal.sh b/.gitlab-ci/run-docker-minimal.sh
index 36b2d376..b090c5eb 100755
--- a/.gitlab-ci/run-docker-minimal.sh
+++ b/.gitlab-ci/run-docker-minimal.sh
@@ -1,11 +1,32 @@
#!/bin/bash
+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 docker"
+fi
+
set -e
-TAG="registry.gitlab.gnome.org/gnome/gobject-introspection:min-v1"
+REGISTRY="registry.gitlab.gnome.org/gnome/gobject-introspection"
+TAG="${REGISTRY}:min-v1"
+
+${CMD} build \
+ ${format} \
+ --build-arg HOST_USER_ID="$UID" \
+ --tag "${TAG}" \
+ --file "minimal.Dockerfile" .
-sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
- --file "minimal.Dockerfile" .
-sudo docker run --rm \
- --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
- --tty --interactive "${TAG}" bash
+${CMD} run \
+ --rm \
+ --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
+ --tty --interactive \
+ "${TAG}" \
+ bash
diff --git a/.gitlab-ci/run-docker.sh b/.gitlab-ci/run-docker.sh
index ad73d3ba..6c03d8b0 100755
--- a/.gitlab-ci/run-docker.sh
+++ b/.gitlab-ci/run-docker.sh
@@ -1,11 +1,31 @@
#!/bin/bash
+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 docker"
+fi
+
set -e
-TAG="registry.gitlab.gnome.org/gnome/gobject-introspection:v8"
+REGISTRY="registry.gitlab.gnome.org/gnome/gobject-introspection"
+TAG="${REGISTRY}:v8"
-sudo docker build --build-arg HOST_USER_ID="$UID" --tag "${TAG}" \
- --file "Dockerfile" .
-sudo docker run --rm \
- --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
- --tty --interactive "${TAG}" bash
+${CMD} build \
+ ${format} \
+ --build-arg HOST_USER_ID="$UID" \
+ --tag "${TAG}" \
+ --file "Dockerfile" .
+${CMD} run \
+ --rm \
+ --volume "$(pwd)/..:/home/user/app" --workdir "/home/user/app" \
+ --tty --interactive \
+ "${TAG}" \
+ bash
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]