##// 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 120 printf " Default: .dev-env/cmd-vcs.sh\n"
121 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 128 # :command.usage_fixed_flags
124 129 printf " %s\n" "--help, -h"
125 130 printf " Show this help\n"
@@ -165,6 +170,11 b' dev_tools_ce_usage() {'
165 170 printf " Default: .dev-env/cmd-ce.sh\n"
166 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 178 # :command.usage_fixed_flags
169 179 printf " %s\n" "--help, -h"
170 180 printf " Show this help\n"
@@ -1008,6 +1018,7 b' dev_tools_vcs_command() {'
1008 1018 exit 1
1009 1019 fi
1010 1020
1021 RUN_WITHOUT_TTY=${args[--no-tty]}
1011 1022 code_workdir=${args[--workdir]}
1012 1023 cmd_script=${args[--cmd]}
1013 1024
@@ -1037,13 +1048,18 b' dev_tools_vcs_command() {'
1037 1048
1038 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 1056 eval "
1041 1057 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1042 1058 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1043 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 1060 --workdir=\"$code_workdir\" \
1045 1061 --name=\"$container_name\" \
1046 --interactive --tty \
1062 $INTERACTIVE_FLAGS \
1047 1063 --publish 10010:10010 \
1048 1064 vcsserver bash $docker_exec_script"
1049 1065
@@ -1061,6 +1077,7 b' dev_tools_ce_command() {'
1061 1077 exit 1
1062 1078 fi
1063 1079
1080 RUN_WITHOUT_TTY=${args[--no-tty]}
1064 1081 code_workdir=${args[--workdir]}
1065 1082 cmd_script=${args[--cmd]}
1066 1083
@@ -1090,13 +1107,18 b' dev_tools_ce_command() {'
1090 1107
1091 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 1115 eval "
1094 1116 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME RC_DEV_CMD_HELP=\"$RC_DEV_CMD_HELP\" \
1095 1117 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1096 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 1119 --workdir=\"$code_workdir\" \
1098 1120 --name=\"$container_name\" \
1099 --interactive --tty \
1121 $INTERACTIVE_FLAGS \
1100 1122 --publish 10020:10020 \
1101 1123 rhodecode bash $docker_exec_script"
1102 1124
@@ -2081,6 +2103,14 b' dev_tools_vcs_parse_requirements() {'
2081 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 2115 printf "invalid option: %s\n" "$key" >&2
2086 2116 exit 1
@@ -2158,6 +2188,14 b' dev_tools_ce_parse_requirements() {'
2158 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 2200 printf "invalid option: %s\n" "$key" >&2
2163 2201 exit 1
General Comments 0
You need to be logged in to leave comments. Login now