]> git.pld-linux.org Git - packages/gitlab-runner.git/blob - gitlab-ci-multi-runner.spec
up to 1.7.1
[packages/gitlab-runner.git] / gitlab-ci-multi-runner.spec
1 #
2 # Conditional build:
3 %bcond_with     bindata         # embed docker images to binary (upstream compatible)
4
5 # the revision for images
6 # $ git fetch https://gitlab.com/gitlab-org/gitlab-ci-multi-runner refs/tags/v1.6.0
7 # $ git rev-list -n 1 --abbrev-commit FETCH_HEAD
8 #define revision 76fdacd
9 # No changes to image, so don't refetch it
10 %define revision 1.5.2
11 Summary:        The official GitLab CI runner written in Go
12 Name:           gitlab-ci-multi-runner
13 Version:        1.7.1
14 Release:        1
15 License:        MIT
16 Group:          Development/Building
17 Source0:        https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/repository/archive.tar.gz?ref=v%{version}&/%{name}-%{version}.tar.gz
18 # Source0-md5:  ffc78abf7e8aa4aef2778aea14d5e6a0
19 Source1:        https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/master/docker/prebuilt-x86_64.tar.xz
20 # Source1-md5:  0d89c7578a0b5d22a4ae85dcb7d5b4f5
21 Source2:        https://gitlab-ci-multi-runner-downloads.s3.amazonaws.com/master/docker/prebuilt-arm.tar.xz
22 # Source2-md5:  c0533c581624dcb33095f08f06e6a00b
23 Patch0:         nodim_gz.patch
24 Patch1:         branch-preserver.patch
25 URL:            https://gitlab.com/gitlab-org/gitlab-ci-multi-runner
26 BuildRequires:  git-core
27 %{?with_bindata:BuildRequires:  go-bindata >= 3.0.7-1.a0ff2567}
28 BuildRequires:  golang >= 1.4
29 BuildRequires:  rpmbuild(macros) >= 1.202
30 Requires(postun):       /usr/sbin/groupdel
31 Requires(postun):       /usr/sbin/userdel
32 Requires(pre):  /bin/id
33 Requires(pre):  /usr/bin/getgid
34 Requires(pre):  /usr/sbin/groupadd
35 Requires(pre):  /usr/sbin/useradd
36 Requires:       bash
37 Requires:       ca-certificates
38 Requires:       curl
39 Requires:       git-core
40 Requires:       tar
41 Suggests:       docker >= 1.8
42 Provides:       group(gitlab-runner)
43 Provides:       user(gitlab-runner)
44 ExclusiveArch:  %{ix86} %{x8664} %{arm}
45 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
46
47 # go stuff
48 %define _enable_debug_packages 0
49 %define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
50 %define import_path     gitlab.com/gitlab-org/gitlab-ci-multi-runner
51
52 %description
53 This is the official GitLab Runner written in Go. It runs tests and
54 sends the results to GitLab. GitLab CI is the open-source continuous
55 integration service included with GitLab that coordinates the testing.
56
57 %prep
58 %setup -qc
59
60 # for doc
61 mv gitlab-ci-multi-runner-*/*.md .
62
63 # don't you love go?
64 install -d src/$(dirname %{import_path})
65 mv gitlab-ci-multi-runner-* src/%{import_path}
66 cd src/%{import_path}
67
68 %{!?with_bindata:%patch0 -p1}
69 %patch1 -p5
70
71 %if %{with bindata}
72 install -d out/docker
73 ln -s %{SOURCE1} out/docker
74 ln -s %{SOURCE2} out/docker
75 # touch, otherwise make rules would download it nevertheless
76 touch out/docker/prebuilt-*.tar.xz
77 %endif
78
79 # avoid docker being used even if executable found
80 cat <<'EOF' > docker
81 #!/bin/sh
82 echo >&2 "No docker"
83 exit 1
84 EOF
85 chmod a+rx docker
86
87 %build
88 export GOPATH=$(pwd)
89 cd src/%{import_path}
90 export PATH=$(pwd):$PATH
91
92 %if %{with bindata}
93 # build docker bindata. if you forget this, you get such error:
94 # executors/docker/executor_docker.go:180: undefined: Asset
95 %{__make} docker
96 %endif
97
98 %{__make} version | tee version.txt
99
100 CN=gitlab.com/gitlab-org/gitlab-ci-multi-runner/common
101 LDFLAGS="-X $CN.NAME=gitlab-ci-multi-runner -X $CN.VERSION=%{version} -X $CN.REVISION=%{revision}"
102 %gobuild
103
104 # verify that version matches
105 ./gitlab-ci-multi-runner -v > v
106 v=$(awk '$1 == "Version:" {print $2}' v)
107 test "$v" = "%{version}"
108
109 %install
110 rm -rf $RPM_BUILD_ROOT
111 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/gitlab-runner,%{_bindir},/var/lib/gitlab-runner/.gitlab-runner}
112
113 install -p src/%{import_path}/%{name} $RPM_BUILD_ROOT%{_bindir}/gitlab-runner
114
115 # backward compat name for previous pld packaging
116 ln -s gitlab-runner $RPM_BUILD_ROOT%{_bindir}/gitlab-ci-multi-runner
117
118 %if %{without bindata}
119 cp -p %{SOURCE1} $RPM_BUILD_ROOT/var/lib/gitlab-runner
120 cp -p %{SOURCE2} $RPM_BUILD_ROOT/var/lib/gitlab-runner
121 %endif
122
123 %clean
124 rm -rf $RPM_BUILD_ROOT
125
126 %pre
127 %groupadd -g 330 gitlab-runner
128 %useradd -u 330 -d /var/lib/gitlab-runner -g gitlab-runner -c "GitLab Runner" gitlab-runner
129
130 %postun
131 if [ "$1" = "0" ]; then
132         %userremove gitlab-runner
133         %groupremove gitlab-runner
134 fi
135
136 %files
137 %defattr(644,root,root,755)
138 %doc README.md CHANGELOG.md
139 %dir %attr(750,root,root) %{_sysconfdir}/gitlab-runner
140 %attr(755,root,root) %{_bindir}/gitlab-ci-multi-runner
141 %attr(755,root,root) %{_bindir}/gitlab-runner
142 %dir %attr(750,gitlab-runner,gitlab-runner) /var/lib/gitlab-runner
143 %dir %attr(750,gitlab-runner,gitlab-runner) /var/lib/gitlab-runner/.gitlab-runner
144
145 %if %{without bindata}
146 /var/lib/gitlab-runner/prebuilt-arm.tar.xz
147 /var/lib/gitlab-runner/prebuilt-x86_64.tar.xz
148 %endif
This page took 0.042508 seconds and 3 git commands to generate.