From 881daf3ffa90e2930a1918dc43f638a06bd21f2c Mon Sep 17 00:00:00 2001 From: "Mads H. Danquah" Date: Tue, 25 May 2021 09:30:39 +0200 Subject: [PATCH] Make it possible to run dplsh non-interactive --- tools/dplsh/Taskfile.yml | 1 + tools/dplsh/dplsh.sh | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/tools/dplsh/Taskfile.yml b/tools/dplsh/Taskfile.yml index af52902..d028863 100644 --- a/tools/dplsh/Taskfile.yml +++ b/tools/dplsh/Taskfile.yml @@ -21,6 +21,7 @@ tasks: test: env: DPLSH_IMAGE: "{{.image}}" + DPLSH_NON_INTERACTIVE: "true" cmds: - ./dplsh.sh terraform -version - ./dplsh.sh helm version diff --git a/tools/dplsh/dplsh.sh b/tools/dplsh/dplsh.sh index b57f0da..aca5959 100755 --- a/tools/dplsh/dplsh.sh +++ b/tools/dplsh/dplsh.sh @@ -204,10 +204,15 @@ for key in "${!docker_creds[@]}"; do ADDITIONAL_ARGS+=(-e "${key}=${docker_creds[$key]}") done +# We run in interactive mode unless if we're in DPLSH_NON_INTERACTIVE. +if [[ -z "${DPLSH_NON_INTERACTIVE:-}" ]]; then + ADDITIONAL_ARGS+=(-i) +fi + docker run --hostname=dplsh \ --rm \ "${ADDITIONAL_ARGS[@]}" \ - -ti \ + -t \ -v "${HOME}/.azure:/home/dplsh/.azure-host" \ -v "${SHELL_ROOT}:/home/dplsh/host_mount" \ -w "/home/dplsh/host_mount/${CHDIR}" \