Merge pull request #152387 from kfollesdal/kfollesdal/github-runner_2.286.0

github-runner update to 2.286.0 with dotnet sdk 6.0
This commit is contained in:
Pavol Rusnak 2022-01-03 17:08:44 +01:00 committed by GitHub
commit 3dc3e1ef58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 318 additions and 1548 deletions

View file

@ -10,7 +10,7 @@
, icu
, libkrb5
, lib
, linkFarm
, linkFarmFromDrvs
, lttng-ust
, makeWrapper
, nodejs-12_x
@ -18,33 +18,38 @@
, openssl
, stdenv
, zlib
, writeShellApplication
, nuget-to-nix
}:
let
deps = (import ./deps.nix { inherit fetchurl; });
nugetPackages = map
(x: {
name = "${x.name}.nupkg";
path = "${x}";
})
deps;
nugetSource = linkFarm "nuget-packages" nugetPackages;
nugetSource = linkFarmFromDrvs "nuget-packages" (
import ./deps.nix {
fetchNuGet = { pname, version, sha256 }: fetchurl {
name = "${pname}.${version}.nupkg";
url = "https://www.nuget.org/api/v2/package/${pname}/${version}";
inherit sha256;
};
}
);
dotnetSdk = dotnetCorePackages.sdk_3_1;
runtimeId =
if stdenv.isAarch64
then "linux-arm64"
else "linux-x64";
dotnetSdk = dotnetCorePackages.sdk_6_0;
# Map Nix systems to .NET runtime ids
runtimeIds = {
"x86_64-linux" = "linux-x64";
"aarch64-linux" = "linux-arm64";
};
runtimeId = runtimeIds.${stdenv.system};
fakeSha1 = "0000000000000000000000000000000000000000";
in
stdenv.mkDerivation rec {
pname = "github-runner";
version = "2.285.1";
version = "2.286.0";
src = fetchFromGitHub {
owner = "actions";
repo = "runner";
rev = "v${version}";
hash = "sha256-SlKUuebsoZ9OgYuDTNOlY1KMg01LFSFazrLCctiFq3A=";
hash = "sha256-a3Kh65NTpVlKUer59rna7NWIQSxh1edU9MwguakzydI=";
};
nativeBuildInputs = [
@ -80,7 +85,7 @@ stdenv.mkDerivation rec {
postPatch = ''
# Relax the version requirement
substituteInPlace src/global.json \
--replace '3.1.302' '${dotnetSdk.version}'
--replace '6.0.100' '${dotnetSdk.version}'
# Disable specific tests
substituteInPlace src/dir.proj \
@ -116,14 +121,6 @@ stdenv.mkDerivation rec {
runHook postConfigure
'';
postConfigure = ''
# `crossgen` dependency is called during build
patchelf \
--set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath "${lib.makeLibraryPath [ stdenv.cc.cc.lib ]}" \
$HOME/.nuget/packages/microsoft.netcore.app.runtime.${runtimeId}/*/tools/crossgen
'';
buildPhase = ''
runHook preBuild
@ -142,6 +139,8 @@ stdenv.mkDerivation rec {
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"
"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"
@ -281,11 +280,46 @@ stdenv.mkDerivation rec {
wrap config.sh --prefix PATH : ${lib.makeBinPath [ glibc.bin ]}
'';
# Script to create deps.nix file for dotnet dependencies. Run it with
# $(nix-build -A github-runner.passthru.createDepsFile)/bin/create-deps-file
#
# Default output path is /tmp/${pname}-deps.nix, but can be overriden with cli argument.
#
# Inspired by passthru.fetch-deps in pkgs/build-support/build-dotnet-module/default.nix
passthru.createDepsFile = writeShellApplication {
name = "create-deps-file";
runtimeInputs = [ dotnetSdk nuget-to-nix ];
text = ''
rundir=$(pwd)
printf "\n* Setup workdir\n"
workdir="$(mktemp -d /tmp/${pname}.XXX)"
cp -rT "${src}" "$workdir"
chmod -R +w "$workdir"
trap 'rm -rf "$workdir"' EXIT
pushd "$workdir"
mkdir nuget_pkgs
${lib.concatMapStrings (rid: ''
printf "\n* Restore ${pname} (${rid}) dotnet project\n"
dotnet restore src/ActionsRunner.sln --packages nuget_pkgs --no-cache --force --runtime "${rid}"
'') (lib.attrValues runtimeIds)}
cd "$rundir"
deps_file=''${1-"/tmp/${pname}-deps.nix"}
printf "\n* Make %s file\n" "$(basename "$deps_file")"
nuget-to-nix "$workdir/nuget_pkgs" > "$deps_file"
printf "\n* Dependency file writen to %s" "$deps_file"
'';
};
meta = with lib; {
description = "Self-hosted runner for GitHub Actions";
homepage = "https://github.com/actions/runner";
license = licenses.mit;
maintainers = with maintainers; [ veehaitch newam ];
platforms = [ "x86_64-linux" "aarch64-linux" ];
maintainers = with maintainers; [ veehaitch newam kfollesdal ];
platforms = attrNames runtimeIds;
};
}

File diff suppressed because it is too large Load diff