From 80a1e728b0053e6fb7dc8ea9c1331749b3695f03 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Sun, 20 Aug 2023 15:33:32 +0200 Subject: [PATCH] utils/docker-run: allow IMAGE to be passed in the environment It is sometimes useful to use docker-run, but with a different image than the default one. This commit allows to override the image being used by only defining IMAGE if not already passed in the environment. Signed-off-by: Thomas Petazzoni [yann.morin.1998@free.fr: s/\t/ /g] Signed-off-by: Yann E. MORIN --- utils/docker-run | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/utils/docker-run b/utils/docker-run index 33d2e63abc..848e9b3840 100755 --- a/utils/docker-run +++ b/utils/docker-run @@ -9,9 +9,11 @@ else # Support git-worktree GIT_DIR="$(cd "${MAIN_DIR}" && git rev-parse --no-flags --git-common-dir)" fi -# shellcheck disable=SC2016 -IMAGE=$(grep ^image: "${MAIN_DIR}/.gitlab-ci.yml" | \ - sed -e 's,^image: ,,g' | sed -e 's,\$CI_REGISTRY,registry.gitlab.com,g') +if test -z "${IMAGE}" ; then + # shellcheck disable=SC2016 + IMAGE=$(grep ^image: "${MAIN_DIR}/.gitlab-ci.yml" | \ + sed -e 's,^image: ,,g' | sed -e 's,\$CI_REGISTRY,registry.gitlab.com,g') +fi declare -a docker_opts=( -i