From ac89b31d2f0eb27e223f4e3c1480b6a144407e1d Mon Sep 17 00:00:00 2001 From: Tingluo Huang Date: Tue, 28 Nov 2023 13:39:39 -0500 Subject: [PATCH] Add codeload to the list of service we check during '--check'. (#3011) --- docs/checks/actions.md | 8 ++++++++ src/Runner.Listener/Checks/ActionsCheck.cs | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/docs/checks/actions.md b/docs/checks/actions.md index dd63fd88614..c232ab3b8f4 100644 --- a/docs/checks/actions.md +++ b/docs/checks/actions.md @@ -7,6 +7,7 @@ Make sure the runner has access to actions service for GitHub.com or GitHub Ente - For GitHub.com - The runner needs to access `https://api.github.com` for downloading actions. + - The runner needs to access `https://codeload.github.com` for downloading actions tar.gz/zip. - The runner needs to access `https://vstoken.actions.githubusercontent.com/_apis/.../` for requesting an access token. - The runner needs to access `https://pipelines.actions.githubusercontent.com/_apis/.../` for receiving workflow jobs. --- @@ -16,12 +17,14 @@ Make sure the runner has access to actions service for GitHub.com or GitHub Ente ``` curl -v https://api.github.com/zen + curl -v https://codeload.github.com/_ping curl -v https://vstoken.actions.githubusercontent.com/_apis/health curl -v https://pipelines.actions.githubusercontent.com/_apis/health ``` - For GitHub Enterprise Server - The runner needs to access `https://[hostname]/api/v3` for downloading actions. + - The runner needs to access `https://codeload.[hostname]/_ping` for downloading actions tar.gz/zip. - The runner needs to access `https://[hostname]/_services/vstoken/_apis/.../` for requesting an access token. - The runner needs to access `https://[hostname]/_services/pipelines/_apis/.../` for receiving workflow jobs. @@ -29,6 +32,7 @@ Make sure the runner has access to actions service for GitHub.com or GitHub Ente ``` curl -v https://[hostname]/api/v3/zen + curl -v https://codeload.[hostname]/_ping curl -v https://[hostname]/_services/vstoken/_apis/health curl -v https://[hostname]/_services/pipelines/_apis/health ``` @@ -44,6 +48,10 @@ Make sure the runner has access to actions service for GitHub.com or GitHub Ente - Ping api.github.com or myGHES.com using dotnet - Make HTTP GET to https://api.github.com or https://myGHES.com/api/v3 using dotnet, check response headers contains `X-GitHub-Request-Id` --- +- DNS lookup for codeload.github.com or codeload.myGHES.com using dotnet +- Ping codeload.github.com or codeload.myGHES.com using dotnet +- Make HTTP GET to https://codeload.github.com/_ping or https://codeload.myGHES.com/_ping using dotnet, check response headers contains `X-GitHub-Request-Id` +--- - DNS lookup for vstoken.actions.githubusercontent.com using dotnet - Ping vstoken.actions.githubusercontent.com using dotnet - Make HTTP GET to https://vstoken.actions.githubusercontent.com/_apis/health or https://myGHES.com/_services/vstoken/_apis/health using dotnet, check response headers contains `x-vss-e2eid` diff --git a/src/Runner.Listener/Checks/ActionsCheck.cs b/src/Runner.Listener/Checks/ActionsCheck.cs index ac85d2559ce..8ef00ee448c 100644 --- a/src/Runner.Listener/Checks/ActionsCheck.cs +++ b/src/Runner.Listener/Checks/ActionsCheck.cs @@ -58,11 +58,20 @@ public async Task RunCheck(string url, string pat) actionsPipelinesServiceUrl = urlBuilder.Uri.AbsoluteUri; } + var codeLoadUrlBuilder = new UriBuilder(url); + codeLoadUrlBuilder.Host = $"codeload.{codeLoadUrlBuilder.Host}"; + codeLoadUrlBuilder.Path = "_ping"; + // check github api checkTasks.Add(CheckUtil.CheckDns(githubApiUrl)); checkTasks.Add(CheckUtil.CheckPing(githubApiUrl)); checkTasks.Add(HostContext.CheckHttpsGetRequests(githubApiUrl, pat, expectedHeader: "X-GitHub-Request-Id")); + // check github codeload + checkTasks.Add(CheckUtil.CheckDns(codeLoadUrlBuilder.Uri.AbsoluteUri)); + checkTasks.Add(CheckUtil.CheckPing(codeLoadUrlBuilder.Uri.AbsoluteUri)); + checkTasks.Add(HostContext.CheckHttpsGetRequests(codeLoadUrlBuilder.Uri.AbsoluteUri, pat, expectedHeader: "X-GitHub-Request-Id")); + // check actions token service checkTasks.Add(CheckUtil.CheckDns(actionsTokenServiceUrl)); checkTasks.Add(CheckUtil.CheckPing(actionsTokenServiceUrl));