From 73babca767015d92e490d8d243abe51ab78db320 Mon Sep 17 00:00:00 2001 From: Vincent Haupert Date: Tue, 15 Aug 2023 10:13:08 +0200 Subject: [PATCH] github-runner: 2.307.1 -> 2.308.0 * Update runner to v2.308.0 * Use Node 20 by default * Allow building with Node 16 support through `nodeRuntimes` argument It's important to have an easy optin for Node 16 since quite many GitHub actions (explicitly) rely on Node 16. It probably will take some time until most switch to Node 20. Note that it's also not an option to tell those who need Node 16 support to continue to use an older version since GitHub removes support for previous releases quite quickly. --- .../github-runner/default.nix | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/pkgs/development/tools/continuous-integration/github-runner/default.nix b/pkgs/development/tools/continuous-integration/github-runner/default.nix index 6ccc923ec30d..0b1a21c2852b 100644 --- a/pkgs/development/tools/continuous-integration/github-runner/default.nix +++ b/pkgs/development/tools/continuous-integration/github-runner/default.nix @@ -9,21 +9,28 @@ , glibcLocales , lib , nixosTests -, nodejs_16 , stdenv , which , buildPackages , runtimeShell + # List of Node.js runtimes the package should support +, nodeRuntimes ? [ "node20" ] +, nodejs_16 +, nodejs_20 }: + +# Node.js runtimes supported by upstream +assert builtins.all (x: builtins.elem x [ "node16" "node20" ]) nodeRuntimes; + buildDotnetModule rec { pname = "github-runner"; - version = "2.307.1"; + version = "2.308.0"; src = fetchFromGitHub { owner = "actions"; repo = "runner"; rev = "v${version}"; - hash = "sha256-h/JcOw7p/loBD6aj7NeZyqK3GtapNkjWTYw0G6OCmVQ="; + hash = "sha256-LrHScQbBkRPSNsfPxvE2+K9tON8xuR0e4JpKVuI+Gu0="; leaveDotGit = true; postFetch = '' git -C $out rev-parse --short HEAD > $out/.git-revision @@ -31,7 +38,7 @@ buildDotnetModule rec { ''; }; - # The git commit is read during the build and some tests depends on a git repo to be present + # The git commit is read during the build and some tests depend on a git repo to be present # https://github.com/actions/runner/blob/22d1938ac420a4cb9e3255e47a91c2e43c38db29/src/dir.proj#L5 unpackPhase = '' cp -r $src $TMPDIR/src @@ -178,6 +185,7 @@ buildDotnetModule rec { ++ 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" + "GitHub.Runner.Common.Tests.Worker.StepHostL0.DetermineNode20RuntimeVersionInAlpineContainerAsync" ] ++ lib.optionals DOTNET_SYSTEM_GLOBALIZATION_INVARIANT [ "GitHub.Runner.Common.Tests.ProcessExtensionL0.SuccessReadProcessEnv" @@ -185,13 +193,19 @@ buildDotnetModule rec { "GitHub.Runner.Common.Tests.Worker.VariablesL0.Constructor_SetsOrdinalIgnoreCaseComparer" "GitHub.Runner.Common.Tests.Worker.WorkerL0.DispatchCancellation" "GitHub.Runner.Common.Tests.Worker.WorkerL0.DispatchRunNewJob" + ] + ++ lib.optionals (!lib.elem "node16" nodeRuntimes) [ + "GitHub.Runner.Common.Tests.ProcessExtensionL0.SuccessReadProcessEnv" ]; testProjectFile = [ "src/Test/Test.csproj" ]; preCheck = '' mkdir -p _layout/externals + '' + lib.optionalString (lib.elem "node16" nodeRuntimes) '' ln -s ${nodejs_16} _layout/externals/node16 + '' + lib.optionalString (lib.elem "node20" nodeRuntimes) '' + ln -s ${nodejs_20} _layout/externals/node20 ''; postInstall = '' @@ -224,12 +238,15 @@ buildDotnetModule rec { --replace './externals' "$out/lib/externals" \ --replace './bin/RunnerService.js' "$out/lib/github-runner/RunnerService.js" - # The upstream package includes Node 16 and expects it at the path - # externals/node16. As opposed to the official releases, we don't + # The upstream package includes Node and expects it at the path + # externals/node$version. As opposed to the official releases, we don't # link the Alpine Node flavors. mkdir -p $out/lib/externals + '' + lib.optionalString (lib.elem "node16" nodeRuntimes) '' ln -s ${nodejs_16} $out/lib/externals/node16 - + '' + lib.optionalString (lib.elem "node20" nodeRuntimes) '' + ln -s ${nodejs_20} $out/lib/externals/node20 + '' + '' # Install Nodejs scripts called from workflows install -D src/Misc/layoutbin/hashFiles/index.js $out/lib/github-runner/hashFiles/index.js mkdir -p $out/lib/github-runner/checkScripts