diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2021-06-02 12:11:48 +0100 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gmail.com> | 2021-06-24 18:17:56 +0000 |
commit | 2cb1be52125eb76d157903953f2c91b849a10c63 (patch) | |
tree | 020b789a3da95edbc1bcb2fefeecf00fc0db0e18 /.gitlab-ci | |
parent | cb633f5fc385c84b393d93ae63d68c34c38cf870 (diff) | |
download | gobject-introspection-2cb1be52125eb76d157903953f2c91b849a10c63.tar.gz |
ci: Update run-docker scripts to work with Podman
Not every Linux distro ships with Docker, and Podman is nicer.
Diffstat (limited to '.gitlab-ci')
-rwxr-xr-x | .gitlab-ci/run-docker-minimal.sh | 33 | ||||
-rwxr-xr-x | .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 |