actions / runner

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

Runner config not going through when using a proxy server #3313

Closed abhishek-at-apple closed 3 weeks ago

abhishek-at-apple commented 1 month ago

Describe the bug Trying to run the ./config.sh on a MacOS x64 VM - using a proxy server. I tried to do a curl manually with the proxy server to confirm that it is able to access the API URL. Despite that, the config.sh fails with below errors:

[2024-05-31 09:03:16Z ERR  ConfigurationManager] Failed to get tenant credentials -- Attempt: 1
[2024-05-31 09:03:16Z ERR  ConfigurationManager] System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: The response ended prematurely.
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at GitHub.Runner.Listener.Configuration.ConfigurationManager.GetTenantCredential(String githubUrl, String githubToken, String runnerEvent)

To Reproduce Steps to reproduce the behavior:

  1. Start a MacOS VM.
  2. Download and install Actions Runner package
  3. Run ./config.sh

Expected behavior With proxy configured correctly, the Github runner registration should go just fine.

Runner Version and Platform

MacOS x64 - Runner 2.316.1

OS of the machine running the runner? OSX/Windows/Linux/... OSX

What's not working?

Config

image

Job Log Output

[2024-05-31 09:03:00Z INFO Terminal] WRITE LINE:
[2024-05-31 09:03:00Z INFO Terminal] WRITE LINE: --------------------------------------------------------------------------------
[2024-05-31 09:03:00Z INFO Terminal] WRITE LINE: |        ____ _ _   _   _       _          _        _   _                      |
[2024-05-31 09:03:00Z INFO Terminal] WRITE LINE: |       / ___(_) |_| | | |_   _| |__      / \   ___| |_(_) ___  _ __  ___      |
[2024-05-31 09:03:00Z INFO Terminal] WRITE LINE: |      | |  _| | __| |_| | | | | '_ \    / _ \ / __| __| |/ _ \| '_ \/ __|     |
[2024-05-31 09:03:00Z INFO Terminal] WRITE LINE: |      | |_| | | |_|  _  | |_| | |_) |  / ___ \ (__| |_| | (_) | | | \__ \     |
[2024-05-31 09:03:00Z INFO Terminal] WRITE LINE: |       \____|_|\__|_| |_|\__,_|_.__/  /_/   \_\___|\__|_|\___/|_| |_|___/     |
[2024-05-31 09:03:00Z INFO Terminal] WRITE LINE: |                                                                              |
[2024-05-31 09:03:00Z INFO Terminal] WRITE: |
[2024-05-31 09:03:00Z INFO Terminal] WRITE: Self-hosted runner registration
[2024-05-31 09:03:00Z INFO Terminal] WRITE LINE:                         |
[2024-05-31 09:03:00Z INFO Terminal] WRITE LINE: |                                                                              |
[2024-05-31 09:03:00Z INFO Terminal] WRITE LINE: --------------------------------------------------------------------------------
[2024-05-31 09:03:00Z INFO ConfigurationManager] ConfigureAsync
[2024-05-31 09:03:00Z INFO CommandSettings] Flag 'generateServiceConfig': 'False'
[2024-05-31 09:03:00Z INFO ConfigurationStore] IsConfigured()
[2024-05-31 09:03:00Z INFO ConfigurationStore] IsConfigured: False
[2024-05-31 09:03:00Z INFO ConfigurationManager] Is configured: False
[2024-05-31 09:03:00Z INFO CommandSettings] Arg 'url': ''
[2024-05-31 09:03:00Z INFO CommandSettings] Flag 'unattended': 'False'
[2024-05-31 09:03:00Z INFO PromptManager] ReadValue
[2024-05-31 09:03:00Z INFO Terminal] WRITE: What is the URL of your repository?
[2024-05-31 09:03:00Z INFO Terminal] READ LINE
[2024-05-31 09:03:07Z INFO Terminal] Read value: 'https://github.com/apple-uat/gha-pilot'
[2024-05-31 09:03:07Z INFO CommandSettings] Arg 'token': ''
[2024-05-31 09:03:07Z INFO CommandSettings] Flag 'unattended': 'False'
[2024-05-31 09:03:07Z INFO PromptManager] ReadValue
[2024-05-31 09:03:07Z INFO Terminal] WRITE: What is your runner register token?
[2024-05-31 09:03:07Z INFO Terminal] READ SECRET
[2024-05-31 09:03:10Z INFO Terminal] Read value: '***'
[2024-05-31 09:03:16Z ERR  ConfigurationManager] Failed to get tenant credentials -- Attempt: 1
[2024-05-31 09:03:16Z ERR  ConfigurationManager] System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: The response ended prematurely.
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at GitHub.Runner.Listener.Configuration.ConfigurationManager.GetTenantCredential(String githubUrl, String githubToken, String runnerEvent)
[2024-05-31 09:03:16Z ERR  ConfigurationManager] #####################################################
[2024-05-31 09:03:16Z ERR  ConfigurationManager] System.IO.IOException: The response ended prematurely.
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
[2024-05-31 09:03:16Z INFO ConfigurationManager] Retrying in 2 seconds
[2024-05-31 09:03:25Z ERR  ConfigurationManager] Failed to get tenant credentials -- Attempt: 2
[2024-05-31 09:03:25Z ERR  ConfigurationManager] System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: The response ended prematurely.
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at GitHub.Runner.Listener.Configuration.ConfigurationManager.GetTenantCredential(String githubUrl, String githubToken, String runnerEvent)
[2024-05-31 09:03:25Z ERR  ConfigurationManager] #####################################################
[2024-05-31 09:03:25Z ERR  ConfigurationManager] System.IO.IOException: The response ended prematurely.
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
[2024-05-31 09:03:25Z INFO ConfigurationManager] Retrying in 1 seconds
[2024-05-31 09:03:33Z ERR  Runner] System.Net.Http.HttpRequestException: An error occurred while sending the request.
 ---> System.IO.IOException: The response ended prematurely.
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   --- End of inner exception stack trace ---
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpConnectionPool.SendWithVersionDetectionAndRetryAsync(HttpRequestMessage request, Boolean async, Boolean doRequestAuth, CancellationToken cancellationToken)
   at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
   at System.Net.Http.HttpClient.<SendAsync>g__Core|83_0(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationTokenSource cts, Boolean disposeCts, CancellationTokenSource pendingRequestsCts, CancellationToken originalCancellationToken)
   at GitHub.Runner.Listener.Configuration.ConfigurationManager.GetTenantCredential(String githubUrl, String githubToken, String runnerEvent)
   at GitHub.Runner.Listener.Configuration.ConfigurationManager.ConfigureAsync(CommandSettings command)
   at GitHub.Runner.Listener.Runner.ExecuteCommand(CommandSettings command)
[2024-05-31 09:03:33Z ERR  Runner] #####################################################
[2024-05-31 09:03:33Z ERR  Runner] System.IO.IOException: The response ended prematurely.
   at System.Net.Http.HttpConnection.SendAsyncCore(HttpRequestMessage request, Boolean async, CancellationToken cancellationToken)
[2024-05-31 09:03:33Z ERR  Terminal] WRITE ERROR: An error occurred while sending the request.
[2024-05-31 09:03:33Z INFO Listener] Runner execution has finished with return code 1
abhishek-at-apple commented 4 weeks ago

Followed the exact same steps for Linux X64 VM and things worked smooth. So the issue is apparently limited to MacOS VMs.

abhishek-at-apple commented 3 weeks ago

Turned out to be an OS specific issue. This script doesn't detect proxy correctly for older MacOS versions.