github-runner: guard support for Node.js 12

Adds an argument `withNode12` to the derivation which defaults to `false`.

Node.js 12 reaches end-of-life on April 30, 2022. Yet, upstream still
supports Node.js 12 (with an explicit opt-in through the environment
variable `ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION`).
This commit is contained in:
Vincent Haupert
2022-04-04 12:11:34 +02:00
parent d592f0aff4
commit 05d752888e

View File

@@ -13,13 +13,16 @@
, linkFarmFromDrvs
, lttng-ust
, makeWrapper
, nodejs-12_x
, nodejs-16_x
, openssl
, stdenv
, zlib
, writeShellApplication
, nuget-to-nix
# Keeping this option until upstream removes support for EoL Node.js 12 entirely
# Also refer to: https://github.com/actions/runner/pull/1716
, withNode12 ? false
, nodejs-12_x
}:
let
nugetSource = linkFarmFromDrvs "nuget-packages" (
@@ -187,15 +190,17 @@ stdenv.mkDerivation 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"
]
++ lib.optionals (!withNode12) [
"GitHub.Runner.Common.Tests.ProcessExtensionL0.SuccessReadProcessEnv"
];
checkInputs = [ git ];
checkPhase = ''
runHook preCheck
mkdir -p _layout/externals
ln -s ${nodejs-12_x} _layout/externals/node12
${lib.optionalString withNode12 "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}'
@@ -244,7 +249,7 @@ stdenv.mkDerivation rec {
# externals/node{12,16}. As opposed to the official releases, we don't
# link the Alpine Node flavors.
mkdir -p $out/externals
ln -s ${nodejs-12_x} $out/externals/node12
${lib.optionalString withNode12 "ln -s ${nodejs-12_x} $out/externals/node12"}
ln -s ${nodejs-16_x} $out/externals/node16
# Install Nodejs scripts called from workflows