runner: Address all shellcheck findings (#1854)
I am about to revisit #1517, #1454, #1561, and #1560 as a part of our on-going effort for a major enhancement to the runner entrypoints being made in #1759. This change updates and reintroduces #1517 contributed by @CASABECI in a way it becomes applicable to today's code-base.
This commit is contained in:
		
							parent
							
								
									35af24cf03
								
							
						
					
					
						commit
						2dd13b4a19
					
				|  | @ -11,9 +11,9 @@ RUNNER_HOME=${RUNNER_HOME:-/runner} | ||||||
| export ACTIONS_RUNNER_HOOK_JOB_STARTED=/etc/arc/hooks/job-started.sh | export ACTIONS_RUNNER_HOOK_JOB_STARTED=/etc/arc/hooks/job-started.sh | ||||||
| export ACTIONS_RUNNER_HOOK_JOB_COMPLETED=/etc/arc/hooks/job-completed.sh | export ACTIONS_RUNNER_HOOK_JOB_COMPLETED=/etc/arc/hooks/job-completed.sh | ||||||
| 
 | 
 | ||||||
| if [ ! -z "${STARTUP_DELAY_IN_SECONDS}" ]; then | if [ -n "${STARTUP_DELAY_IN_SECONDS}" ]; then | ||||||
|   log.notice "Delaying startup by ${STARTUP_DELAY_IN_SECONDS} seconds" |   log.notice "Delaying startup by ${STARTUP_DELAY_IN_SECONDS} seconds" | ||||||
|   sleep ${STARTUP_DELAY_IN_SECONDS} |   sleep "${STARTUP_DELAY_IN_SECONDS}" | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| if [ -z "${GITHUB_URL}" ]; then | if [ -z "${GITHUB_URL}" ]; then | ||||||
|  | @ -71,11 +71,15 @@ if [[ "${UNITTEST:-}" == '' ]]; then | ||||||
|   shopt -u dotglob |   shopt -u dotglob | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| cd ${RUNNER_HOME} | if ! cd "${RUNNER_HOME}"; then | ||||||
|  |   log.error "Failed to cd into ${RUNNER_HOME}" | ||||||
|  |   exit 1 | ||||||
|  | fi | ||||||
|  | 
 | ||||||
| # past that point, it's all relative pathes from /runner | # past that point, it's all relative pathes from /runner | ||||||
| 
 | 
 | ||||||
| config_args=() | config_args=() | ||||||
| if [ "${RUNNER_FEATURE_FLAG_ONCE:-}" != "true" -a "${RUNNER_EPHEMERAL}" == "true" ]; then | if [ "${RUNNER_FEATURE_FLAG_ONCE:-}" != "true" ] && [ "${RUNNER_EPHEMERAL}" == "true" ]; then | ||||||
|   config_args+=(--ephemeral) |   config_args+=(--ephemeral) | ||||||
|   log.debug 'Passing --ephemeral to config.sh to enable the ephemeral runner.' |   log.debug 'Passing --ephemeral to config.sh to enable the ephemeral runner.' | ||||||
| fi | fi | ||||||
|  |  | ||||||
|  | @ -54,8 +54,7 @@ log.debug 'Waiting for processes to be running...' | ||||||
| processes=(dockerd) | processes=(dockerd) | ||||||
| 
 | 
 | ||||||
| for process in "${processes[@]}"; do | for process in "${processes[@]}"; do | ||||||
|     wait_for_process "$process" |     if ! wait_for_process "$process"; then | ||||||
|     if [ $? -ne 0 ]; then |  | ||||||
|         log.error "$process is not running after max time" |         log.error "$process is not running after max time" | ||||||
|         dump /var/log/dockerd.err.log 'Dumping {path} to aid investigation' |         dump /var/log/dockerd.err.log 'Dumping {path} to aid investigation' | ||||||
|         dump /var/log/supervisor/supervisord.log 'Dumping {path} to aid investigation' |         dump /var/log/supervisor/supervisord.log 'Dumping {path} to aid investigation' | ||||||
|  | @ -66,7 +65,7 @@ for process in "${processes[@]}"; do | ||||||
| done | done | ||||||
| 
 | 
 | ||||||
| if [ -n "${MTU}" ]; then | if [ -n "${MTU}" ]; then | ||||||
|   sudo ifconfig docker0 mtu ${MTU} up |   sudo ifconfig docker0 mtu "${MTU}" up | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| # Wait processes to be running | # Wait processes to be running | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue