]>
Commit | Line | Data |
---|---|---|
72cef35a | 1 | |
3e1b3fba | 2 | # the revision for images |
ec0a53a6 ER |
3 | # $ git fetch https://gitlab.com/gitlab-org/gitlab-ci-multi-runner refs/tags/v1.6.0 |
4 | # $ git rev-list -n 1 --abbrev-commit FETCH_HEAD | |
5 | #define revision 76fdacd | |
6 | # No changes to image, so don't refetch it | |
7 | %define revision 1.5.2 | |
c5c6476d ER |
8 | Summary: The official GitLab CI runner written in Go |
9 | Name: gitlab-ci-multi-runner | |
5d178ba2 ER |
10 | Version: 1.8.0 |
11 | Release: 1 | |
b306b97b | 12 | License: MIT |
c5c6476d ER |
13 | Group: Development/Building |
14 | Source0: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner/repository/archive.tar.gz?ref=v%{version}&/%{name}-%{version}.tar.gz | |
5d178ba2 | 15 | # Source0-md5: aed7c89fb2d0fa9c61c97d0206cc048b |
af21cb3e ER |
16 | Source3: %{name}.init |
17 | Source4: %{name}.sysconfig | |
18 | Source5: %{name}.service | |
72cef35a | 19 | Patch0: nodim_gz.patch |
c4affa20 | 20 | Patch1: branch-preserver.patch |
c5c6476d ER |
21 | URL: https://gitlab.com/gitlab-org/gitlab-ci-multi-runner |
22 | BuildRequires: git-core | |
dfe9a179 | 23 | BuildRequires: golang >= 1.6 |
98c01f80 ER |
24 | BuildRequires: rpmbuild(macros) >= 1.647 |
25 | Requires(post,preun): /sbin/chkconfig | |
26 | Requires(post,preun,postun): systemd-units >= 38 | |
fbac930f ER |
27 | Requires(postun): /usr/sbin/groupdel |
28 | Requires(postun): /usr/sbin/userdel | |
29 | Requires(pre): /bin/id | |
30 | Requires(pre): /usr/bin/getgid | |
31 | Requires(pre): /usr/sbin/groupadd | |
32 | Requires(pre): /usr/sbin/useradd | |
d20ff300 | 33 | Requires: bash |
c5c6476d | 34 | Requires: ca-certificates |
c5c6476d | 35 | Requires: git-core |
98c01f80 ER |
36 | Requires: rc-scripts |
37 | Requires: systemd-units >= 0.38 | |
c5c6476d | 38 | Requires: tar |
ff1d3f82 | 39 | Suggests: docker >= 1.8 |
5d178ba2 ER |
40 | Suggests: gitlab-ci-multi-runner-image-arm |
41 | Suggests: gitlab-ci-multi-runner-image-x86_64 | |
fbac930f ER |
42 | Provides: group(gitlab-runner) |
43 | Provides: user(gitlab-runner) | |
4ffe1735 | 44 | ExclusiveArch: %{ix86} %{x8664} %{arm} |
c5c6476d ER |
45 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
46 | ||
4ffe1735 ER |
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 %{?**}; | |
7ad949a0 | 50 | %define import_path gitlab.com/gitlab-org/gitlab-ci-multi-runner |
4ffe1735 | 51 | |
c5c6476d ER |
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 | |
c5c6476d | 59 | |
7ad949a0 ER |
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} | |
bf2084d5 | 67 | |
5d178ba2 | 68 | %patch0 -p1 |
dfe9a179 | 69 | %patch1 -p1 |
72cef35a | 70 | |
a0a05733 ER |
71 | # avoid docker being used even if executable found |
72 | cat <<'EOF' > docker | |
73 | #!/bin/sh | |
74 | echo >&2 "No docker" | |
75 | exit 1 | |
76 | EOF | |
77 | chmod a+rx docker | |
78 | ||
c5c6476d | 79 | %build |
7ad949a0 ER |
80 | export GOPATH=$(pwd) |
81 | cd src/%{import_path} | |
a0a05733 | 82 | export PATH=$(pwd):$PATH |
bf2084d5 | 83 | |
69a70248 | 84 | %{__make} version | tee version.txt |
d16d4f3d | 85 | |
7ad949a0 ER |
86 | CN=gitlab.com/gitlab-org/gitlab-ci-multi-runner/common |
87 | LDFLAGS="-X $CN.NAME=gitlab-ci-multi-runner -X $CN.VERSION=%{version} -X $CN.REVISION=%{revision}" | |
4ffe1735 | 88 | %gobuild |
c5c6476d | 89 | |
f81cac35 | 90 | # verify that version matches |
7ad949a0 | 91 | ./gitlab-ci-multi-runner -v > v |
f81cac35 ER |
92 | v=$(awk '$1 == "Version:" {print $2}' v) |
93 | test "$v" = "%{version}" | |
69a70248 | 94 | |
c5c6476d ER |
95 | %install |
96 | rm -rf $RPM_BUILD_ROOT | |
af21cb3e | 97 | install -d $RPM_BUILD_ROOT{%{_sysconfdir}/gitlab-runner,%{_bindir},/etc/{rc.d/init.d,sysconfig},%{systemdunitdir},/var/lib/gitlab-runner/.gitlab-runner} |
770719bc | 98 | |
7ad949a0 | 99 | install -p src/%{import_path}/%{name} $RPM_BUILD_ROOT%{_bindir}/gitlab-runner |
af21cb3e ER |
100 | install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} |
101 | cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/%{name} | |
102 | cp -p %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir} | |
fbac930f | 103 | |
c2bf33c4 ER |
104 | # backward compat name for previous pld packaging |
105 | ln -s gitlab-runner $RPM_BUILD_ROOT%{_bindir}/gitlab-ci-multi-runner | |
c5c6476d ER |
106 | |
107 | %clean | |
108 | rm -rf $RPM_BUILD_ROOT | |
109 | ||
fbac930f ER |
110 | %pre |
111 | %groupadd -g 330 gitlab-runner | |
112 | %useradd -u 330 -d /var/lib/gitlab-runner -g gitlab-runner -c "GitLab Runner" gitlab-runner | |
113 | ||
114 | %postun | |
115 | if [ "$1" = "0" ]; then | |
116 | %userremove gitlab-runner | |
117 | %groupremove gitlab-runner | |
118 | fi | |
98c01f80 ER |
119 | %systemd_reload |
120 | ||
121 | %post | |
122 | /sbin/chkconfig --add %{name} | |
123 | %service %{name} restart | |
124 | %systemd_post %{name}.service | |
125 | ||
126 | %preun | |
127 | if [ "$1" = "0" ]; then | |
128 | %service -q %{name} stop | |
129 | /sbin/chkconfig --del %{name} | |
130 | fi | |
131 | %systemd_preun %{name}.service | |
fbac930f | 132 | |
c5c6476d ER |
133 | %files |
134 | %defattr(644,root,root,755) | |
135 | %doc README.md CHANGELOG.md | |
af21cb3e ER |
136 | %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/gitlab-ci-multi-runner |
137 | %attr(754,root,root) /etc/rc.d/init.d/gitlab-ci-multi-runner | |
770719bc | 138 | %dir %attr(750,root,root) %{_sysconfdir}/gitlab-runner |
4ffe1735 | 139 | %attr(755,root,root) %{_bindir}/gitlab-ci-multi-runner |
c2bf33c4 | 140 | %attr(755,root,root) %{_bindir}/gitlab-runner |
af21cb3e | 141 | %{systemdunitdir}/gitlab-ci-multi-runner.service |
fbac930f | 142 | %dir %attr(750,gitlab-runner,gitlab-runner) /var/lib/gitlab-runner |
dd56a935 | 143 | %dir %attr(750,gitlab-runner,gitlab-runner) /var/lib/gitlab-runner/.gitlab-runner |