diff --git a/scripts/dev-tools/dev-tools b/scripts/dev-tools/dev-tools index 6bd9119..64b3fef 100755 --- a/scripts/dev-tools/dev-tools +++ b/scripts/dev-tools/dev-tools @@ -120,6 +120,11 @@ dev_tools_vcs_usage() { printf " Default: .dev-env/cmd-vcs.sh\n" echo + # :flag.usage + printf " %s\n" "--no-tty" + printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" + echo + # :command.usage_fixed_flags printf " %s\n" "--help, -h" printf " Show this help\n" @@ -165,6 +170,11 @@ dev_tools_ce_usage() { printf " Default: .dev-env/cmd-ce.sh\n" echo + # :flag.usage + printf " %s\n" "--no-tty" + printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n" + echo + # :command.usage_fixed_flags printf " %s\n" "--help, -h" printf " Show this help\n" @@ -1008,6 +1018,7 @@ dev_tools_vcs_command() { exit 1 fi + RUN_WITHOUT_TTY=${args[--no-tty]} code_workdir=${args[--workdir]} cmd_script=${args[--cmd]} @@ -1037,13 +1048,18 @@ dev_tools_vcs_command() { docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script" + INTERACTIVE_FLAGS="--interactive --tty" + if [[ $RUN_WITHOUT_TTY ]]; then + INTERACTIVE_FLAGS="--interactive" + fi + eval " WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \ ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \ run -e RC_DEV_CMD_HELP=\"'$RC_DEV_CMD_HELP'\" -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_$container_name --rm --use-aliases \ --workdir=\"$code_workdir\" \ --name=\"$container_name\" \ - --interactive --tty \ + $INTERACTIVE_FLAGS \ --publish 10010:10010 \ vcsserver bash $docker_exec_script" @@ -1061,6 +1077,7 @@ dev_tools_ce_command() { exit 1 fi + RUN_WITHOUT_TTY=${args[--no-tty]} code_workdir=${args[--workdir]} cmd_script=${args[--cmd]} @@ -1090,13 +1107,18 @@ dev_tools_ce_command() { docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script" + INTERACTIVE_FLAGS="--interactive --tty" + if [[ $RUN_WITHOUT_TTY ]]; then + INTERACTIVE_FLAGS="--interactive" + fi + eval " WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \ ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \ run -e RC_DEV_CMD_HELP=\"'$RC_DEV_CMD_HELP'\" -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_$container_name --rm --use-aliases \ --workdir=\"$code_workdir\" \ --name=\"$container_name\" \ - --interactive --tty \ + $INTERACTIVE_FLAGS \ --publish 10020:10020 \ rhodecode bash $docker_exec_script" @@ -2081,6 +2103,14 @@ dev_tools_vcs_parse_requirements() { fi ;; + # :flag.case + --no-tty) + + # :flag.case_no_arg + args['--no-tty']=1 + shift + ;; + -?*) printf "invalid option: %s\n" "$key" >&2 exit 1 @@ -2158,6 +2188,14 @@ dev_tools_ce_parse_requirements() { fi ;; + # :flag.case + --no-tty) + + # :flag.case_no_arg + args['--no-tty']=1 + shift + ;; + -?*) printf "invalid option: %s\n" "$key" >&2 exit 1