Merge pull request #137984 from NixOS/backport-137673-to-release-21.05

[Backport release-21.05] github-runner: 2.281.1 -> 2.282.0, prevent self-update
This commit is contained in:
Jörg Thalheim 2021-09-15 12:44:29 +01:00 committed by GitHub
commit 8dd8bd8be7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 34 additions and 31 deletions

View File

@ -30,16 +30,17 @@ let
dotnetSdk = dotnetCorePackages.sdk_3_1;
runtimeId = "linux-x64";
fakeSha1 = "0000000000000000000000000000000000000000";
in
stdenv.mkDerivation rec {
pname = "github-runner";
version = "2.281.1";
version = "2.282.0";
src = fetchFromGitHub {
owner = "actions";
repo = "runner";
rev = "c8caf59bb7adaa87c4cf8f61372670d338a13f2d"; # v${version}
sha256 = "sha256-Nl1FSjwweVqdQEVhqt4PEcqZbF7htNT279yx1nGuAe0=";
rev = "v${version}";
sha256 = "sha256-381xqBuysT5OR+SDhtSNCz0fOsDM7zC50EatAiXmpHU=";
};
nativeBuildInputs = [
@ -67,8 +68,9 @@ stdenv.mkDerivation rec {
./patches/use-get-directory-for-diag.patch
# Don't try to install systemd service
./patches/dont-install-systemd-service.patch
# Don't try to self-update runner (cannot be disabled, see https://github.com/actions/runner/issues/485)
./patches/ignore-self-update.patch
# Prevent the runner from starting a self-update for new versions
# (upstream issue: https://github.com/actions/runner/issues/485)
./patches/prevent-self-update.patch
];
postPatch = ''
@ -126,7 +128,7 @@ stdenv.mkDerivation rec {
-p:PackageRuntime="${runtimeId}" \
-p:BUILDCONFIG="Release" \
-p:RunnerVersion="${version}" \
-p:GitInfoCommitHash="${src.rev}" \
-p:GitInfoCommitHash="${fakeSha1}" \
src/dir.proj
runHook postBuild
@ -191,7 +193,7 @@ stdenv.mkDerivation rec {
-p:PackageRuntime="${runtimeId}" \
-p:BUILDCONFIG="Debug" \
-p:RunnerVersion="${version}" \
-p:GitInfoCommitHash="${src.rev}" \
-p:GitInfoCommitHash="${fakeSha1}" \
src/dir.proj
runHook postCheck

View File

@ -1,24 +0,0 @@
diff --git a/src/Runner.Listener/Runner.cs b/src/Runner.Listener/Runner.cs
index 68b0b4e..5da21fe 100644
--- a/src/Runner.Listener/Runner.cs
+++ b/src/Runner.Listener/Runner.cs
@@ -391,18 +391,7 @@ namespace GitHub.Runner.Listener
HostContext.WritePerfCounter($"MessageReceived_{message.MessageType}");
if (string.Equals(message.MessageType, AgentRefreshMessage.MessageType, StringComparison.OrdinalIgnoreCase))
{
- if (autoUpdateInProgress == false)
- {
- autoUpdateInProgress = true;
- var runnerUpdateMessage = JsonUtility.FromString<AgentRefreshMessage>(message.Body);
- var selfUpdater = HostContext.GetService<ISelfUpdater>();
- selfUpdateTask = selfUpdater.SelfUpdate(runnerUpdateMessage, jobDispatcher, !runOnce && HostContext.StartupType != StartupType.Service, HostContext.RunnerShutdownToken);
- Trace.Info("Refresh message received, kick-off selfupdate background process.");
- }
- else
- {
- Trace.Info("Refresh message received, skip autoupdate since a previous autoupdate is already running.");
- }
+ Trace.Info("Ignoring received refresh message (would trigger self-update).");
}
else if (string.Equals(message.MessageType, JobRequestMessageTypes.PipelineAgentJobRequest, StringComparison.OrdinalIgnoreCase))
{

View File

@ -0,0 +1,25 @@
From 8b77c9c61058842e031dd176df2b9c79bc2c0e28 Mon Sep 17 00:00:00 2001
From: Vincent Haupert <mail@vincent-haupert.de>
Date: Sun, 12 Sep 2021 19:52:21 +0200
Subject: [PATCH] Use a fake version to prevent self-update
---
src/Runner.Listener/MessageListener.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Runner.Listener/MessageListener.cs b/src/Runner.Listener/MessageListener.cs
index 71e5e43..29945e0 100644
--- a/src/Runner.Listener/MessageListener.cs
+++ b/src/Runner.Listener/MessageListener.cs
@@ -65,7 +65,7 @@ namespace GitHub.Runner.Listener
{
Id = _settings.AgentId,
Name = _settings.AgentName,
- Version = BuildConstants.RunnerPackage.Version,
+ Version = "2.999.9",
OSDescription = RuntimeInformation.OSDescription,
};
string sessionName = $"{Environment.MachineName ?? "RUNNER"}";
--
2.32.0