From 10689df734e8ded9c704c99e58026d56aa89e548 Mon Sep 17 00:00:00 2001 From: Vincent Haupert Date: Fri, 28 Jan 2022 09:00:00 +0100 Subject: [PATCH 1/4] github-runner: disable telemetry in `createDepsFile` --- .../tools/continuous-integration/github-runner/default.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkgs/development/tools/continuous-integration/github-runner/default.nix b/pkgs/development/tools/continuous-integration/github-runner/default.nix index 1b95903c6013..01c6acfc0dc3 100644 --- a/pkgs/development/tools/continuous-integration/github-runner/default.nix +++ b/pkgs/development/tools/continuous-integration/github-runner/default.nix @@ -290,6 +290,9 @@ stdenv.mkDerivation rec { name = "create-deps-file"; runtimeInputs = [ dotnetSdk nuget-to-nix ]; text = '' + # Disable telemetry data + export DOTNET_CLI_TELEMETRY_OPTOUT=1 + rundir=$(pwd) printf "\n* Setup workdir\n" From 1126f8282a4d1c7159a2cec03190ef4f61c457f1 Mon Sep 17 00:00:00 2001 From: Vincent Haupert Date: Fri, 28 Jan 2022 09:00:23 +0100 Subject: [PATCH 2/4] github-runner: 2.286.0 -> 2.287.1 Also requires to disable some additional online tests. --- .../github-runner/default.nix | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/pkgs/development/tools/continuous-integration/github-runner/default.nix b/pkgs/development/tools/continuous-integration/github-runner/default.nix index 01c6acfc0dc3..75af3a212371 100644 --- a/pkgs/development/tools/continuous-integration/github-runner/default.nix +++ b/pkgs/development/tools/continuous-integration/github-runner/default.nix @@ -43,13 +43,13 @@ let in stdenv.mkDerivation rec { pname = "github-runner"; - version = "2.286.0"; + version = "2.287.1"; src = fetchFromGitHub { owner = "actions"; repo = "runner"; rev = "v${version}"; - hash = "sha256-a3Kh65NTpVlKUer59rna7NWIQSxh1edU9MwguakzydI="; + hash = "sha256-4SPrtX3j8blWTYnSkD2Z7IecZvI4xdAqHRJ1lBM0aAo="; }; nativeBuildInputs = [ @@ -137,10 +137,20 @@ stdenv.mkDerivation rec { doCheck = true; - disabledTests = [ - # Self-updating is patched out, hence this test will fail - "FullyQualifiedName!=GitHub.Runner.Common.Tests.Listener.SelfUpdaterL0.TestSelfUpdateAsync_ValidateHash" - "FullyQualifiedName!=GitHub.Runner.Common.Tests.Listener.SelfUpdaterL0.TestSelfUpdateAsync" + disabledTests = + [ "FullyQualifiedName!=GitHub.Runner.Common.Tests.Listener.SelfUpdaterL0.TestSelfUpdateAsync" ] ++ map + (x: "FullyQualifiedName!=GitHub.Runner.Common.Tests.Listener.SelfUpdaterL0.TestSelfUpdateAsync_${x}") + [ + "Cancel_CloneHashTask_WhenNotNeeded" + "CloneHash_RuntimeAndExternals" + "DownloadRetry" + "FallbackToFullPackage" + "NoUpdateOnOldVersion" + "NotUseExternalsRuntimeTrimmedPackageOnHashMismatch" + "UseExternalsRuntimeTrimmedPackage" + "UseExternalsTrimmedPackage" + "ValidateHash" + ] ++ [ "FullyQualifiedName!=GitHub.Runner.Common.Tests.Listener.RunnerL0.TestRunOnceHandleUpdateMessage" ] ++ lib.optionals (stdenv.hostPlatform.system == "aarch64-linux") [ # "JavaScript Actions in Alpine containers are only supported on x64 Linux runners. Detected Linux Arm64" From 4be414dc95a9e901d9ca1cc887a22b3fd0a565e5 Mon Sep 17 00:00:00 2001 From: Vincent Haupert Date: Fri, 28 Jan 2022 09:39:53 +0100 Subject: [PATCH 3/4] github-runner: refactor `disabledTests` Make the `disabledTests` attribute a list of disabled tests matched exactly by their fully qualified name. Also mention the disabled tests in the `checkPhase`. --- .../github-runner/default.nix | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/pkgs/development/tools/continuous-integration/github-runner/default.nix b/pkgs/development/tools/continuous-integration/github-runner/default.nix index 75af3a212371..c3b9e987b430 100644 --- a/pkgs/development/tools/continuous-integration/github-runner/default.nix +++ b/pkgs/development/tools/continuous-integration/github-runner/default.nix @@ -90,7 +90,7 @@ stdenv.mkDerivation rec { # Disable specific tests substituteInPlace src/dir.proj \ --replace 'dotnet test Test/Test.csproj' \ - "dotnet test Test/Test.csproj --filter '${lib.concatStringsSep "&" disabledTests}'" + "dotnet test Test/Test.csproj --filter '${lib.concatStringsSep "&" (map (x: "FullyQualifiedName!=${x}") disabledTests)}'" # We don't use a Git checkout substituteInPlace src/dir.proj \ @@ -137,10 +137,10 @@ stdenv.mkDerivation rec { doCheck = true; + # Fully qualified name of disabled tests disabledTests = - [ "FullyQualifiedName!=GitHub.Runner.Common.Tests.Listener.SelfUpdaterL0.TestSelfUpdateAsync" ] ++ map - (x: "FullyQualifiedName!=GitHub.Runner.Common.Tests.Listener.SelfUpdaterL0.TestSelfUpdateAsync_${x}") - [ + [ "GitHub.Runner.Common.Tests.Listener.SelfUpdaterL0.TestSelfUpdateAsync" ] + ++ map (x: "GitHub.Runner.Common.Tests.Listener.SelfUpdaterL0.TestSelfUpdateAsync_${x}") [ "Cancel_CloneHashTask_WhenNotNeeded" "CloneHash_RuntimeAndExternals" "DownloadRetry" @@ -150,15 +150,8 @@ stdenv.mkDerivation rec { "UseExternalsRuntimeTrimmedPackage" "UseExternalsTrimmedPackage" "ValidateHash" - ] ++ [ - "FullyQualifiedName!=GitHub.Runner.Common.Tests.Listener.RunnerL0.TestRunOnceHandleUpdateMessage" - ] ++ lib.optionals (stdenv.hostPlatform.system == "aarch64-linux") [ - # "JavaScript Actions in Alpine containers are only supported on x64 Linux runners. Detected Linux Arm64" - "FullyQualifiedName!=GitHub.Runner.Common.Tests.Worker.StepHostL0.DetermineNodeRuntimeVersionInAlpineContainerAsync" - ] ++ map - # Online tests - (x: "FullyQualifiedName!=GitHub.Runner.Common.Tests.Worker.ActionManagerL0.PrepareActions_${x}") - [ + ] + ++ map (x: "GitHub.Runner.Common.Tests.Worker.ActionManagerL0.PrepareActions_${x}") [ "CompositeActionWithActionfile_CompositeContainerNested" "CompositeActionWithActionfile_CompositePrestepNested" "CompositeActionWithActionfile_MaxLimit" @@ -188,11 +181,15 @@ stdenv.mkDerivation rec { "RepositoryActionWithInvalidWrapperActionfile_Node_Legacy" "RepositoryActionWithWrapperActionfile_PreSteps" "RepositoryActionWithWrapperActionfile_PreSteps_Legacy" - ] ++ map - (x: "FullyQualifiedName!=GitHub.Runner.Common.Tests.DotnetsdkDownloadScriptL0.${x}") - [ + ] + ++ map (x: "GitHub.Runner.Common.Tests.DotnetsdkDownloadScriptL0.${x}") [ "EnsureDotnetsdkBashDownloadScriptUpToDate" "EnsureDotnetsdkPowershellDownloadScriptUpToDate" + ] + ++ [ "GitHub.Runner.Common.Tests.Listener.RunnerL0.TestRunOnceHandleUpdateMessage" ] + ++ lib.optionals (stdenv.hostPlatform.system == "aarch64-linux") [ + # "JavaScript Actions in Alpine containers are only supported on x64 Linux runners. Detected Linux Arm64" + "GitHub.Runner.Common.Tests.Worker.StepHostL0.DetermineNodeRuntimeVersionInAlpineContainerAsync" ]; checkInputs = [ git ]; @@ -204,6 +201,8 @@ stdenv.mkDerivation rec { ln -s ${nodejs-12_x} _layout/externals/node12 ln -s ${nodejs-16_x} _layout/externals/node16 + printf 'Disabled tests:\n%s\n' '${lib.concatMapStringsSep "\n" (x: " - ${x}") disabledTests}' + # BUILDCONFIG needs to be "Debug" dotnet msbuild \ -t:test \ From 7c2319905daf9e9142ad68585d3c10dc8c4d5069 Mon Sep 17 00:00:00 2001 From: Vincent Haupert Date: Fri, 28 Jan 2022 09:43:44 +0100 Subject: [PATCH 4/4] nixos/github-runner: use `--disableupdate` flag Use the new `--disableupdate` configure flag instead of our patch. --- .../continuous-integration/github-runner.nix | 1 + .../github-runner/default.nix | 3 --- .../patches/prevent-self-update.patch | 25 ------------------- 3 files changed, 1 insertion(+), 28 deletions(-) delete mode 100644 pkgs/development/tools/continuous-integration/github-runner/patches/prevent-self-update.patch diff --git a/nixos/modules/services/continuous-integration/github-runner.nix b/nixos/modules/services/continuous-integration/github-runner.nix index afd85c972b56..c3bd8f99c57f 100644 --- a/nixos/modules/services/continuous-integration/github-runner.nix +++ b/nixos/modules/services/continuous-integration/github-runner.nix @@ -208,6 +208,7 @@ in token=$(< "$STATE_DIRECTORY"/${newConfigTokenFilename}) RUNNER_ROOT="$STATE_DIRECTORY" ${cfg.package}/bin/config.sh \ --unattended \ + --disableupdate \ --work "$RUNTIME_DIRECTORY" \ --url ${escapeShellArg cfg.url} \ --token "$token" \ diff --git a/pkgs/development/tools/continuous-integration/github-runner/default.nix b/pkgs/development/tools/continuous-integration/github-runner/default.nix index c3b9e987b430..67433ab5d88a 100644 --- a/pkgs/development/tools/continuous-integration/github-runner/default.nix +++ b/pkgs/development/tools/continuous-integration/github-runner/default.nix @@ -77,9 +77,6 @@ stdenv.mkDerivation rec { ./patches/use-get-directory-for-diag.patch # Don't try to install systemd service ./patches/dont-install-systemd-service.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/prevent-self-update.patch b/pkgs/development/tools/continuous-integration/github-runner/patches/prevent-self-update.patch deleted file mode 100644 index da73cd75a096..000000000000 --- a/pkgs/development/tools/continuous-integration/github-runner/patches/prevent-self-update.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 8b77c9c61058842e031dd176df2b9c79bc2c0e28 Mon Sep 17 00:00:00 2001 -From: Vincent Haupert -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 -