summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcommiterate <111539270+commiterate@users.noreply.github.com>2025-04-03 22:04:35 -0400
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2025-04-08 21:52:40 +0000
commitf45dde7b6e0cb946e23c0f0387cfc62ee309b664 (patch)
tree37ec80b60263de99ca42c1c15a810da678af705a
parentclamav: 1.4.1 -> 1.4.2 (diff)
downloadnixpkgs-origin/backport-395906-to-release-24.11.tar.gz
gitlab-runner: Add main program, version check hook, and Nix update script. Fix Darwin builds.origin/backport-395906-to-release-24.11
(cherry picked from commit 89933df8269453af8df19d5149c9b1cd916f4830)
-rw-r--r--pkgs/by-name/gi/gitlab-runner/package.nix109
1 files changed, 66 insertions, 43 deletions
diff --git a/pkgs/by-name/gi/gitlab-runner/package.nix b/pkgs/by-name/gi/gitlab-runner/package.nix
index 99385cc926af..bbf6b3592832 100644
--- a/pkgs/by-name/gi/gitlab-runner/package.nix
+++ b/pkgs/by-name/gi/gitlab-runner/package.nix
@@ -1,80 +1,103 @@
{
lib,
+ stdenv,
+ bash,
buildGoModule,
fetchFromGitLab,
- bash,
+ nix-update-script,
+ versionCheckHook,
}:
-let
- version = "17.2.0";
-in
-buildGoModule rec {
- inherit version;
+buildGoModule (finalAttrs: {
pname = "gitlab-runner";
-
- commonPackagePath = "gitlab.com/gitlab-org/gitlab-runner/common";
- ldflags = [
- "-X ${commonPackagePath}.NAME=gitlab-runner"
- "-X ${commonPackagePath}.VERSION=${version}"
- "-X ${commonPackagePath}.REVISION=v${version}"
- ];
-
- # For patchShebangs
- buildInputs = [ bash ];
-
- vendorHash = "sha256-1MwHss76apA9KoFhEU6lYiUACrPMGYzjhds6nTyNuJI=";
+ version = "17.2.0";
src = fetchFromGitLab {
owner = "gitlab-org";
repo = "gitlab-runner";
- rev = "v${version}";
+ tag = "v${finalAttrs.version}";
hash = "sha256-a2Igy4DS3fYTvPW1vvDrH/DjMQ4lG9cm/P3mFr+y9s4=";
};
+ vendorHash = "sha256-1MwHss76apA9KoFhEU6lYiUACrPMGYzjhds6nTyNuJI=";
+
+ # For patchShebangs
+ nativeBuildInputs = [ bash ];
+
patches = [
./fix-shell-path.patch
./remove-bash-test.patch
];
- prePatch = ''
- # Remove some tests that can't work during a nix build
+ prePatch =
+ ''
+ # Remove some tests that can't work during a nix build
- # Requires to run in 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
+ # Requires to run in 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
- # No writable developer environment
- rm common/build_test.go
- rm common/build_settings_test.go
- rm executors/custom/custom_test.go
+ # No writable developer environment
+ rm common/build_test.go
+ rm common/build_settings_test.go
+ rm executors/custom/custom_test.go
- # No docker during build
- rm executors/docker/terminal_test.go
- rm executors/docker/docker_test.go
- rm helpers/docker/auth/auth_test.go
- rm executors/docker/services_test.go
- '';
+ # No docker during build
+ rm executors/docker/terminal_test.go
+ rm executors/docker/docker_test.go
+ rm helpers/docker/auth/auth_test.go
+ rm executors/docker/services_test.go
+ ''
+ + lib.optionalString stdenv.buildPlatform.isDarwin ''
+ # No keychain access during build breaks X.509 certificate tests
+ rm helpers/certificate/x509_test.go
+ rm network/client_test.go
+ '';
excludedPackages = [
# CI helper script for pushing images to Docker and ECR registries
+ #
# https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/4139
"./scripts/sync-docker-images"
];
- postInstall = ''
- install packaging/root/usr/share/gitlab-runner/clear-docker-cache $out/bin
- '';
+ ldflags =
+ let
+ ldflagsPackageVariablePrefix = "gitlab.com/gitlab-org/gitlab-runner/common";
+ in
+ [
+ "-X ${ldflagsPackageVariablePrefix}.NAME=gitlab-runner"
+ "-X ${ldflagsPackageVariablePrefix}.VERSION=${finalAttrs.version}"
+ "-X ${ldflagsPackageVariablePrefix}.REVISION=${finalAttrs.src.tag}"
+ ];
preCheck = ''
# Make the tests pass outside of GitLab CI
export CI=0
'';
- meta = with lib; {
+ # Many tests start servers which bind to ports
+ __darwinAllowLocalNetworking = true;
+
+ postInstall = ''
+ install packaging/root/usr/share/gitlab-runner/clear-docker-cache $out/bin
+ '';
+
+ doInstallCheck = true;
+
+ nativeInstallCheckInputs = [ versionCheckHook ];
+
+ versionCheckProgramArg = "--version";
+
+ passthru = {
+ updateScript = nix-update-script { };
+ };
+
+ meta = {
description = "GitLab Runner the continuous integration executor of GitLab";
- license = licenses.mit;
- homepage = "https://docs.gitlab.com/runner/";
- platforms = platforms.unix ++ platforms.darwin;
- maintainers = with maintainers; [ zimbatm ] ++ teams.gitlab.members;
+ homepage = "https://docs.gitlab.com/runner";
+ license = lib.licenses.mit;
+ mainProgram = "gitlab-runner";
+ maintainers = with lib.maintainers; [ zimbatm ] ++ lib.teams.gitlab.members;
};
-}
+})