Skip to content

./config.sh --check ... should return a non-zero exit code if any check fails. #4395

@beporter

Description

@beporter

Describe the bug

Running ./config.sh --check --url ... --pat ... always exits with a status code of 0, which on linux indicates success. This is the case even when one or more of the checks fail.

The lack of an accurate exit code makes ./config --check useless as a docker HEALTHCHECK method without grepping the text output for F A I L (because the presentation seems to matter more than the information, I guess.)

To Reproduce

  1. Follow the published instructions to set up the runner app and generate a PAT.
  2. Per the published docs, run ./config.sh --check --url https://github.com/your/org-or-repo --pat ghp_1234abcd with the appropriate values replaced.
  3. Run echo $?
  4. The output will always be 0, even when one or more of the checks fails.

Expected behavior

If the STDOUT console output from the --check command contains F A I L anywhere, then the exit code should be non-zero.

Runner Version and Platform

Version of your runner?
v2.334.0

OS of the machine running the runner?

$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.4 LTS"

What's not working?

What should happen?

  • The ReturnCode class should be updated to include a new error state code (if appropriate).
    public const int CheckFailure = 8; for example.
  • The if (command.Check) branch should define an exitCode variable and initialize it to Success.
    var exitCode = Constants.Runner.ReturnCode.Success;
  • In the case of if (!result) for any given check, change the value of exitCode to CheckFailure (or whatever the new constant is named).
    exitCode = Constants.Runner.ReturnCode.CheckFailure;
  • The entire branch should exit with the value of exitCode, instead of hard-coded "Success".
    return exitCode;

Job Log Output

% ./config.sh --check --url $GITHUB_ORG_URL --pat $GITHUB_PAT

*********************************************************************************************
**  Check:               Internet Connection
**  Description:         Check if the Actions runner has internet access.
*********************************************************************************************
**                                                                                         **
**                                            F A I L                                      **
**                                                                                         **
*********************************************************************************************
** Log: /github/actions-runner/_diag/InternetCheck_20260430-171324-utc.log
** Help Doc: https://github.com/actions/runner/blob/main/docs/checks/internet.md
********************************************************************************************


********************************************************************************************
**  Check:               GitHub Actions Connection
**  Description:         Check if the Actions runner has access to the GitHub Actions service.
********************************************************************************************
**                                                                                        **
**                                            F A I L                                     **
**                                                                                        **
********************************************************************************************
** Log: /github/actions-runner/_diag/ActionsCheck_20260430-171324-utc.log
** Help Doc: https://github.com/actions/runner/blob/main/docs/checks/actions.md
********************************************************************************************


********************************************************************************************
**  Check:               Git Certificate/Proxy Validation
**  Description:         Check if the Git CLI can access GitHub.com or GitHub Enterprise Server.
********************************************************************************************
**                                                                                        **
**                                            P A S S                                     **
**                                                                                        **
********************************************************************************************
** Log: /github/actions-runner/_diag/GitCheck_20260430-171324-utc.log
********************************************************************************************


********************************************************************************************
**  Check:               Node.js Certificate/Proxy Validation
**  Description:         Check if Node.js has access to GitHub.com or GitHub Enterprise Server.
********************************************************************************************
**                                                                                        **
**                                            P A S S                                     **
**                                                                                        **
********************************************************************************************
** Log: /github/actions-runner/_diag/NodeJsCheck_20260430-171324-utc.log
********************************************************************************************


% echo $?
0

👆 Don't blame me for the formatting of this output, this is how the code is written.

Runner and Worker's Diagnostic Logs

The underlying cause of my personal --check failure isn't important to this issue, so the _diag logs aren't helpful.

But for the sake of completeness and reproducibility-- in my case, the host ubuntu server that was running the actions runner binary did not have the command line ping utility installed, causing the Internet Connection and GitHub Actions Connection tests to fail as seen above.

This itself might be a false-positive failure, since the ability to ping a tcp/ip host probably isn't strictly required for the runner to operate correctly as long as DNS resolution is working and HTTPS requests are permitted. 🤷‍♂️

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions