mirror of
https://github.com/actions/runner.git
synced 2025-12-10 12:21:58 +00:00
* update.sh new logic with creating a file and waiting for it for 30 sec * pr refactor * removing file when it's detected bu run-helper * Update src/Misc/layoutroot/run-helper.sh.template Co-authored-by: Ferenc Hammerl <31069338+fhammerl@users.noreply.github.com> * clean up update.finished in Runner.Listener right before it starts a process _update.sh * pr fix IOUtil.DeleteFile * self update widnows version - cmd * same logic for returnCode 4 - ephemeral * Init var so cmd doesn't run into syntax errors * Use constants, setting a var messed up ERRORLEVEL * Use var for updatefile Co-authored-by: stefanruvceski <ruvceskistefan@github.com> Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com> Co-authored-by: Ferenc Hammerl <hammerl.ferenc@gmail.com>
53 lines
1.5 KiB
Plaintext
53 lines
1.5 KiB
Plaintext
@echo off
|
|
SET UPDATEFILE=update.finished
|
|
"%~dp0\bin\Runner.Listener.exe" run %*
|
|
|
|
rem using `if %ERRORLEVEL% EQU N` insterad of `if ERRORLEVEL N`
|
|
rem `if ERRORLEVEL N` means: error level is N or MORE
|
|
|
|
if %ERRORLEVEL% EQU 0 (
|
|
echo "Runner listener exit with 0 return code, stop the service, no retry needed."
|
|
exit /b 0
|
|
)
|
|
|
|
if %ERRORLEVEL% EQU 1 (
|
|
echo "Runner listener exit with terminated error, stop the service, no retry needed."
|
|
exit /b 0
|
|
)
|
|
|
|
if %ERRORLEVEL% EQU 2 (
|
|
echo "Runner listener exit with retryable error, re-launch runner in 5 seconds."
|
|
ping 127.0.0.1 -n 6 -w 1000 >NUL
|
|
exit /b 1
|
|
)
|
|
|
|
if %ERRORLEVEL% EQU 3 (
|
|
rem Wait for 30 seconds or for flag file to exists for the ephemeral runner update process finish
|
|
echo "Runner listener exit because of updating, re-launch runner after successful update"
|
|
FOR /L %%G IN (1,1,30) DO (
|
|
IF EXIST %UPDATEFILE% (
|
|
echo "Update finished successfully."
|
|
del %FILE%
|
|
exit /b 1
|
|
)
|
|
ping 127.0.0.1 -n 2 -w 1000 >NUL
|
|
)
|
|
exit /b 1
|
|
)
|
|
|
|
if %ERRORLEVEL% EQU 4 (
|
|
rem Wait for 30 seconds or for flag file to exists for the runner update process finish
|
|
echo "Runner listener exit because of updating, re-launch runner after successful update"
|
|
FOR /L %%G IN (1,1,30) DO (
|
|
IF EXIST %UPDATEFILE% (
|
|
echo "Update finished successfully."
|
|
del %FILE%
|
|
exit /b 1
|
|
)
|
|
ping 127.0.0.1 -n 2 -w 1000 >NUL
|
|
)
|
|
exit /b 1
|
|
)
|
|
|
|
echo "Exiting after unknown error code: %ERRORLEVEL%"
|
|
exit /b 0 |