1{ lib, buildGoModule, fetchFromGitLab, fetchurl, bash }:
2
3let
4 version = "16.0.1";
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-2z9mB/Dd5sLB2OgwfxUJ5Jfk6cWPc7TfS4WLaUeYDUg=";
21
22 src = fetchFromGitLab {
23 owner = "gitlab-org";
24 repo = "gitlab-runner";
25 rev = "v${version}";
26 sha256 = "sha256-IGMZKrGtDyXj6SIiuoM7NE5MHfRUeVHI4YUNGVNIXw0=";
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 postInstall = ''
53 install packaging/root/usr/share/gitlab-runner/clear-docker-cache $out/bin
54 '';
55
56 preCheck = ''
57 # Make the tests pass outside of GitLab CI
58 export CI=0
59 '';
60
61 meta = with lib; {
62 description = "GitLab Runner the continuous integration executor of GitLab";
63 license = licenses.mit;
64 homepage = "https://about.gitlab.com/gitlab-ci/";
65 platforms = platforms.unix ++ platforms.darwin;
66 maintainers = with maintainers; [ bachp zimbatm globin yayayayaka ];
67 };
68}