1{ lib, buildGoModule, fetchFromGitLab, bash }:
2
3let
4 version = "17.2.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-1MwHss76apA9KoFhEU6lYiUACrPMGYzjhds6nTyNuJI=";
21
22 src = fetchFromGitLab {
23 owner = "gitlab-org";
24 repo = "gitlab-runner";
25 rev = "v${version}";
26 hash = "sha256-a2Igy4DS3fYTvPW1vvDrH/DjMQ4lG9cm/P3mFr+y9s4=";
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 common/build_settings_test.go
44 rm executors/custom/custom_test.go
45
46 # No docker during build
47 rm executors/docker/terminal_test.go
48 rm executors/docker/docker_test.go
49 rm helpers/docker/auth/auth_test.go
50 rm executors/docker/services_test.go
51 '';
52
53 excludedPackages = [
54 # CI helper script for pushing images to Docker and ECR registries
55 # https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/4139
56 "./scripts/sync-docker-images"
57 ];
58
59 postInstall = ''
60 install packaging/root/usr/share/gitlab-runner/clear-docker-cache $out/bin
61 '';
62
63 preCheck = ''
64 # Make the tests pass outside of GitLab CI
65 export CI=0
66 '';
67
68 meta = with lib; {
69 description = "GitLab Runner the continuous integration executor of GitLab";
70 license = licenses.mit;
71 homepage = "https://docs.gitlab.com/runner/";
72 platforms = platforms.unix ++ platforms.darwin;
73 maintainers = with maintainers; [ bachp zimbatm ] ++ teams.gitlab.members;
74 };
75}