##// END OF EJS Templates
feat(dev-tools): allow non-interactive run of vcs/ce code for CI integration
super-admin -
Show More
@@ -120,6 +120,11 b' dev_tools_vcs_usage() {'
120 printf " Default: .dev-env/cmd-vcs.sh\n"
120 printf " Default: .dev-env/cmd-vcs.sh\n"
121 echo
121 echo
122
122
123 # :flag.usage
124 printf " %s\n" "--no-tty"
125 printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n"
126 echo
127
123 # :command.usage_fixed_flags
128 # :command.usage_fixed_flags
124 printf " %s\n" "--help, -h"
129 printf " %s\n" "--help, -h"
125 printf " Show this help\n"
130 printf " Show this help\n"
@@ -165,6 +170,11 b' dev_tools_ce_usage() {'
165 printf " Default: .dev-env/cmd-ce.sh\n"
170 printf " Default: .dev-env/cmd-ce.sh\n"
166 echo
171 echo
167
172
173 # :flag.usage
174 printf " %s\n" "--no-tty"
175 printf " when running docker command don't attach to TTY. Useful for running a script\n out of shell context, e.g crontab\n"
176 echo
177
168 # :command.usage_fixed_flags
178 # :command.usage_fixed_flags
169 printf " %s\n" "--help, -h"
179 printf " %s\n" "--help, -h"
170 printf " Show this help\n"
180 printf " Show this help\n"
@@ -1008,6 +1018,7 b' dev_tools_vcs_command() {'
1008 exit 1
1018 exit 1
1009 fi
1019 fi
1010
1020
1021 RUN_WITHOUT_TTY=${args[--no-tty]}
1011 code_workdir=${args[--workdir]}
1022 code_workdir=${args[--workdir]}
1012 cmd_script=${args[--cmd]}
1023 cmd_script=${args[--cmd]}
1013
1024
@@ -1037,13 +1048,18 b' dev_tools_vcs_command() {'
1037
1048
1038 docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script"
1049 docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script"
1039
1050
1051 INTERACTIVE_FLAGS="--interactive --tty"
1052 if [[ $RUN_WITHOUT_TTY ]]; then
1053 INTERACTIVE_FLAGS="--interactive"
1054 fi
1055
1040 eval "
1056 eval "
1041 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1057 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1042 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1058 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1043 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 \
1059 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 \
1044 --workdir=\"$code_workdir\" \
1060 --workdir=\"$code_workdir\" \
1045 --name=\"$container_name\" \
1061 --name=\"$container_name\" \
1046 --interactive --tty \
1062 $INTERACTIVE_FLAGS \
1047 --publish 10010:10010 \
1063 --publish 10010:10010 \
1048 vcsserver bash $docker_exec_script"
1064 vcsserver bash $docker_exec_script"
1049
1065
@@ -1061,6 +1077,7 b' dev_tools_ce_command() {'
1061 exit 1
1077 exit 1
1062 fi
1078 fi
1063
1079
1080 RUN_WITHOUT_TTY=${args[--no-tty]}
1064 code_workdir=${args[--workdir]}
1081 code_workdir=${args[--workdir]}
1065 cmd_script=${args[--cmd]}
1082 cmd_script=${args[--cmd]}
1066
1083
@@ -1090,13 +1107,18 b' dev_tools_ce_command() {'
1090
1107
1091 docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script"
1108 docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script"
1092
1109
1110 INTERACTIVE_FLAGS="--interactive --tty"
1111 if [[ $RUN_WITHOUT_TTY ]]; then
1112 INTERACTIVE_FLAGS="--interactive"
1113 fi
1114
1093 eval "
1115 eval "
1094 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1116 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1095 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1117 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1096 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 \
1118 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 \
1097 --workdir=\"$code_workdir\" \
1119 --workdir=\"$code_workdir\" \
1098 --name=\"$container_name\" \
1120 --name=\"$container_name\" \
1099 --interactive --tty \
1121 $INTERACTIVE_FLAGS \
1100 --publish 10020:10020 \
1122 --publish 10020:10020 \
1101 rhodecode bash $docker_exec_script"
1123 rhodecode bash $docker_exec_script"
1102
1124
@@ -2081,6 +2103,14 b' dev_tools_vcs_parse_requirements() {'
2081 fi
2103 fi
2082 ;;
2104 ;;
2083
2105
2106 # :flag.case
2107 --no-tty)
2108
2109 # :flag.case_no_arg
2110 args['--no-tty']=1
2111 shift
2112 ;;
2113
2084 -?*)
2114 -?*)
2085 printf "invalid option: %s\n" "$key" >&2
2115 printf "invalid option: %s\n" "$key" >&2
2086 exit 1
2116 exit 1
@@ -2158,6 +2188,14 b' dev_tools_ce_parse_requirements() {'
2158 fi
2188 fi
2159 ;;
2189 ;;
2160
2190
2191 # :flag.case
2192 --no-tty)
2193
2194 # :flag.case_no_arg
2195 args['--no-tty']=1
2196 shift
2197 ;;
2198
2161 -?*)
2199 -?*)
2162 printf "invalid option: %s\n" "$key" >&2
2200 printf "invalid option: %s\n" "$key" >&2
2163 exit 1
2201 exit 1
General Comments 0
You need to be logged in to leave comments. Login now