[Buildroot] [git commit] utils/docker-run: allow IMAGE to be passed in the environment

Yann E. MORIN yann.morin.1998 at free.fr
Thu Sep 7 14:52:47 UTC 2023


commit: https://git.buildroot.net/buildroot/commit/?id=80a1e728b0053e6fb7dc8ea9c1331749b3695f03
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

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 <thomas.petazzoni at bootlin.com>
[yann.morin.1998 at free.fr: s/\t/    /g]
Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
---
 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



More information about the buildroot mailing list