actions / runner

The Runner for GitHub Actions :rocket:
https://github.com/features/actions
MIT License
4.65k stars 895 forks source link

The outdated runner fails to start silently without reporting a failure exit code #3266

Open Felixoid opened 2 months ago

Felixoid commented 2 months ago

Describe the bug When the runner is outdated and supposed to be upgraded, it doesn't report the exit code != 0

To Reproduce Steps to reproduce the behavior:

  1. Go to the runner directory
  2. Run the configuration to register it without auto update ./config.sh --url $RUNNER_URL --token "$(get_runner_token)" --ephemeral --disableupdate --unattended --runnergroup Default --labels "$LABELS" --work _work --name "$INSTANCE_ID"
  3. Then try to launch it ./run.sh && echo This piece of art just silently fails || echo GH does at least anything right

Expected behavior Obviously, the application failing to start must report an error. But instead, we see the next:

√ Connected to GitHub

Current runner version: '2.313.0'
2024-04-30 10:58:45Z: Listening for Jobs
An error occured: Runner version v2.313.0 is deprecated and cannot receive messages.
Runner listener exit with terminated error, stop the service, no retry needed.
Exiting runner...
This piece of art just silently fails

Runner Version and Platform

2.313.0

OS of the machine running the runner? Linux

Reasons

This line should be exit $returnCode, but instead it masks errors.

Although, not only run.sh masks the exit code, but as well the run-helper.sh does it here:

$ bash -x /home/ubuntu/actions-runner/run-helper.sh
++ id -u
+ user_id=1000
+ '[' 1000 -eq 0 -a -z '' ']'
+ shopt -s nocasematch
+ SOURCE=/home/ubuntu/actions-runner/run-helper.sh
+ '[' -h /home/ubuntu/actions-runner/run-helper.sh ']'
+++ dirname /home/ubuntu/actions-runner/run-helper.sh
++ cd -P /home/ubuntu/actions-runner
++ pwd
+ DIR=/home/ubuntu/actions-runner
+ '[' '!' -z '' ']'
+ updateFile=update.finished
+ /home/ubuntu/actions-runner/bin/Runner.Listener run

√ Connected to GitHub

Current runner version: '2.313.0'
2024-04-30 11:29:21Z: Listening for Jobs
An error occured: Runner version v2.313.0 is deprecated and cannot receive messages.
+ returnCode=1 # <------ exit code 1
+ [[ 1 == 0 ]]
+ [[ 1 == 1 ]]
+ echo 'Runner listener exit with terminated error, stop the service, no retry needed.'
Runner listener exit with terminated error, stop the service, no retry needed.
+ exit 0 # <------ but who cares Β―\_(ツ)_/Β―