diff options
| author | Vincent Haupert <mail@vincent-haupert.de> | 2021-09-13 18:32:38 +0200 |
|---|---|---|
| committer | github-actions[bot] <github-actions[bot]@users.noreply.github.com> | 2021-09-15 09:49:59 +0000 |
| commit | ca41e07801f719188a035e918e623a5be61fb6ca (patch) | |
| tree | 950d9dc15e6115982ebeb320ac9fdb800bf01f9a | |
| parent | github-runner: use dummy SHA-1 as `GitInfoCommitHash` (diff) | |
| download | nixpkgs-ca41e07801f719188a035e918e623a5be61fb6ca.tar.gz | |
github-runner: prevent self-updates
As of yet, a patch caused the runner to discard update messages.
Unfortunately, GitHub keeps sending update messages to outdated runners
causing them to no longer pick up jobs.
This commit causes the runner to send a high version to GitHub which
should be more recent for quite a time. That way, GitHub does not send
update message and keeps scheduling jobs even for outdated runners.
Naturally, an oudated runner can still break at any time as GitHub's
current approach assumes that all runners are always up-to-date. We
should still strive for quick nixpkgs updates but this patch should give
us some time.
(cherry picked from commit e8bbcc79fd07014b146835dfd7f5eba2079d9a55)
3 files changed, 28 insertions, 26 deletions
diff --git a/pkgs/development/tools/continuous-integration/github-runner/default.nix b/pkgs/development/tools/continuous-integration/github-runner/default.nix index 2d7df078f8cc..711148c530a0 100644 --- a/pkgs/development/tools/continuous-integration/github-runner/default.nix +++ b/pkgs/development/tools/continuous-integration/github-runner/default.nix @@ -68,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 = '' diff --git a/pkgs/development/tools/continuous-integration/github-runner/patches/ignore-self-update.patch b/pkgs/development/tools/continuous-integration/github-runner/patches/ignore-self-update.patch deleted file mode 100644 index b505bbc7503b..000000000000 --- a/pkgs/development/tools/continuous-integration/github-runner/patches/ignore-self-update.patch +++ /dev/null @@ -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)) - { diff --git a/pkgs/development/tools/continuous-integration/github-runner/patches/prevent-self-update.patch b/pkgs/development/tools/continuous-integration/github-runner/patches/prevent-self-update.patch new file mode 100644 index 000000000000..da73cd75a096 --- /dev/null +++ b/pkgs/development/tools/continuous-integration/github-runner/patches/prevent-self-update.patch @@ -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 + |
