1{ lib, buildGoModule, fetchFromGitLab, fetchurl, bash }:
2
3let
4 version = "16.6.0";
5in
6buildGoModule rec {
7 inherit version;
8 pname = "gitlab-runner";
9
10 commonPackagePath = "gitlab.com/gitlab-org/gitlab-runner/common";
11 ldflags = [
12 "-X ${commonPackagePath}.NAME=gitlab-runner"
13 "-X ${commonPackagePath}.VERSION=${version}"
14 "-X ${commonPackagePath}.REVISION=v${version}"
15 ];
16
17 # For patchShebangs
18 buildInputs = [ bash ];
19
20 vendorHash = "sha256-m0+iAJITX0JfBd5ZboqlcG6eNbPJ35gHa4LV21jX5d8=";
21
22 src = fetchFromGitLab {
23 owner = "gitlab-org";
24 repo = "gitlab-runner";
25 rev = "v${version}";
26 sha256 = "sha256-4N00+yO7Ps0+jy7WmHhm4Eh4MXt3beH00ScZ1RWNByE=";
27 };
28
29 patches = [
30 ./fix-shell-path.patch
31 ./remove-bash-test.patch
32 ];
33
34 prePatch = ''
35 # Remove some tests that can't work during a nix build
36
37 # Requires to run in a git repo
38 sed -i "s/func TestCacheArchiverAddingUntrackedFiles/func OFF_TestCacheArchiverAddingUntrackedFiles/" commands/helpers/file_archiver_test.go
39 sed -i "s/func TestCacheArchiverAddingUntrackedUnicodeFiles/func OFF_TestCacheArchiverAddingUntrackedUnicodeFiles/" commands/helpers/file_archiver_test.go
40
41 # No writable developer environment
42 rm common/build_test.go
43 rm executors/custom/custom_test.go
44
45 # No docker during build
46 rm executors/docker/terminal_test.go
47 rm executors/docker/docker_test.go
48 rm helpers/docker/auth/auth_test.go
49 rm executors/docker/services_test.go
50 '';
51
52 excludedPackages = [
53 # CI helper script for pushing images to Docker and ECR registries
54 # https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/4139
55 "./scripts/sync-docker-images"
56 ];
57
58 postInstall = ''
59 install packaging/root/usr/share/gitlab-runner/clear-docker-cache $out/bin
60 '';
61
62 preCheck = ''
63 # Make the tests pass outside of GitLab CI
64 export CI=0
65 '';
66
67 meta = with lib; {
68 description = "GitLab Runner the continuous integration executor of GitLab";
69 license = licenses.mit;
70 homepage = "https://about.gitlab.com/gitlab-ci/";
71 platforms = platforms.unix ++ platforms.darwin;
72 maintainers = with maintainers; [ bachp zimbatm ] ++ teams.gitlab.members;
73 };
74}