actions / actions/runner

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

Open
#3,266 1 comment 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
6.3k
Forks
1.4k
Avg merge
1d 16h
Merged PRs (30d)
24

Description

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 ¯\_(ツ)_/¯

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with src/Misc/layoutroot/run.sh and src/Misc/layoutroot/run-helper.sh.template, then reproduce the outdated-runner behavior using the documented ./run.sh command. Trace how the listener's nonzero return code is handled in both scripts. Done means an outdated runner launch propagates a failure exit code instead of reporting success.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
ci-cd, devops
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.