Merge pull request #137673 from veehaitch/prevent-update

github-runner: 2.281.1 -> 2.282.0, prevent self-update

authored by

Jörg Thalheim and committed by
GitHub
cc53d868 88352a1a

+34 -31
+9 -7
pkgs/development/tools/continuous-integration/github-runner/default.nix
··· 30 30 31 31 dotnetSdk = dotnetCorePackages.sdk_3_1; 32 32 runtimeId = "linux-x64"; 33 + fakeSha1 = "0000000000000000000000000000000000000000"; 33 34 in 34 35 stdenv.mkDerivation rec { 35 36 pname = "github-runner"; 36 - version = "2.281.1"; 37 + version = "2.282.0"; 37 38 38 39 src = fetchFromGitHub { 39 40 owner = "actions"; 40 41 repo = "runner"; 41 - rev = "c8caf59bb7adaa87c4cf8f61372670d338a13f2d"; # v${version} 42 - sha256 = "sha256-Nl1FSjwweVqdQEVhqt4PEcqZbF7htNT279yx1nGuAe0="; 42 + rev = "v${version}"; 43 + sha256 = "sha256-381xqBuysT5OR+SDhtSNCz0fOsDM7zC50EatAiXmpHU="; 43 44 }; 44 45 45 46 nativeBuildInputs = [ ··· 67 68 ./patches/use-get-directory-for-diag.patch 68 69 # Don't try to install systemd service 69 70 ./patches/dont-install-systemd-service.patch 70 - # Don't try to self-update runner (cannot be disabled, see https://github.com/actions/runner/issues/485) 71 - ./patches/ignore-self-update.patch 71 + # Prevent the runner from starting a self-update for new versions 72 + # (upstream issue: https://github.com/actions/runner/issues/485) 73 + ./patches/prevent-self-update.patch 72 74 ]; 73 75 74 76 postPatch = '' ··· 126 128 -p:PackageRuntime="${runtimeId}" \ 127 129 -p:BUILDCONFIG="Release" \ 128 130 -p:RunnerVersion="${version}" \ 129 - -p:GitInfoCommitHash="${src.rev}" \ 131 + -p:GitInfoCommitHash="${fakeSha1}" \ 130 132 src/dir.proj 131 133 132 134 runHook postBuild ··· 191 193 -p:PackageRuntime="${runtimeId}" \ 192 194 -p:BUILDCONFIG="Debug" \ 193 195 -p:RunnerVersion="${version}" \ 194 - -p:GitInfoCommitHash="${src.rev}" \ 196 + -p:GitInfoCommitHash="${fakeSha1}" \ 195 197 src/dir.proj 196 198 197 199 runHook postCheck
-24
pkgs/development/tools/continuous-integration/github-runner/patches/ignore-self-update.patch
··· 1 - diff --git a/src/Runner.Listener/Runner.cs b/src/Runner.Listener/Runner.cs 2 - index 68b0b4e..5da21fe 100644 3 - --- a/src/Runner.Listener/Runner.cs 4 - +++ b/src/Runner.Listener/Runner.cs 5 - @@ -391,18 +391,7 @@ namespace GitHub.Runner.Listener 6 - HostContext.WritePerfCounter($"MessageReceived_{message.MessageType}"); 7 - if (string.Equals(message.MessageType, AgentRefreshMessage.MessageType, StringComparison.OrdinalIgnoreCase)) 8 - { 9 - - if (autoUpdateInProgress == false) 10 - - { 11 - - autoUpdateInProgress = true; 12 - - var runnerUpdateMessage = JsonUtility.FromString<AgentRefreshMessage>(message.Body); 13 - - var selfUpdater = HostContext.GetService<ISelfUpdater>(); 14 - - selfUpdateTask = selfUpdater.SelfUpdate(runnerUpdateMessage, jobDispatcher, !runOnce && HostContext.StartupType != StartupType.Service, HostContext.RunnerShutdownToken); 15 - - Trace.Info("Refresh message received, kick-off selfupdate background process."); 16 - - } 17 - - else 18 - - { 19 - - Trace.Info("Refresh message received, skip autoupdate since a previous autoupdate is already running."); 20 - - } 21 - + Trace.Info("Ignoring received refresh message (would trigger self-update)."); 22 - } 23 - else if (string.Equals(message.MessageType, JobRequestMessageTypes.PipelineAgentJobRequest, StringComparison.OrdinalIgnoreCase)) 24 - {
+25
pkgs/development/tools/continuous-integration/github-runner/patches/prevent-self-update.patch
··· 1 + From 8b77c9c61058842e031dd176df2b9c79bc2c0e28 Mon Sep 17 00:00:00 2001 2 + From: Vincent Haupert <mail@vincent-haupert.de> 3 + Date: Sun, 12 Sep 2021 19:52:21 +0200 4 + Subject: [PATCH] Use a fake version to prevent self-update 5 + 6 + --- 7 + src/Runner.Listener/MessageListener.cs | 2 +- 8 + 1 file changed, 1 insertion(+), 1 deletion(-) 9 + 10 + diff --git a/src/Runner.Listener/MessageListener.cs b/src/Runner.Listener/MessageListener.cs 11 + index 71e5e43..29945e0 100644 12 + --- a/src/Runner.Listener/MessageListener.cs 13 + +++ b/src/Runner.Listener/MessageListener.cs 14 + @@ -65,7 +65,7 @@ namespace GitHub.Runner.Listener 15 + { 16 + Id = _settings.AgentId, 17 + Name = _settings.AgentName, 18 + - Version = BuildConstants.RunnerPackage.Version, 19 + + Version = "2.999.9", 20 + OSDescription = RuntimeInformation.OSDescription, 21 + }; 22 + string sessionName = $"{Environment.MachineName ?? "RUNNER"}"; 23 + -- 24 + 2.32.0 25 +