runner: Make WAIT_FOR_DOCKER_SECONDS configurable and working (#1999)
* runner: Make WAIT_FOR_DOCKER_SECONDS configurable and working Ref #1830 Ref #1804 * Update acceptance/testdata/runnerdeploy.envsubst.yaml Co-authored-by: Callum Tait <15716903+toast-gear@users.noreply.github.com> * Update docs/detailed-docs.md Co-authored-by: Callum Tait <15716903+toast-gear@users.noreply.github.com> Co-authored-by: Callum Tait <15716903+toast-gear@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									86d7893d61
								
							
						
					
					
						commit
						154fcde7d0
					
				|  | @ -74,6 +74,8 @@ spec: | ||||||
|         value: "172.17.0.0/12" |         value: "172.17.0.0/12" | ||||||
|       - name: DOCKER_DEFAULT_ADDRESS_POOL_SIZE |       - name: DOCKER_DEFAULT_ADDRESS_POOL_SIZE | ||||||
|         value: "24" |         value: "24" | ||||||
|  |       - name: WAIT_FOR_DOCKER_SECONDS | ||||||
|  |         value: "3" | ||||||
| 
 | 
 | ||||||
|       dockerMTU: 1400 |       dockerMTU: 1400 | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -1576,6 +1576,12 @@ spec: | ||||||
|         # Issues a sleep command at the start of the entrypoint |         # Issues a sleep command at the start of the entrypoint | ||||||
|         - name: STARTUP_DELAY_IN_SECONDS |         - name: STARTUP_DELAY_IN_SECONDS | ||||||
|           value: "2" |           value: "2" | ||||||
|  |         # Specify the duration to wait for the docker daemon to be available | ||||||
|  |         # The default duration of 120 seconds is sometimes too short | ||||||
|  |         # to reliably wait for the docker daemon to start | ||||||
|  |         # See https://github.com/actions-runner-controller/actions-runner-controller/issues/1804 | ||||||
|  |         - name: WAIT_FOR_DOCKER_SECONDS | ||||||
|  |           value: 120 | ||||||
|         # Disables the wait for the docker daemon to be available check |         # Disables the wait for the docker daemon to be available check | ||||||
|         - name: DISABLE_WAIT_FOR_DOCKER |         - name: DISABLE_WAIT_FOR_DOCKER | ||||||
|           value: "true" |           value: "true" | ||||||
|  |  | ||||||
|  | @ -145,10 +145,14 @@ if [ -z "${UNITTEST:-}" ] && [ -e ./externalstmp ]; then | ||||||
|   mv ./externalstmp/* ./externals/ |   mv ./externalstmp/* ./externals/ | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
|  | WAIT_FOR_DOCKER_SECONDS=${WAIT_FOR_DOCKER_SECONDS:-120} | ||||||
| if [[ "${DISABLE_WAIT_FOR_DOCKER}" != "true" ]] && [[ "${DOCKER_ENABLED}" == "true" ]]; then | if [[ "${DISABLE_WAIT_FOR_DOCKER}" != "true" ]] && [[ "${DOCKER_ENABLED}" == "true" ]]; then | ||||||
|     log.debug 'Docker enabled runner detected and Docker daemon wait is enabled' |     log.debug 'Docker enabled runner detected and Docker daemon wait is enabled' | ||||||
|     log.debug 'Waiting until Docker is available or the timeout is reached' |     log.debug "Waiting until Docker is available or the timeout of ${WAIT_FOR_DOCKER_SECONDS} seconds is reached" | ||||||
|     timeout 120s bash -c 'until docker ps ;do sleep 1; done' |     if ! timeout "${WAIT_FOR_DOCKER_SECONDS}s" bash -c 'until docker ps ;do sleep 1; done'; then | ||||||
|  |       log.notice "Docker has not become available within ${WAIT_FOR_DOCKER_SECONDS} seconds. Exiting with status 1." | ||||||
|  |       exit 1 | ||||||
|  |     fi | ||||||
| else | else | ||||||
|   log.notice 'Docker wait check skipped. Either Docker is disabled or the wait is disabled, continuing with entrypoint' |   log.notice 'Docker wait check skipped. Either Docker is disabled or the wait is disabled, continuing with entrypoint' | ||||||
| fi | fi | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue