forked from actions/runner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Make
run.sh|cmd
handle update without quitting so container… (
actions#1635) * Revert "Make `run.sh|cmd` handle update without quitting so containers using them as entrypoints don't exit on update (actions#1494)" d8251bf * update runnerversion as well
- Loading branch information
Showing
7 changed files
with
72 additions
and
123 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,64 @@ | ||
#!/bin/bash | ||
|
||
# Validate not sudo | ||
user_id=`id -u` | ||
if [ $user_id -eq 0 -a -z "$RUNNER_ALLOW_RUNASROOT" ]; then | ||
echo "Must not run interactively with sudo" | ||
exit 1 | ||
fi | ||
|
||
# Change directory to the script root directory | ||
# https://stackoverflow.com/questions/59895/getting-the-source-directory-of-a-bash-script-from-within | ||
SOURCE="${BASH_SOURCE[0]}" | ||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink | ||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | ||
SOURCE="$(readlink "$SOURCE")" | ||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located | ||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | ||
SOURCE="$(readlink "$SOURCE")" | ||
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located | ||
done | ||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" | ||
cp -f run-helper.sh.template run-helper.sh | ||
# run the helper process which keep the listener alive | ||
while :; | ||
do | ||
"$DIR"/run-helper.sh $* | ||
|
||
# Do not "cd $DIR". For localRun, the current directory is expected to be the repo location on disk. | ||
|
||
# Run | ||
shopt -s nocasematch | ||
if [[ "$1" == "localRun" ]]; then | ||
"$DIR"/bin/Runner.Listener $* | ||
else | ||
"$DIR"/bin/Runner.Listener run $* | ||
|
||
# Return code 3 means the run once runner received an update message. | ||
# Sleep 5 seconds to wait for the update process finish | ||
returnCode=$? | ||
if [[ $returnCode == 1 ]]; then | ||
echo "Restarting runner..." | ||
if [[ $returnCode == 3 ]]; then | ||
if [ ! -x "$(command -v sleep)" ]; then | ||
if [ ! -x "$(command -v ping)" ]; then | ||
COUNT="0" | ||
while [[ $COUNT != 5000 ]]; do | ||
echo "SLEEP" > /dev/null | ||
COUNT=$[$COUNT+1] | ||
done | ||
else | ||
ping -c 5 127.0.0.1 > /dev/null | ||
fi | ||
else | ||
sleep 5 | ||
fi | ||
elif [[ $returnCode == 4 ]]; then | ||
if [ ! -x "$(command -v sleep)" ]; then | ||
if [ ! -x "$(command -v ping)" ]; then | ||
COUNT="0" | ||
while [[ $COUNT != 5000 ]]; do | ||
echo "SLEEP" > /dev/null | ||
COUNT=$[$COUNT+1] | ||
done | ||
else | ||
ping -c 5 127.0.0.1 > /dev/null | ||
fi | ||
else | ||
sleep 5 | ||
fi | ||
"$DIR"/bin/Runner.Listener run $* | ||
else | ||
echo "Exiting runner..." | ||
exit 0 | ||
exit $returnCode | ||
fi | ||
done | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.287.0 | ||
2.287.1 |