mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-12 15:36:17 +01:00
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
This commit is contained in:
parent
ee53245c14
commit
36aacb8ae3
@ -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" \
|
||||
|
Loading…
Reference in New Issue
Block a user