Skip to contentSkip to conversation

utils/docker-run: allow IMAGE to be passed in the environment

PATCH Applied Thomas Petazzoni via buildroot 2 participants 2 messages Aug 20, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
Note: this patch applies on top of the series of patches on utils/docker-run by Yann E. Morin at
https://patchwork.ozlabs.org/project/buildroot/list/?series=368134.

---
 utils/docker-run | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
utils/docker-run +5 -3
index 02cf68c946..e4581d1c4f 100755
@@ -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
Signature · 6 lines
2.41.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
#1 lore raw

Thomas, All,

On 2023-08-20 15:33 +0200, Thomas Petazzoni via buildroot spake thusly:

Quoted 18 lines

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.

---
Note: this patch applies on top of the series of patches on utils/docker-run by Yann E. Morin at
https://patchwork.ozlabs.org/project/buildroot/list/?series=368134.

---
 utils/docker-run | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
utils/docker-run +0 -0
index 02cf68c946..e4581d1c4f 100755

utils/docker-run else · line 15

Quoted 10 lines
utils/docker-run +4 -3
@@ -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')

s/\t+/ /g

Applied to next, thanks.

Regards,
Yann E. MORIN.

Quoted 11 lines
utils/docker-run +1 -0
+fi
 
 declare -a docker_opts=(
     -i
Signature · 6 lines
2.41.0

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
Signature · 10 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot