mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-04-15 10:17:58 +00:00
github-runner: use finalAttrs to make it possible to override the version (#363733)
With rec, it is nearly impossible to override the version since it is used in so many different places in the nix expression. With the current change, it is possible to override version and src to build a different version.
This commit is contained in:
parent
128bd7f974
commit
d298ddec02
@ -23,14 +23,14 @@
|
||||
# Node.js runtimes supported by upstream
|
||||
assert builtins.all (x: builtins.elem x [ "node20" ]) nodeRuntimes;
|
||||
|
||||
buildDotnetModule rec {
|
||||
buildDotnetModule (finalAttrs: {
|
||||
pname = "github-runner";
|
||||
version = "2.321.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "actions";
|
||||
repo = "runner";
|
||||
rev = "v${version}";
|
||||
tag = "v${finalAttrs.version}";
|
||||
hash = "sha256-KZ072v5kYlD78RGQl13Aj05DGzj2+r2akzyZ1aJn93A=";
|
||||
leaveDotGit = true;
|
||||
postFetch = ''
|
||||
@ -52,7 +52,7 @@ buildDotnetModule rec {
|
||||
git config user.name "root"
|
||||
git add .
|
||||
git commit -m "Initial commit"
|
||||
git checkout -b v${version}
|
||||
git checkout -b v${finalAttrs.version}
|
||||
)
|
||||
mkdir -p $TMPDIR/bin
|
||||
cat > $TMPDIR/bin/git <<EOF
|
||||
@ -95,7 +95,7 @@ buildDotnetModule rec {
|
||||
|
||||
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT = isNull glibcLocales;
|
||||
LOCALE_ARCHIVE = lib.optionalString (
|
||||
!DOTNET_SYSTEM_GLOBALIZATION_INVARIANT
|
||||
!finalAttrs.DOTNET_SYSTEM_GLOBALIZATION_INVARIANT
|
||||
) "${glibcLocales}/lib/locale/locale-archive";
|
||||
|
||||
postConfigure = ''
|
||||
@ -105,7 +105,7 @@ buildDotnetModule rec {
|
||||
-p:ContinuousIntegrationBuild=true \
|
||||
-p:Deterministic=true \
|
||||
-p:PackageRuntime="${dotnetCorePackages.systemToDotnetRid stdenv.hostPlatform.system}" \
|
||||
-p:RunnerVersion="${version}" \
|
||||
-p:RunnerVersion="${finalAttrs.version}" \
|
||||
src/dir.proj
|
||||
'';
|
||||
|
||||
@ -204,7 +204,7 @@ buildDotnetModule rec {
|
||||
"GitHub.Runner.Common.Tests.Worker.StepHostL0.DetermineNodeRuntimeVersionInAlpineContainerAsync"
|
||||
"GitHub.Runner.Common.Tests.Worker.StepHostL0.DetermineNode20RuntimeVersionInAlpineContainerAsync"
|
||||
]
|
||||
++ lib.optionals DOTNET_SYSTEM_GLOBALIZATION_INVARIANT [
|
||||
++ lib.optionals finalAttrs.DOTNET_SYSTEM_GLOBALIZATION_INVARIANT [
|
||||
"GitHub.Runner.Common.Tests.ProcessExtensionL0.SuccessReadProcessEnv"
|
||||
"GitHub.Runner.Common.Tests.Util.StringUtilL0.FormatUsesInvariantCulture"
|
||||
"GitHub.Runner.Common.Tests.Worker.VariablesL0.Constructor_SetsOrdinalIgnoreCaseComparer"
|
||||
@ -243,7 +243,7 @@ buildDotnetModule rec {
|
||||
+ lib.optionalString stdenv.hostPlatform.isLinux ''
|
||||
substituteInPlace $out/lib/github-runner/config.sh \
|
||||
--replace 'command -v ldd' 'command -v ${glibc.bin}/bin/ldd' \
|
||||
--replace 'ldd ./bin' '${glibc.bin}/bin/ldd ${dotnet-runtime}/share/dotnet/shared/Microsoft.NETCore.App/${dotnet-runtime.version}/' \
|
||||
--replace 'ldd ./bin' '${glibc.bin}/bin/ldd ${finalAttrs.dotnet-runtime}/share/dotnet/shared/Microsoft.NETCore.App/${finalAttrs.dotnet-runtime.version}/' \
|
||||
--replace '/sbin/ldconfig' '${glibc.bin}/bin/ldconfig'
|
||||
''
|
||||
+ ''
|
||||
@ -309,7 +309,7 @@ buildDotnetModule rec {
|
||||
$out/bin/Runner.Listener --help >/dev/null
|
||||
|
||||
version=$($out/bin/Runner.Listener --version)
|
||||
if [[ "$version" != "${version}" ]]; then
|
||||
if [[ "$version" != "${finalAttrs.version}" ]]; then
|
||||
printf 'Unexpected version %s' "$version"
|
||||
exit 1
|
||||
fi
|
||||
@ -347,4 +347,4 @@ buildDotnetModule rec {
|
||||
];
|
||||
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
||||
};
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user