mirror of
https://github.com/actions/runner.git
synced 2025-12-14 13:43:33 +00:00
Wait for update.sh|cmd to finish instead of waiting 5 seconds - before restarting a runner (#2044)
* 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>
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
@echo off
|
||||
|
||||
SET UPDATEFILE=update.finished
|
||||
"%~dp0\bin\Runner.Listener.exe" run %*
|
||||
|
||||
rem using `if %ERRORLEVEL% EQU N` insterad of `if ERRORLEVEL N`
|
||||
@@ -22,16 +22,30 @@ if %ERRORLEVEL% EQU 2 (
|
||||
)
|
||||
|
||||
if %ERRORLEVEL% EQU 3 (
|
||||
rem Sleep 5 seconds to wait for the runner update process finish
|
||||
echo "Runner listener exit because of updating, re-launch runner in 5 seconds"
|
||||
ping 127.0.0.1 -n 6 -w 1000 >NUL
|
||||
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 Sleep 5 seconds to wait for the ephemeral runner update process finish
|
||||
echo "Runner listener exit because of updating, re-launch ephemeral runner in 5 seconds"
|
||||
ping 127.0.0.1 -n 6 -w 1000 >NUL
|
||||
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
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user