From 86a0a42bb0e6eb68e45041bafd1cbb29b879903c Mon Sep 17 00:00:00 2001 From: Quentin Monnet Date: Wed, 11 Dec 2024 15:50:19 +0000 Subject: [PATCH] justfile: Hide DOCKER_SOCKET command output The justfile would use a command snippet starting with "set -x" to determine the path of the Docker socket: this helps for debugging, but most of the time it only prints cryptic messages to the console each time we run just. Make just print the output only when we set "debug=true". We cannot use a variable in the triple-backquoted string, so we need a level of indirection with a separate command and a call to shell(). We also need to append a semicolon to "set -x" when set, and we use replace_regex() for this. Signed-off-by: Quentin Monnet --- justfile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/justfile b/justfile index 5e4bd4a1..bb9ee7a7 100644 --- a/justfile +++ b/justfile @@ -46,9 +46,7 @@ _dev_env_container := _dpdk_sys_container_repo + "/dev-env:" + _dpdk_sys_contain _doc_env_container := _dpdk_sys_container_repo + "/doc-env:" + _dpdk_sys_container_tag _compile_env_container := _dpdk_sys_container_repo + "/compile-env:" + _dpdk_sys_container_tag _network := "host" -export DOCKER_HOST := x"${DOCKER_HOST:-unix:///var/run/docker.sock}" -export DOCKER_SOCK := ``` - set -x +_docker_sock_cmd := replace_regex(_just_debuggable_, ".+", "$0;") + ''' declare -r DOCKER_HOST="${DOCKER_HOST:-unix:///var/run/docker.sock}" declare -r without_unix="${DOCKER_HOST##unix://}" if [ -S "${without_unix}" ]; then @@ -56,7 +54,9 @@ export DOCKER_SOCK := ``` elif [ -S /var/run/docker.sock ]; then printf -- '%s' "/var/run/docker.sock" fi -``` +''' +export DOCKER_HOST := x"${DOCKER_HOST:-unix:///var/run/docker.sock}" +export DOCKER_SOCK := shell(_docker_sock_cmd) # The git commit hash of the last commit to HEAD # We allow this command to fail in the sterile environment because git is not available there