gitlab-runner: Use substituteInPlace for patching and stop referencing src attributes

This commit is contained in:
commiterate 2025-04-27 17:40:50 -04:00
parent ea912c0016
commit 750cbc21e2

View File

@ -34,8 +34,9 @@ buildGoModule (finalAttrs: {
# Remove some tests that can't work during a nix build
# Needs the build directory to be a git repo
sed -i "s/func TestCacheArchiverAddingUntrackedFiles/func OFF_TestCacheArchiverAddingUntrackedFiles/" commands/helpers/file_archiver_test.go
sed -i "s/func TestCacheArchiverAddingUntrackedUnicodeFiles/func OFF_TestCacheArchiverAddingUntrackedUnicodeFiles/" commands/helpers/file_archiver_test.go
substituteInPlace commands/helpers/file_archiver_test.go \
--replace-fail "func TestCacheArchiverAddingUntrackedFiles" "func OFF_TestCacheArchiverAddingUntrackedFiles" \
--replace-fail "func TestCacheArchiverAddingUntrackedUnicodeFiles" "func OFF_TestCacheArchiverAddingUntrackedUnicodeFiles"
rm shells/abstract_test.go
# No writable developer environment
@ -56,11 +57,14 @@ buildGoModule (finalAttrs: {
''
+ lib.optionalString stdenv.buildPlatform.isDarwin ''
# Invalid bind arguments break Unix socket tests
sed -i "s/func TestRunnerWrapperCommand_createListener/func OFF_TestRunnerWrapperCommand_createListener/" commands/wrapper_test.go
substituteInPlace commands/wrapper_test.go \
--replace-fail "func TestRunnerWrapperCommand_createListener" "func OFF_TestRunnerWrapperCommand_createListener"
# No keychain access during build breaks X.509 certificate tests
sed -i "s/func TestCertificate/func OFF_TestCertificate/" helpers/certificate/x509_test.go
sed -i "s/func TestClientInvalidSSL/func OFF_TestClientInvalidSSL/" network/client_test.go
substituteInPlace helpers/certificate/x509_test.go \
--replace-fail "func TestCertificate" "func OFF_TestCertificate"
substituteInPlace network/client_test.go \
--replace-fail "func TestClientInvalidSSL" "func OFF_TestClientInvalidSSL"
'';
excludedPackages = [
@ -79,7 +83,7 @@ buildGoModule (finalAttrs: {
[
"-X ${ldflagsPackageVariablePrefix}.NAME=gitlab-runner"
"-X ${ldflagsPackageVariablePrefix}.VERSION=${finalAttrs.version}"
"-X ${ldflagsPackageVariablePrefix}.REVISION=${finalAttrs.src.tag}"
"-X ${ldflagsPackageVariablePrefix}.REVISION=v${finalAttrs.version}"
];
preCheck = ''