From 0e9e9f1e8d4cec75d45f0b7ee0083a5196cd0749 Mon Sep 17 00:00:00 2001 From: Luke Tomlinson Date: Thu, 31 Aug 2023 09:55:05 -0400 Subject: [PATCH 01/12] Support replacing runners in v2 flow (#2791) * Support replacing runners in v2 flow * Use correct endpoint for listing runners * fix test * really fix test * lint --- src/Runner.Common/RunnerDotcomServer.cs | 23 ++++++++++++++++--- .../Configuration/ConfigurationManager.cs | 20 ++++++++++++++-- .../DTWebApi/WebApi/ListRunnersResponse.cs | 2 +- .../Configuration/ConfigurationManagerL0.cs | 2 +- 4 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/Runner.Common/RunnerDotcomServer.cs b/src/Runner.Common/RunnerDotcomServer.cs index b73b252e1..c03e60bb7 100644 --- a/src/Runner.Common/RunnerDotcomServer.cs +++ b/src/Runner.Common/RunnerDotcomServer.cs @@ -15,9 +15,10 @@ namespace GitHub.Runner.Common [ServiceLocator(Default = typeof(RunnerDotcomServer))] public interface IRunnerDotcomServer : IRunnerService { - Task> GetRunnersAsync(int runnerGroupId, string githubUrl, string githubToken, string agentName); + Task> GetRunnerByNameAsync(string githubUrl, string githubToken, string agentName); Task AddRunnerAsync(int runnerGroupId, TaskAgent agent, string githubUrl, string githubToken, string publicKey); + Task ReplaceRunnerAsync(int runnerGroupId, TaskAgent agent, string githubUrl, string githubToken, string publicKey); Task> GetRunnerGroupsAsync(string githubUrl, string githubToken); } @@ -40,7 +41,7 @@ namespace GitHub.Runner.Common } - public async Task> GetRunnersAsync(int runnerGroupId, string githubUrl, string githubToken, string agentName) + public async Task> GetRunnerByNameAsync(string githubUrl, string githubToken, string agentName) { var githubApiUrl = ""; var gitHubUrlBuilder = new UriBuilder(githubUrl); @@ -129,6 +130,16 @@ namespace GitHub.Runner.Common } public async Task AddRunnerAsync(int runnerGroupId, TaskAgent agent, string githubUrl, string githubToken, string publicKey) + { + return await AddOrReplaceRunner(runnerGroupId, agent, githubUrl, githubToken, publicKey, false); + } + + public async Task ReplaceRunnerAsync(int runnerGroupId, TaskAgent agent, string githubUrl, string githubToken, string publicKey) + { + return await AddOrReplaceRunner(runnerGroupId, agent, githubUrl, githubToken, publicKey, true); + } + + private async Task AddOrReplaceRunner(int runnerGroupId, TaskAgent agent, string githubUrl, string githubToken, string publicKey, bool replace) { var gitHubUrlBuilder = new UriBuilder(githubUrl); var path = gitHubUrlBuilder.Path.Split('/', '\\', StringSplitOptions.RemoveEmptyEntries); @@ -151,9 +162,15 @@ namespace GitHub.Runner.Common {"updates_disabled", agent.DisableUpdate}, {"ephemeral", agent.Ephemeral}, {"labels", agent.Labels}, - {"public_key", publicKey} + {"public_key", publicKey}, }; + if (replace) + { + bodyObject.Add("runner_id", agent.Id); + bodyObject.Add("replace", replace); + } + var body = new StringContent(StringUtil.ConvertToJson(bodyObject), null, "application/json"); return await RetryRequest(githubApiUrl, githubToken, RequestType.Post, 3, "Failed to add agent", body); diff --git a/src/Runner.Listener/Configuration/ConfigurationManager.cs b/src/Runner.Listener/Configuration/ConfigurationManager.cs index 597b80078..b49244af4 100644 --- a/src/Runner.Listener/Configuration/ConfigurationManager.cs +++ b/src/Runner.Listener/Configuration/ConfigurationManager.cs @@ -244,7 +244,7 @@ namespace GitHub.Runner.Listener.Configuration List agents; if (runnerSettings.UseV2Flow) { - agents = await _dotcomServer.GetRunnersAsync(runnerSettings.PoolId, runnerSettings.GitHubUrl, registerToken, runnerSettings.AgentName); + agents = await _dotcomServer.GetRunnerByNameAsync(runnerSettings.GitHubUrl, registerToken, runnerSettings.AgentName); } else { @@ -263,7 +263,23 @@ namespace GitHub.Runner.Listener.Configuration try { - agent = await _runnerServer.ReplaceAgentAsync(runnerSettings.PoolId, agent); + if (runnerSettings.UseV2Flow) + { + var runner = await _dotcomServer.ReplaceRunnerAsync(runnerSettings.PoolId, agent, runnerSettings.GitHubUrl, registerToken, publicKeyXML); + runnerSettings.ServerUrlV2 = runner.RunnerAuthorization.ServerUrl; + + agent.Id = runner.Id; + agent.Authorization = new TaskAgentAuthorization() + { + AuthorizationUrl = runner.RunnerAuthorization.AuthorizationUrl, + ClientId = new Guid(runner.RunnerAuthorization.ClientId) + }; + } + else + { + agent = await _runnerServer.ReplaceAgentAsync(runnerSettings.PoolId, agent); + } + if (command.DisableUpdate && command.DisableUpdate != agent.DisableUpdate) { diff --git a/src/Sdk/DTWebApi/WebApi/ListRunnersResponse.cs b/src/Sdk/DTWebApi/WebApi/ListRunnersResponse.cs index 156c20fa9..755ff7104 100644 --- a/src/Sdk/DTWebApi/WebApi/ListRunnersResponse.cs +++ b/src/Sdk/DTWebApi/WebApi/ListRunnersResponse.cs @@ -41,7 +41,7 @@ namespace GitHub.DistributedTask.WebApi public List ToTaskAgents() { - return Runners.Select(runner => new TaskAgent() { Name = runner.Name }).ToList(); + return Runners.Select(runner => new TaskAgent() { Id = runner.Id, Name = runner.Name }).ToList(); } } diff --git a/src/Test/L0/Listener/Configuration/ConfigurationManagerL0.cs b/src/Test/L0/Listener/Configuration/ConfigurationManagerL0.cs index b4dfb397f..289a22d8a 100644 --- a/src/Test/L0/Listener/Configuration/ConfigurationManagerL0.cs +++ b/src/Test/L0/Listener/Configuration/ConfigurationManagerL0.cs @@ -115,7 +115,7 @@ namespace GitHub.Runner.Common.Tests.Listener.Configuration _runnerServer.Setup(x => x.AddAgentAsync(It.IsAny(), It.IsAny())).Returns(Task.FromResult(expectedAgent)); _runnerServer.Setup(x => x.ReplaceAgentAsync(It.IsAny(), It.IsAny())).Returns(Task.FromResult(expectedAgent)); - _dotcomServer.Setup(x => x.GetRunnersAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns(Task.FromResult(expectedAgents)); + _dotcomServer.Setup(x => x.GetRunnerByNameAsync(It.IsAny(), It.IsAny(), It.IsAny())).Returns(Task.FromResult(expectedAgents)); _dotcomServer.Setup(x => x.GetRunnerGroupsAsync(It.IsAny(), It.IsAny())).Returns(Task.FromResult(expectedPools)); _dotcomServer.Setup(x => x.AddRunnerAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())).Returns(Task.FromResult(expectedRunner)); From 2b66cbe69937b1ee29541c877b59ccea9fe7f304 Mon Sep 17 00:00:00 2001 From: Pavel Iakovenko Date: Thu, 31 Aug 2023 17:35:50 -0400 Subject: [PATCH 02/12] Delegating handler for Http redirects (#2814) * Delegating handler for Http redirects * Renamed varible name --- src/Runner.Common/RedirectMessageHandler.cs | 73 +++++++++++++++++++++ src/Runner.Worker/JobRunner.cs | 9 ++- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 src/Runner.Common/RedirectMessageHandler.cs diff --git a/src/Runner.Common/RedirectMessageHandler.cs b/src/Runner.Common/RedirectMessageHandler.cs new file mode 100644 index 000000000..81d216c01 --- /dev/null +++ b/src/Runner.Common/RedirectMessageHandler.cs @@ -0,0 +1,73 @@ +using System; +using System.ComponentModel; +using System.Net; +using System.Net.Http; +using System.Threading; +using System.Threading.Tasks; +using GitHub.Runner.Sdk; +using GitHub.Services.Common; + +namespace GitHub.Runner.Common +{ + /// + /// Handles redirects for Http requests + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public class RedirectMessageHandler : DelegatingHandler + { + public RedirectMessageHandler(ITraceWriter trace) + { + Trace = trace; + } + + protected override async Task SendAsync( + HttpRequestMessage request, + CancellationToken cancellationToken) + { + HttpResponseMessage response = await base.SendAsync(request, cancellationToken).ConfigureAwait(false); + + if (response != null && + IsRedirect(response.StatusCode) && + response.Headers.Location != null) + { + Trace.Info($"Redirecting to '{response.Headers.Location}'."); + + request = await CloneAsync(request, response.Headers.Location).ConfigureAwait(false); + + response.Dispose(); + + response = await base.SendAsync(request, cancellationToken).ConfigureAwait(false); + } + + return response; + } + + private static bool IsRedirect(HttpStatusCode statusCode) + { + return (int)statusCode >= 300 && (int)statusCode < 400; + } + + private static async Task CloneAsync(HttpRequestMessage request, Uri requestUri) + { + var clone = new HttpRequestMessage(request.Method, requestUri) + { + Version = request.Version + }; + + request.Headers.ForEach(header => clone.Headers.TryAddWithoutValidation(header.Key, header.Value)); + + request.Options.ForEach(option => clone.Options.Set(new HttpRequestOptionsKey(option.Key), option.Value)); + + if (request.Content != null) + { + clone.Content = new ByteArrayContent(await request.Content.ReadAsByteArrayAsync().ConfigureAwait(false)); + + request.Content.Headers.ForEach(header => clone.Content.Headers.TryAddWithoutValidation(header.Key, header.Value)); + } + + return clone; + } + + private readonly ITraceWriter Trace; + } +} diff --git a/src/Runner.Worker/JobRunner.cs b/src/Runner.Worker/JobRunner.cs index 5e50fd680..88ac3fc68 100644 --- a/src/Runner.Worker/JobRunner.cs +++ b/src/Runner.Worker/JobRunner.cs @@ -84,7 +84,14 @@ namespace GitHub.Runner.Worker Trace.Info($"Creating job server with URL: {jobServerUrl}"); // jobServerQueue is the throttling reporter. _jobServerQueue = HostContext.GetService(); - VssConnection jobConnection = VssUtil.CreateConnection(jobServerUrl, jobServerCredential, new DelegatingHandler[] { new ThrottlingReportHandler(_jobServerQueue) }); + var delegatingHandlers = new List() { new ThrottlingReportHandler(_jobServerQueue) }; + message.Variables.TryGetValue("Actions.EnableHttpRedirects", out VariableValue enableHttpRedirects); + if (StringUtil.ConvertToBoolean(enableHttpRedirects?.Value) && + !StringUtil.ConvertToBoolean(Environment.GetEnvironmentVariable("GITHUB_ACTIONS_RUNNER_NO_HTTP_REDIRECTS"))) + { + delegatingHandlers.Add(new RedirectMessageHandler(Trace)); + } + VssConnection jobConnection = VssUtil.CreateConnection(jobServerUrl, jobServerCredential, delegatingHandlers); await jobServer.ConnectAsync(jobConnection); _jobServerQueue.Start(message); From 15c0fe6c1d4bc016f8ad71094bdddfaa96ab4397 Mon Sep 17 00:00:00 2001 From: Pavel Iakovenko Date: Thu, 31 Aug 2023 22:06:15 -0400 Subject: [PATCH 03/12] Add references to the firewall requirements docs (#2815) --- docs/checks/actions.md | 2 ++ docs/checks/network.md | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/checks/actions.md b/docs/checks/actions.md index 6924d1f9e..49cebec2d 100644 --- a/docs/checks/actions.md +++ b/docs/checks/actions.md @@ -9,6 +9,8 @@ Make sure the runner has access to actions service for GitHub.com or GitHub Ente - The runner needs to access `https://api.github.com` for downloading actions. - 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. + --- + **NOTE:** for the full list of domains that are required to be in the firewall allow list refer to the [GitHub self-hosted runners requirements documentation](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#communication-between-self-hosted-runners-and-github). These can by tested by running the following `curl` commands from your self-hosted runner machine: diff --git a/docs/checks/network.md b/docs/checks/network.md index 5b47e913c..aaf92480f 100644 --- a/docs/checks/network.md +++ b/docs/checks/network.md @@ -14,7 +14,7 @@ - A Proxy may try to modify the HTTPS request (like add or change some http headers) and causes the request become incompatible with the Actions Service (ASP.NetCore), Ex: [Nginx](https://github.com/dotnet/aspnetcore/issues/17081) -- Firewall rules that block action runner from accessing certain hosts, ex: `*.github.com`, `*.actions.githubusercontent.com`, etc +- Firewall rules that block action runner from accessing [certain hosts](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/about-self-hosted-runners#communication-between-self-hosted-runners-and-github), ex: `*.github.com`, `*.actions.githubusercontent.com`, etc ### Identify and solve these problems From 474d0fb354cada16e055ca3d3c08d63ad107b142 Mon Sep 17 00:00:00 2001 From: Ryan van Zeben Date: Fri, 1 Sep 2023 16:24:25 -0400 Subject: [PATCH 04/12] Create automated workflow that will auto-generate dotnet sdk patches (#2776) * Add in workflow to automatically generate dotnet SDK patches * Update workflow to move the creation of the PR until all the hashes have been compiled and added to the path * Update upgrade to run not in parallel to prevent git command overlaps * Update for tings feedback and do better user error handling * JSON spec doesn't have comments * Has to use the outputs to proxy variables between the runs * Wrong output variable * Be more explicit on the branch check * Fix comments and json output * Missed variable name in rename * Fix race condition on jq write * Update for comments and more optimized hash updates * Need to forcibly exit for state to be detected * Fixed the failure to use a variable instead --- .devcontainer/devcontainer.json | 3 - .github/workflows/dotnet-upgrade.yml | 306 +++++++++++++++++++++++++++ 2 files changed, 306 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/dotnet-upgrade.yml diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index c31211d25..b8207ac55 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,4 +1,3 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: { "name": "Actions Runner Devcontainer", "image": "mcr.microsoft.com/devcontainers/base:focal", @@ -20,8 +19,6 @@ ] } }, - // dotnet restore to install dependencies so OmniSharp works out of the box - // src/Test restores all other projects it references, src/Runner.PluginHost is not one of them "postCreateCommand": "dotnet restore src/Test && dotnet restore src/Runner.PluginHost", "remoteUser": "vscode" } \ No newline at end of file diff --git a/.github/workflows/dotnet-upgrade.yml b/.github/workflows/dotnet-upgrade.yml new file mode 100644 index 000000000..955949a31 --- /dev/null +++ b/.github/workflows/dotnet-upgrade.yml @@ -0,0 +1,306 @@ +name: "DotNet SDK Upgrade" + +on: + schedule: + - cron: '0 0 * * 1' + workflow_dispatch: + +jobs: + dotnet-update: + runs-on: ubuntu-latest + outputs: + SHOULD_UPDATE: ${{ steps.fetch_latest_version.outputs.SHOULD_UPDATE }} + BRANCH_EXISTS: ${{ steps.fetch_latest_version.outputs.BRANCH_EXISTS }} + DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION: ${{ steps.fetch_latest_version.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} + DOTNET_CURRENT_MAJOR_MINOR_VERSION: ${{ steps.fetch_current_version.outputs.DOTNET_CURRENT_MAJOR_MINOR_VERSION }} + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Get current major minor version + id: fetch_current_version + shell: bash + run: | + current_major_minor_patch_version=$(jq .sdk.version ./src/global.json | xargs) + current_major_minor_version=$(cut -d '.' -f 1,2 <<< "$current_major_minor_patch_version") + + echo "DOTNET_CURRENT_MAJOR_MINOR_PATCH_VERSION=${current_major_minor_patch_version}" >> $GITHUB_OUTPUT + echo "DOTNET_CURRENT_MAJOR_MINOR_VERSION=${current_major_minor_version}" >> $GITHUB_OUTPUT + - name: Check patch version + id: fetch_latest_version + shell: bash + run: | + latest_patch_version=$(curl -sb -H "Accept: application/json" "https://dotnetcli.blob.core.windows.net/dotnet/Sdk/${{ steps.fetch_current_version.outputs.DOTNET_CURRENT_MAJOR_MINOR_VERSION }}/latest.version") + current_patch_version=${{ steps.fetch_current_version.outputs.DOTNET_CURRENT_MAJOR_MINOR_PATCH_VERSION }} + + should_update=0 + [ "$current_patch_version" != "$latest_patch_version" ] && should_update=1 + + # check if git branch already exists for the upgrade + branch_already_exists=0 + + if git ls-remote --heads --exit-code origin refs/heads/feature/dotnetsdk-upgrade/${latest_patch_version}; + then + branch_already_exists=1 + should_update=0 + fi + echo "DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION=${latest_patch_version}" >> $GITHUB_OUTPUT + echo "SHOULD_UPDATE=${should_update}" >> $GITHUB_OUTPUT + echo "BRANCH_EXISTS=${branch_already_exists}" >> $GITHUB_OUTPUT + - name: Create an error annotation if branch exists + if: ${{ steps.fetch_latest_version.outputs.BRANCH_EXISTS == 1 }} + run: echo "::error links::feature/dotnet-sdk-upgrade${{ steps.fetch_latest_version.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} https://github.com/actions/runner/tree/feature/dotnet-sdk-upgrade${{ steps.fetch_latest_version.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}::Branch feature/dotnetsdk-upgrade/${{ steps.fetch_latest_version.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} already exists. Please take a look and delete that branch if you wish to recreate" + - name: Create a warning annotation if no need to update + if: ${{ steps.fetch_latest_version.outputs.SHOULD_UPDATE == 0 && steps.fetch_latest_version.outputs.BRANCH_EXISTS == 0 }} + run: echo "::warning ::Latest DotNet SDK patch is ${{ steps.fetch_latest_version.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}, and we are on ${{ steps.fetch_latest_version.outputs.DOTNET_CURRENT_MAJOR_MINOR_PATCH_VERSION }}. No need to update" + - name: Update patch version + if: ${{ steps.fetch_latest_version.outputs.SHOULD_UPDATE == 1 && steps.fetch_latest_version.outputs.BRANCH_EXISTS == 0 }} + shell: bash + run: | + patch_version="${{ steps.fetch_latest_version.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}" + current_version="${{ steps.fetch_current_version.outputs.DOTNET_CURRENT_MAJOR_MINOR_PATCH_VERSION }}" + + # Update globals + echo Updating globals + globals_temp=$(mktemp) + jq --unbuffered --arg patch_version "$patch_version" '.sdk.version = $patch_version' ./src/global.json > "$globals_temp" && mv "$globals_temp" ./src/global.json + + # Update devcontainer + echo Updating devcontainer + devcontainer_temp=$(mktemp) + jq --unbuffered --arg patch_version "$patch_version" '.features."ghcr.io/devcontainers/features/dotnet".version = $patch_version' ./.devcontainer/devcontainer.json > "$devcontainer_temp" && mv "$devcontainer_temp" ./.devcontainer/devcontainer.json + + # Update dev.sh + echo Updating start script + sed -i "s/DOTNETSDK_VERSION=\"$current_version\"/DOTNETSDK_VERSION=\"$patch_version\"/g" ./src/dev.sh + - name: GIT commit and push all changed files + if: ${{ steps.fetch_latest_version.outputs.SHOULD_UPDATE == 1 && steps.fetch_latest_version.outputs.BRANCH_EXISTS == 0 }} + id: create_branch + run: | + branch_name="feature/dotnetsdk-upgrade/${{ steps.fetch_latest_version.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}" + git config --global user.name "github-actions[bot]" + git config --global user.email "<41898282+github-actions[bot]@users.noreply.github.com>" + + git checkout -b $branch_name + git commit -a -m "Upgrade dotnet sdk to v${{ steps.fetch_latest_version.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}" + git push --set-upstream origin $branch_name + + build-hashes: + if: ${{ needs.dotnet-update.outputs.SHOULD_UPDATE == 1 && needs.dotnet-update.outputs.BRANCH_EXISTS == 0 }} + needs: [dotnet-update] + outputs: + # pass outputs from this job to create-pr for use + DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION: ${{ needs.dotnet-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} + DOTNET_CURRENT_MAJOR_MINOR_VERSION: ${{ needs.dotnet-update.outputs.DOTNET_CURRENT_MAJOR_MINOR_VERSION }} + NEEDS_HASH_UPDATE: ${{ needs.compute-hash.outputs.NEED_UPDATE }} + strategy: + fail-fast: false + matrix: + runtime: [ linux-x64, linux-arm64, linux-arm, win-x64, win-arm64, osx-x64, osx-arm64 ] + include: + - runtime: linux-x64 + os: ubuntu-latest + devScript: ./dev.sh + + - runtime: linux-arm64 + os: ubuntu-latest + devScript: ./dev.sh + + - runtime: linux-arm + os: ubuntu-latest + devScript: ./dev.sh + + - runtime: osx-x64 + os: macOS-latest + devScript: ./dev.sh + + - runtime: osx-arm64 + os: macOS-latest + devScript: ./dev.sh + + - runtime: win-x64 + os: windows-2019 + devScript: ./dev + + - runtime: win-arm64 + os: windows-latest + devScript: ./dev + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + with: + ref: feature/dotnetsdk-upgrade/${{ needs.dotnet-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} + + # Build runner layout + - name: Build & Layout Release + run: | + ${{ matrix.devScript }} layout Release ${{ matrix.runtime }} + working-directory: src + + # Check runtime/externals hash + - name: Compute/Compare runtime and externals Hash + id: compute-hash + continue-on-error: true + shell: bash + run: | + echo "Current dotnet runtime hash result: $DOTNET_RUNTIME_HASH" + echo "Current Externals hash result: $EXTERNALS_HASH" + + NeedUpdate=0 + if [ "$EXTERNALS_HASH" != "$(cat ./src/Misc/contentHash/externals/${{ matrix.runtime }})" ] ;then + echo Hash mismatch, Update ./src/Misc/contentHash/externals/${{ matrix.runtime }} to $EXTERNALS_HASH + + echo "EXTERNAL_HASH=$EXTERNALS_HASH" >> $GITHUB_OUTPUT + NeedUpdate=1 + fi + + if [ "$DOTNET_RUNTIME_HASH" != "$(cat ./src/Misc/contentHash/dotnetRuntime/${{ matrix.runtime }})" ] ;then + echo Hash mismatch, Update ./src/Misc/contentHash/dotnetRuntime/${{ matrix.runtime }} to $DOTNET_RUNTIME_HASH + + echo "DOTNET_RUNTIME_HASH=$DOTNET_RUNTIME_HASH" >> $GITHUB_OUTPUT + NeedUpdate=1 + fi + + echo "NEED_UPDATE=$NeedUpdate" >> $GITHUB_OUTPUT + env: + DOTNET_RUNTIME_HASH: ${{hashFiles('**/_layout_trims/runtime/**/*')}} + EXTERNALS_HASH: ${{hashFiles('**/_layout_trims/externals/**/*')}} + - name: update hash + if: ${{ steps.compute-hash.outputs.NEED_UPDATE == 1 }} + shell: bash + run: | + ExternalHash=${{ steps.compute-hash.outputs.EXTERNAL_HASH }} + DotNetRuntimeHash=${{ steps.compute-hash.outputs.DOTNET_RUNTIME_HASH }} + + if [ -n "$ExternalHash" ]; then + echo "$ExternalHash" > ./src/Misc/contentHash/externals/${{ matrix.runtime }} + fi + + if [ -n "$DotNetRuntimeHash" ]; then + echo "$DotNetRuntimeHash" > ./src/Misc/contentHash/dotnetRuntime/${{ matrix.runtime }} + fi + - name: cache updated hashes + if: ${{ steps.compute-hash.outputs.NEED_UPDATE == 1 }} + uses: actions/cache/save@v3 + with: + enableCrossOsArchive: true + path: | + ./src/Misc/contentHash/externals/${{ matrix.runtime }} + ./src/Misc/contentHash/dotnetRuntime/${{ matrix.runtime }} + key: compute-hashes-${{ matrix.runtime }}-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} + + + hash-update: + needs: [build-hashes] + if: ${{ needs.build-hashes.outputs.NEEDS_HASH_UPDATE == 1 }} + outputs: + # pass outputs from this job to create-pr for use + DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION: ${{ needs.build-hashes.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} + DOTNET_CURRENT_MAJOR_MINOR_VERSION: ${{ needs.build-hashes.outputs.DOTNET_CURRENT_MAJOR_MINOR_VERSION }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: feature/dotnetsdk-upgrade/${{ needs.build-hashes.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} + - name: Restore cached hashes - linux-x64 + id: cache-restore-linux-x64 + uses: actions/cache/restore@v3 + with: + enableCrossOsArchive: true + path: | + ./src/Misc/contentHash/externals/linux-x64 + ./src/Misc/contentHash/dotnetRuntime/linux-x64 + key: compute-hashes-linux-x64-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} + - name: Restore cached hashes - linux-arm64 + id: cache-restore-linux-arm64 + uses: actions/cache/restore@v3 + with: + enableCrossOsArchive: true + path: | + ./src/Misc/contentHash/externals/linux-arm64 + ./src/Misc/contentHash/dotnetRuntime/linux-arm64 + key: compute-hashes-linux-arm64-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} + - name: Restore cached hashes - linux-arm + id: cache-restore-linux-arm + uses: actions/cache/restore@v3 + with: + enableCrossOsArchive: true + path: | + ./src/Misc/contentHash/externals/linux-arm + ./src/Misc/contentHash/dotnetRuntime/linux-arm + key: compute-hashes-linux-arm-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} + - name: Restore cached hashes - osx-x64 + id: cache-restore-osx-x64 + uses: actions/cache/restore@v3 + with: + enableCrossOsArchive: true + path: | + ./src/Misc/contentHash/externals/osx-x64 + ./src/Misc/contentHash/dotnetRuntime/osx-x64 + key: compute-hashes-osx-x64-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} + - name: Restore cached hashes - osx-arm64 + id: cache-restore-osx-arm64 + uses: actions/cache/restore@v3 + with: + enableCrossOsArchive: true + path: | + ./src/Misc/contentHash/externals/osx-arm64 + ./src/Misc/contentHash/dotnetRuntime/osx-arm64 + key: compute-hashes-osx-arm64-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} + - name: Restore cached hashes - win-x64 + id: cache-restore-win-x64 + uses: actions/cache/restore@v3 + with: + enableCrossOsArchive: true + path: | + ./src/Misc/contentHash/externals/win-x64 + ./src/Misc/contentHash/dotnetRuntime/win-x64 + key: compute-hashes-win-x64-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} + - name: Restore cached hashes - win-arm64 + id: cache-restore-win-arm64 + uses: actions/cache/restore@v3 + with: + enableCrossOsArchive: true + path: | + ./src/Misc/contentHash/externals/win-arm64 + ./src/Misc/contentHash/dotnetRuntime/win-arm64 + key: compute-hashes-win-arm64-${{ github.run_id }}-${{ github.run_number }}-${{ github.run_attempt }} + - name: Fetch cached computed hashes + if: steps.cache-restore-linux-x64.outputs.cache-hit == 'true' || + steps.cache-restore-linux-arm64.outputs.cache-hit == 'true' || + steps.cache-restore-linux-arm.outputs.cache-hit == 'true' || + steps.cache-restore-win-x64.outputs.cache-hit == 'true' || + steps.cache-restore-win-arm64.outputs.cache-hit == 'true' || + steps.cache-restore-osx-x64.outputs.cache-hit == 'true' || + steps.cache-restore-osx-arm64.outputs.cache-hit == 'true' + shell: bash + run: | + Environments=( "linux-x64" "linux-arm64" "linux-arm" "win-x64" "win-arm64" "osx-x64" "osx-arm64" ) + + git config --global user.name "github-actions[bot]" + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git commit -a -m "Update computed hashes" + git push --set-upstream origin feature/dotnetsdk-upgrade/${{ needs.build-hashes.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} + + create-pr: + needs: [hash-update] + outputs: + # pass outputs from this job to run-tests for use + DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION: ${{ needs.hash-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} + DOTNET_CURRENT_MAJOR_MINOR_VERSION: ${{ needs.hash-update.outputs.DOTNET_CURRENT_MAJOR_MINOR_VERSION }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: feature/dotnetsdk-upgrade/${{ needs.hash-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} + - name: Create Pull Request + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr create -B main -H feature/dotnetsdk-upgrade/${{ needs.hash-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} --title "Update dotnet sdk to latest version @${{ needs.build-hashes.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}" --body " + https://dotnetcli.blob.core.windows.net/dotnet/Sdk/${{ needs.hash-update.outputs.DOTNET_CURRENT_MAJOR_MINOR_VERSION }}/latest.version + + + --- + + Autogenerated by [DotNet SDK Upgrade Workflow](https://github.com/actions/runner/blob/main/.github/workflows/dotnet-upgrade.yml)" From 143639ddacc089464ea97d9dba44c3068f156d3f Mon Sep 17 00:00:00 2001 From: Ryan van Zeben Date: Fri, 1 Sep 2023 16:55:51 -0400 Subject: [PATCH 05/12] Fixes minor issues with using proper output varaibles (#2818) * Update to proper output variable * Update title to use proper needs version --- .github/workflows/dotnet-upgrade.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/dotnet-upgrade.yml b/.github/workflows/dotnet-upgrade.yml index 955949a31..e3d23d254 100644 --- a/.github/workflows/dotnet-upgrade.yml +++ b/.github/workflows/dotnet-upgrade.yml @@ -91,7 +91,7 @@ jobs: # pass outputs from this job to create-pr for use DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION: ${{ needs.dotnet-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} DOTNET_CURRENT_MAJOR_MINOR_VERSION: ${{ needs.dotnet-update.outputs.DOTNET_CURRENT_MAJOR_MINOR_VERSION }} - NEEDS_HASH_UPDATE: ${{ needs.compute-hash.outputs.NEED_UPDATE }} + NEEDS_HASH_UPDATE: ${{ steps.compute-hash.outputs.NEED_UPDATE }} strategy: fail-fast: false matrix: @@ -297,7 +297,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - gh pr create -B main -H feature/dotnetsdk-upgrade/${{ needs.hash-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} --title "Update dotnet sdk to latest version @${{ needs.build-hashes.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}" --body " + gh pr create -B main -H feature/dotnetsdk-upgrade/${{ needs.hash-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }} --title "Update dotnet sdk to latest version @${{ needs.hash-update.outputs.DOTNET_LATEST_MAJOR_MINOR_PATCH_VERSION }}" --body " https://dotnetcli.blob.core.windows.net/dotnet/Sdk/${{ needs.hash-update.outputs.DOTNET_CURRENT_MAJOR_MINOR_VERSION }}/latest.version From d2f0a46865e229041d134c109961e8c0c6ba1c7a Mon Sep 17 00:00:00 2001 From: Tingluo Huang Date: Tue, 5 Sep 2023 17:21:54 -0400 Subject: [PATCH 06/12] Throw NonRetryableException on GetNextMessage from broker as needed. (#2828) --- src/Runner.Listener/BrokerMessageListener.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Runner.Listener/BrokerMessageListener.cs b/src/Runner.Listener/BrokerMessageListener.cs index 960dfa8e3..f770fd8ac 100644 --- a/src/Runner.Listener/BrokerMessageListener.cs +++ b/src/Runner.Listener/BrokerMessageListener.cs @@ -108,7 +108,7 @@ namespace GitHub.Runner.Listener if (!IsGetNextMessageExceptionRetriable(ex)) { - throw; + throw new NonRetryableException("Get next message failed with non-retryable error.", ex); } else { From 7b703d667dc18413c74a76189890781e0244ff50 Mon Sep 17 00:00:00 2001 From: Cory Miller <13227161+cory-miller@users.noreply.github.com> Date: Wed, 6 Sep 2023 09:32:57 -0400 Subject: [PATCH 07/12] Mark action download failures as infra failures (#2827) * Mark action download failures as infra failures * Fix Windows variable name * Update src/Runner.Worker/ActionManager.cs Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com> --------- Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com> --- src/Runner.Worker/ActionManager.cs | 19 ++++++++- src/Sdk/DTWebApi/WebApi/Exceptions.cs | 19 +++++++++ src/Test/L0/Worker/ActionManagerL0.cs | 57 +++++++++++++++++++++++++++ 3 files changed, 93 insertions(+), 2 deletions(-) diff --git a/src/Runner.Worker/ActionManager.cs b/src/Runner.Worker/ActionManager.cs index 69c4a338d..5236b3f61 100644 --- a/src/Runner.Worker/ActionManager.cs +++ b/src/Runner.Worker/ActionManager.cs @@ -115,6 +115,14 @@ namespace GitHub.Runner.Worker executionContext.Result = TaskResult.Failed; throw; } + catch (InvalidActionArchiveException ex) + { + // Log the error and fail the PrepareActionsAsync Initialization. + Trace.Error($"Caught exception from PrepareActionsAsync Initialization: {ex}"); + executionContext.InfrastructureError(ex.Message); + executionContext.Result = TaskResult.Failed; + throw; + } if (!FeatureManager.IsContainerHooksEnabled(executionContext.Global.Variables)) { if (state.ImagesToPull.Count > 0) @@ -907,7 +915,14 @@ namespace GitHub.Runner.Worker Directory.CreateDirectory(stagingDirectory); #if OS_WINDOWS - ZipFile.ExtractToDirectory(archiveFile, stagingDirectory); + try + { + ZipFile.ExtractToDirectory(archiveFile, stagingDirectory); + } + catch (InvalidDataException e) + { + throw new InvalidActionArchiveException($"Can't un-zip archive file: {archiveFile}. action being checked out: {downloadInfo.NameWithOwner}@{downloadInfo.Ref}. error: {e}."); + } #else string tar = WhichUtil.Which("tar", require: true, trace: Trace); @@ -933,7 +948,7 @@ namespace GitHub.Runner.Worker int exitCode = await processInvoker.ExecuteAsync(stagingDirectory, tar, $"-xzf \"{archiveFile}\"", null, executionContext.CancellationToken); if (exitCode != 0) { - throw new NotSupportedException($"Can't use 'tar -xzf' extract archive file: {archiveFile}. return code: {exitCode}."); + throw new InvalidActionArchiveException($"Can't use 'tar -xzf' extract archive file: {archiveFile}. Action being checked out: {downloadInfo.NameWithOwner}@{downloadInfo.Ref}. return code: {exitCode}."); } } #endif diff --git a/src/Sdk/DTWebApi/WebApi/Exceptions.cs b/src/Sdk/DTWebApi/WebApi/Exceptions.cs index 29bf26240..97505bb6a 100644 --- a/src/Sdk/DTWebApi/WebApi/Exceptions.cs +++ b/src/Sdk/DTWebApi/WebApi/Exceptions.cs @@ -2516,4 +2516,23 @@ namespace GitHub.DistributedTask.WebApi { } } + + [Serializable] + public sealed class InvalidActionArchiveException : DistributedTaskException + { + public InvalidActionArchiveException(String message) + : base(message) + { + } + + public InvalidActionArchiveException(String message, Exception innerException) + : base(message, innerException) + { + } + + private InvalidActionArchiveException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } + } } diff --git a/src/Test/L0/Worker/ActionManagerL0.cs b/src/Test/L0/Worker/ActionManagerL0.cs index a3c45351d..dda20bdd8 100644 --- a/src/Test/L0/Worker/ActionManagerL0.cs +++ b/src/Test/L0/Worker/ActionManagerL0.cs @@ -96,6 +96,63 @@ namespace GitHub.Runner.Common.Tests.Worker } } + [Fact] + [Trait("Level", "L0")] + [Trait("Category", "Worker")] + public async void PrepareActions_DownloadActionFromDotCom_ZipFileError() + { + try + { + // Arrange + Setup(); + const string ActionName = "ownerName/sample-action"; + var actions = new List + { + new Pipelines.ActionStep() + { + Name = "action", + Id = Guid.NewGuid(), + Reference = new Pipelines.RepositoryPathReference() + { + Name = ActionName, + Ref = "main", + RepositoryType = "GitHub" + } + } + }; + + // Create a corrupted ZIP file for testing + var tempDir = _hc.GetDirectory(WellKnownDirectory.Temp); + Directory.CreateDirectory(tempDir); + var archiveFile = Path.Combine(tempDir, Path.GetRandomFileName()); + using (var fileStream = new FileStream(archiveFile, FileMode.Create)) + { + // Used Co-Pilot for magic bytes here. They represent the tar header and just need to be invalid for the CLI to break. + var buffer = new byte[] { 0x50, 0x4B, 0x03, 0x04, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00 }; + fileStream.Write(buffer, 0, buffer.Length); + } + using var stream = File.OpenRead(archiveFile); + + string dotcomArchiveLink = GetLinkToActionArchive("https://api.github.com", ActionName, "main"); + var mockClientHandler = new Mock(); + mockClientHandler.Protected().Setup>("SendAsync", ItExpr.Is(m => m.RequestUri == new Uri(dotcomArchiveLink)), ItExpr.IsAny()) + .ReturnsAsync(new HttpResponseMessage(HttpStatusCode.OK) { Content = new StreamContent(stream) }); + + var mockHandlerFactory = new Mock(); + mockHandlerFactory.Setup(p => p.CreateClientHandler(It.IsAny())).Returns(mockClientHandler.Object); + _hc.SetSingleton(mockHandlerFactory.Object); + + _configurationStore.Object.GetSettings().IsHostedServer = true; + + // Act + Assert + await Assert.ThrowsAsync(async () => await _actionManager.PrepareActionsAsync(_ec.Object, actions)); + } + finally + { + Teardown(); + } + } + [Fact] [Trait("Level", "L0")] [Trait("Category", "Worker")] From 3f5b81349912fa4fd3480171aa90eba300587131 Mon Sep 17 00:00:00 2001 From: John Sudol <24583161+johnsudol@users.noreply.github.com> Date: Thu, 7 Sep 2023 10:48:53 -0400 Subject: [PATCH 08/12] Prepare runner release 2.309.0 (#2833) --- releaseNote.md | 48 ++++++++++++++++++++++++++++++++--------------- src/runnerversion | 2 +- 2 files changed, 34 insertions(+), 16 deletions(-) diff --git a/releaseNote.md b/releaseNote.md index 875775e5c..bf2363006 100644 --- a/releaseNote.md +++ b/releaseNote.md @@ -1,19 +1,37 @@ -## Features -- Support linux/arm64 docker build (#2601) -- Add node20 to runner (#2732) -- Update node16 to latest version (#2736) -- Remove node12 from runner (#2717) +## What's Changed +* Bump @types/node from 12.12.14 to 20.4.10 in /src/Misc/expressionFunc/hashFiles by @dependabot in https://github.com/actions/runner/pull/2759 +* Trace x-github-request-id when download action tarball. by @TingluoHuang in https://github.com/actions/runner/pull/2755 +* Fix typo by @kyanny in https://github.com/actions/runner/pull/2741 +* Bump prettier from 3.0.1 to 3.0.2 in /src/Misc/expressionFunc/hashFiles by @dependabot in https://github.com/actions/runner/pull/2772 +* Bump @types/node from 20.4.10 to 20.5.0 in /src/Misc/expressionFunc/hashFiles by @dependabot in https://github.com/actions/runner/pull/2773 +* Revert "Fixed a bug where a misplaced `=` character could bypass here… by @cory-miller in https://github.com/actions/runner/pull/2774 +* Filter NODE_OPTIONS from env for file output by @cory-miller in https://github.com/actions/runner/pull/2775 +* Bump @types/node from 20.5.0 to 20.5.1 in /src/Misc/expressionFunc/hashFiles by @dependabot in https://github.com/actions/runner/pull/2781 +* Update Docker Version in Images by @ajschmidt8 in https://github.com/actions/runner/pull/2694 +* Bump @types/node from 20.5.1 to 20.5.4 in /src/Misc/expressionFunc/hashFiles by @dependabot in https://github.com/actions/runner/pull/2789 +* Bump @typescript-eslint/parser from 6.4.0 to 6.4.1 in /src/Misc/expressionFunc/hashFiles by @dependabot in https://github.com/actions/runner/pull/2785 +* Bump Microsoft.AspNet.WebApi.Client from 5.2.4 to 5.2.9 in /src by @dependabot in https://github.com/actions/runner/pull/2751 +* Bump System.Buffers from 4.3.0 to 4.5.1 in /src by @dependabot in https://github.com/actions/runner/pull/2749 +* Bump dotnet/runtime-deps from 6.0-jammy to 7.0-jammy in /images by @dependabot in https://github.com/actions/runner/pull/2745 +* Remove need to manually compile JS binary for hashFiles utility by @vanZeben in https://github.com/actions/runner/pull/2770 +* Revert "Bump dotnet/runtime-deps from 6.0-jammy to 7.0-jammy in /images" by @TingluoHuang in https://github.com/actions/runner/pull/2790 +* Query runner by name on server side. by @TingluoHuang in https://github.com/actions/runner/pull/2771 +* Bump typescript from 5.1.6 to 5.2.2 in /src/Misc/expressionFunc/hashFiles by @dependabot in https://github.com/actions/runner/pull/2795 +* Bump @types/node from 20.5.4 to 20.5.6 in /src/Misc/expressionFunc/hashFiles by @dependabot in https://github.com/actions/runner/pull/2796 +* Bump Newtonsoft.Json from 13.0.1 to 13.0.3 in /src by @dependabot in https://github.com/actions/runner/pull/2797 +* Support replacing runners in v2 flow by @luketomlinson in https://github.com/actions/runner/pull/2791 +* Delegating handler for Http redirects by @paveliak in https://github.com/actions/runner/pull/2814 +* Add references to the firewall requirements docs by @paveliak in https://github.com/actions/runner/pull/2815 +* Create automated workflow that will auto-generate dotnet sdk patches by @vanZeben in https://github.com/actions/runner/pull/2776 +* Fixes minor issues with using proper output varaibles by @vanZeben in https://github.com/actions/runner/pull/2818 +* Throw NonRetryableException on GetNextMessage from broker as needed. by @TingluoHuang in https://github.com/actions/runner/pull/2828 +* Mark action download failures as infra failures by @cory-miller in https://github.com/actions/runner/pull/2827 -## Misc -- Pass timeout in ExecutionContext instead of StepsRunner (#2714) -- Return early on invalid_client OAuth exception (#2721) -- Expose results service endpoint as environment variable (#2726) -- Update HTTPEventSourceListener to trace the right events (#2727) -- Change RunnerId/AgentId from int32 to uint64 (#2661) -- Configure stale bot for Runner (#2729) -- Add in dependabot security scanning/updates (#2743) -- Bump dotnet sdk to latest version (#2733) -- Switch from InnerException to ErrorCode on disableupdate check (#2718) +## New Contributors +* @kyanny made their first contribution in https://github.com/actions/runner/pull/2741 +* @ajschmidt8 made their first contribution in https://github.com/actions/runner/pull/2694 + +**Full Changelog**: https://github.com/actions/runner/compare/v2.308.0...v2.309.0 _Note: Actions Runner follows a progressive release policy, so the latest release might not be available to your enterprise, organization, or repository yet. To confirm which version of the Actions Runner you should expect, please view the download instructions for your enterprise, organization, or repository. diff --git a/src/runnerversion b/src/runnerversion index 20ab9090b..55a82243c 100644 --- a/src/runnerversion +++ b/src/runnerversion @@ -1 +1 @@ -2.308.0 +2.309.0 From 2908d82845c018193655e68f3c20a5ad03bc0efd Mon Sep 17 00:00:00 2001 From: Stefan Ruvceski <96768603+ruvceskistefan@users.noreply.github.com> Date: Mon, 11 Sep 2023 15:19:05 +0200 Subject: [PATCH 09/12] remove debug-only flag from stale bot action (#2834) Co-authored-by: Ben Wells --- .github/workflows/stale-bot.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/stale-bot.yml b/.github/workflows/stale-bot.yml index 13fc526c4..bec1321bb 100644 --- a/.github/workflows/stale-bot.yml +++ b/.github/workflows/stale-bot.yml @@ -1,4 +1,4 @@ -name: ‘Close stale Runner issues’ +name: Stale Bot on: workflow_dispatch: schedule: @@ -9,9 +9,8 @@ jobs: steps: - uses: actions/stale@v8 with: - stale-issue-message: ‘This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 15 days.’ - close-issue-message: ‘This issue was closed because it has been stalled for 15 days with no activity.’ - exempt-issue-labels: ‘keep’ + stale-issue-message: "This issue is stale because it has been open 365 days with no activity. Remove stale label or comment or this will be closed in 15 days." + close-issue-message: "This issue was closed because it has been stalled for 15 days with no activity." + exempt-issue-labels: "keep" days-before-stale: 365 - days-before-close: 15 - debug-only: true + days-before-close: 15 \ No newline at end of file From 16834edc670a195bbd0aab375201360c47737f8c Mon Sep 17 00:00:00 2001 From: Nikola Jokic Date: Mon, 18 Sep 2023 11:56:47 +0200 Subject: [PATCH 10/12] Calculate docker instance label based on the hash of the config (#2683) --- src/Runner.Worker/Container/DockerCommandManager.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Runner.Worker/Container/DockerCommandManager.cs b/src/Runner.Worker/Container/DockerCommandManager.cs index 64f42f3bb..41b914a5e 100644 --- a/src/Runner.Worker/Container/DockerCommandManager.cs +++ b/src/Runner.Worker/Container/DockerCommandManager.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Channels; @@ -46,7 +47,9 @@ namespace GitHub.Runner.Worker.Container { base.Initialize(hostContext); DockerPath = WhichUtil.Which("docker", true, Trace); - DockerInstanceLabel = IOUtil.GetSha256Hash(hostContext.GetDirectory(WellKnownDirectory.Root)).Substring(0, 6); + string path = Path.Combine(HostContext.GetDirectory(WellKnownDirectory.Root), ".runner"); + string json = File.ReadAllText(path, Encoding.UTF8); + DockerInstanceLabel = IOUtil.GetSha256Hash(json).Substring(0, 6); } public async Task DockerVersion(IExecutionContext context) From 80a17a2f0c1f53e273212cce1728565698d52d11 Mon Sep 17 00:00:00 2001 From: Pantelis <85220850+Pantelis-Santorinios@users.noreply.github.com> Date: Mon, 18 Sep 2023 15:18:41 +0200 Subject: [PATCH 11/12] Correcting `zen` address (#2855) `https://api.github.com/api/v3/zen` should be `https://api.github.com/zen` for `github.com` --- docs/checks/actions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/checks/actions.md b/docs/checks/actions.md index 49cebec2d..dd63fd886 100644 --- a/docs/checks/actions.md +++ b/docs/checks/actions.md @@ -15,7 +15,7 @@ Make sure the runner has access to actions service for GitHub.com or GitHub Ente These can by tested by running the following `curl` commands from your self-hosted runner machine: ``` - curl -v https://api.github.com/api/v3/zen + curl -v https://api.github.com/zen curl -v https://vstoken.actions.githubusercontent.com/_apis/health curl -v https://pipelines.actions.githubusercontent.com/_apis/health ``` From 3a8cb43022314dc914afc5c0b23181d0e80817ec Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon, 18 Sep 2023 16:11:36 -0400 Subject: [PATCH 12/12] Update dotnet sdk to latest version @6.0.414 (#2852) * Upgrade dotnet sdk to v6.0.414 * Update computed hashes * Add new dotnet asset --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Ryan van Zeben --- .devcontainer/devcontainer.json | 46 +++++++++---------- src/Misc/contentHash/dotnetRuntime/linux-arm | 2 +- .../contentHash/dotnetRuntime/linux-arm64 | 2 +- src/Misc/contentHash/dotnetRuntime/linux-x64 | 2 +- src/Misc/contentHash/dotnetRuntime/osx-arm64 | 2 +- src/Misc/contentHash/dotnetRuntime/osx-x64 | 2 +- src/Misc/contentHash/dotnetRuntime/win-arm64 | 2 +- src/Misc/contentHash/dotnetRuntime/win-x64 | 2 +- src/Misc/runnerdotnetruntimeassets | 1 + src/dev.sh | 2 +- src/global.json | 4 +- 11 files changed, 34 insertions(+), 33 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index b8207ac55..151f0a9e0 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,24 +1,24 @@ { - "name": "Actions Runner Devcontainer", - "image": "mcr.microsoft.com/devcontainers/base:focal", - "features": { - "ghcr.io/devcontainers/features/docker-in-docker:1": {}, - "ghcr.io/devcontainers/features/dotnet": { - "version": "6.0.412" - }, - "ghcr.io/devcontainers/features/node:1": { - "version": "16" - } - }, - "customizations": { - "vscode": { - "extensions": [ - "ms-azuretools.vscode-docker", - "ms-dotnettools.csharp", - "eamodio.gitlens" - ] - } - }, - "postCreateCommand": "dotnet restore src/Test && dotnet restore src/Runner.PluginHost", - "remoteUser": "vscode" -} \ No newline at end of file + "name": "Actions Runner Devcontainer", + "image": "mcr.microsoft.com/devcontainers/base:focal", + "features": { + "ghcr.io/devcontainers/features/docker-in-docker:1": {}, + "ghcr.io/devcontainers/features/dotnet": { + "version": "6.0.414" + }, + "ghcr.io/devcontainers/features/node:1": { + "version": "16" + } + }, + "customizations": { + "vscode": { + "extensions": [ + "ms-azuretools.vscode-docker", + "ms-dotnettools.csharp", + "eamodio.gitlens" + ] + } + }, + "postCreateCommand": "dotnet restore src/Test && dotnet restore src/Runner.PluginHost", + "remoteUser": "vscode" +} diff --git a/src/Misc/contentHash/dotnetRuntime/linux-arm b/src/Misc/contentHash/dotnetRuntime/linux-arm index 467165a2e..9a6e4a641 100644 --- a/src/Misc/contentHash/dotnetRuntime/linux-arm +++ b/src/Misc/contentHash/dotnetRuntime/linux-arm @@ -1 +1 @@ -7b78ca2997fbe048642d3717ab7321cdd359752b97158f3c67eb3df8786e21d3 \ No newline at end of file +7539d33c35b0bc94ee67e3c0de1a6bac5ef89ce8e8efaa110131fa0520a54fb4 diff --git a/src/Misc/contentHash/dotnetRuntime/linux-arm64 b/src/Misc/contentHash/dotnetRuntime/linux-arm64 index 462079eb8..990265baf 100644 --- a/src/Misc/contentHash/dotnetRuntime/linux-arm64 +++ b/src/Misc/contentHash/dotnetRuntime/linux-arm64 @@ -1 +1 @@ -6f34c1d501c87c2e22c2278df7152999aca628c66ee4176d32325773487da6d7 \ No newline at end of file +d71a31f9a17e1a41d6e1edea596edfa68a0db5948ed160e86f2154a547f4dd10 diff --git a/src/Misc/contentHash/dotnetRuntime/linux-x64 b/src/Misc/contentHash/dotnetRuntime/linux-x64 index 074f8215d..f9b75a567 100644 --- a/src/Misc/contentHash/dotnetRuntime/linux-x64 +++ b/src/Misc/contentHash/dotnetRuntime/linux-x64 @@ -1 +1 @@ -921ca58050be56e0b84af05e544cab4a151cb66405e815e19c0e0928ef7313f5 \ No newline at end of file +3c2f700d8a995efe7895614ee07d9c7880f872d214b45983ad6163e1931870ab diff --git a/src/Misc/contentHash/dotnetRuntime/osx-arm64 b/src/Misc/contentHash/dotnetRuntime/osx-arm64 index f90128d63..2778fe18d 100644 --- a/src/Misc/contentHash/dotnetRuntime/osx-arm64 +++ b/src/Misc/contentHash/dotnetRuntime/osx-arm64 @@ -1 +1 @@ -50f5c147074fc4943b4198b2d9b57c5e94344ab21350b0880ec8e2b85d27152b \ No newline at end of file +b2d85c95ecad13d352f4c7d31c64dbb0d9c6381b48fa5874c4c72a43a025a8a1 diff --git a/src/Misc/contentHash/dotnetRuntime/osx-x64 b/src/Misc/contentHash/dotnetRuntime/osx-x64 index 24c54202d..ae844f7a2 100644 --- a/src/Misc/contentHash/dotnetRuntime/osx-x64 +++ b/src/Misc/contentHash/dotnetRuntime/osx-x64 @@ -1 +1 @@ -16269548335b1f2add41a409aa3558c56581b63f280a9a26956707b6370558bd \ No newline at end of file +417d835c1a108619886b4bb5d25988cb6c138eb7b4c00320b1d9455c5630bff9 diff --git a/src/Misc/contentHash/dotnetRuntime/win-arm64 b/src/Misc/contentHash/dotnetRuntime/win-arm64 index a24ec6fe3..f7eba158d 100644 --- a/src/Misc/contentHash/dotnetRuntime/win-arm64 +++ b/src/Misc/contentHash/dotnetRuntime/win-arm64 @@ -1 +1 @@ -e4aa6003ec77a2b21f3021927fed48727bde379fafff300f39565ff2fff4dd87 \ No newline at end of file +8f35aaecfb53426ea10816442e23065142bab9dd0fb712a29e0fc471d13c44ac diff --git a/src/Misc/contentHash/dotnetRuntime/win-x64 b/src/Misc/contentHash/dotnetRuntime/win-x64 index 3fd49d6c5..c54e44677 100644 --- a/src/Misc/contentHash/dotnetRuntime/win-x64 +++ b/src/Misc/contentHash/dotnetRuntime/win-x64 @@ -1 +1 @@ -16ab4c166c58bc4c5600ff055be7ce0a9bb0dd993388114a76efea51e4ea14cb \ No newline at end of file +811c7debdfc54d074385b063b83c997e5360c8a9160cd20fe777713968370063 diff --git a/src/Misc/runnerdotnetruntimeassets b/src/Misc/runnerdotnetruntimeassets index f2a5f05bb..ba46f54bd 100644 --- a/src/Misc/runnerdotnetruntimeassets +++ b/src/Misc/runnerdotnetruntimeassets @@ -76,6 +76,7 @@ mscordaccore_amd64_amd64_6.0.522.21309.dll mscordaccore_arm64_arm64_6.0.522.21309.dll mscordaccore_amd64_amd64_6.0.1322.58009.dll mscordaccore_amd64_amd64_6.0.2023.32017.dll +mscordaccore_amd64_amd64_6.0.2223.42425.dll mscordbi.dll mscorlib.dll mscorrc.debug.dll diff --git a/src/dev.sh b/src/dev.sh index 7e1b91610..df2312817 100755 --- a/src/dev.sh +++ b/src/dev.sh @@ -22,7 +22,7 @@ DOWNLOAD_DIR="$SCRIPT_DIR/../_downloads/netcore2x" PACKAGE_DIR="$SCRIPT_DIR/../_package" PACKAGE_TRIMS_DIR="$SCRIPT_DIR/../_package_trims" DOTNETSDK_ROOT="$SCRIPT_DIR/../_dotnetsdk" -DOTNETSDK_VERSION="6.0.412" +DOTNETSDK_VERSION="6.0.414" DOTNETSDK_INSTALLDIR="$DOTNETSDK_ROOT/$DOTNETSDK_VERSION" RUNNER_VERSION=$(cat runnerversion) diff --git a/src/global.json b/src/global.json index adf50e1f7..2ea7e46ca 100644 --- a/src/global.json +++ b/src/global.json @@ -1,5 +1,5 @@ { "sdk": { - "version": "6.0.412" + "version": "6.0.414" } -} \ No newline at end of file +}