]>
Commit | Line | Data |
---|---|---|
1 | Summary: The official GitLab CI runner written in Go | |
2 | Name: gitlab-runner | |
3 | Version: 10.0.0 | |
4 | Release: 1 | |
5 | License: MIT | |
6 | Group: Development/Building | |
7 | Source0: https://gitlab.com/gitlab-org/gitlab-runner/repository/archive.tar.gz?ref=v%{version}&/%{name}-%{version}.tar.gz | |
8 | # Source0-md5: 767648a99974adf7c4efd4106f9afe69 | |
9 | Source3: %{name}.init | |
10 | Source4: %{name}.sysconfig | |
11 | Source5: %{name}.service | |
12 | Patch0: nodim_gz.patch | |
13 | Patch1: branch-preserver.patch | |
14 | URL: https://gitlab.com/gitlab-org/gitlab-runner | |
15 | BuildRequires: git-core | |
16 | BuildRequires: golang >= 1.6 | |
17 | BuildRequires: rpmbuild(macros) >= 1.647 | |
18 | Requires(post,preun): /sbin/chkconfig | |
19 | Requires(post,preun,postun): systemd-units >= 38 | |
20 | Requires(postun): /usr/sbin/groupdel | |
21 | Requires(postun): /usr/sbin/userdel | |
22 | Requires(pre): /bin/id | |
23 | Requires(pre): /usr/bin/getgid | |
24 | Requires(pre): /usr/sbin/groupadd | |
25 | Requires(pre): /usr/sbin/useradd | |
26 | Requires: bash | |
27 | Requires: ca-certificates | |
28 | Requires: git-core | |
29 | Requires: rc-scripts | |
30 | Requires: systemd-units >= 0.38 | |
31 | Requires: tar | |
32 | Suggests: docker >= 1.8 | |
33 | Suggests: gitlab-ci-multi-runner-image-arm | |
34 | Suggests: gitlab-ci-multi-runner-image-x86_64 | |
35 | Provides: group(gitlab-runner) | |
36 | Provides: user(gitlab-runner) | |
37 | ExclusiveArch: %{ix86} %{x8664} %{arm} | |
38 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) | |
39 | ||
40 | # go stuff | |
41 | %define _enable_debug_packages 0 | |
42 | %define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v %{?debug:-x} %{?**}; | |
43 | %define import_path gitlab.com/gitlab-org/gitlab-runner | |
44 | ||
45 | %description | |
46 | This is the official GitLab Runner written in Go. It runs tests and | |
47 | sends the results to GitLab. GitLab CI is the open-source continuous | |
48 | integration service included with GitLab that coordinates the testing. | |
49 | ||
50 | %prep | |
51 | %setup -qc | |
52 | ||
53 | # for doc | |
54 | mv gitlab-runner-*/*.md . | |
55 | ||
56 | # don't you love go? | |
57 | install -d src/$(dirname %{import_path}) | |
58 | mv gitlab-runner-* src/%{import_path} | |
59 | cd src/%{import_path} | |
60 | ||
61 | %patch0 -p5 | |
62 | %patch1 -p1 | |
63 | ||
64 | # avoid docker being used even if executable found | |
65 | cat <<'EOF' > docker | |
66 | #!/bin/sh | |
67 | echo >&2 "No docker" | |
68 | exit 1 | |
69 | EOF | |
70 | chmod a+rx docker | |
71 | ||
72 | %build | |
73 | export GOPATH=$(pwd) | |
74 | cd src/%{import_path} | |
75 | export PATH=$(pwd):$PATH | |
76 | ||
77 | %{__make} version | tee version.txt | |
78 | ||
79 | CN=gitlab.com/gitlab-org/gitlab-runner/common | |
80 | LDFLAGS="-X $CN.NAME=gitlab-runner -X $CN.VERSION=%{version} -X $CN.REVISION=%{version}" | |
81 | %gobuild | |
82 | ||
83 | # verify that version matches | |
84 | ./gitlab-runner -v > v | |
85 | v=$(awk '$1 == "Version:" {print $2}' v) | |
86 | test "$v" = "%{version}" | |
87 | ||
88 | %install | |
89 | rm -rf $RPM_BUILD_ROOT | |
90 | install -d $RPM_BUILD_ROOT{%{_sysconfdir}/gitlab-runner,%{_bindir},/etc/{rc.d/init.d,sysconfig},%{systemdunitdir},/var/lib/gitlab-runner/.gitlab-runner} | |
91 | ||
92 | install -p src/%{import_path}/%{name} $RPM_BUILD_ROOT%{_bindir}/gitlab-runner | |
93 | install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name} | |
94 | cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/%{name} | |
95 | cp -p %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir} | |
96 | ||
97 | %clean | |
98 | rm -rf $RPM_BUILD_ROOT | |
99 | ||
100 | %pre | |
101 | %groupadd -g 330 gitlab-runner | |
102 | %useradd -u 330 -d /var/lib/gitlab-runner -g gitlab-runner -c "GitLab Runner" gitlab-runner | |
103 | ||
104 | %postun | |
105 | if [ "$1" = "0" ]; then | |
106 | %userremove gitlab-runner | |
107 | %groupremove gitlab-runner | |
108 | fi | |
109 | %systemd_reload | |
110 | ||
111 | %post | |
112 | /sbin/chkconfig --add %{name} | |
113 | %service %{name} restart | |
114 | %systemd_post %{name}.service | |
115 | ||
116 | %preun | |
117 | if [ "$1" = "0" ]; then | |
118 | %service -q %{name} stop | |
119 | /sbin/chkconfig --del %{name} | |
120 | fi | |
121 | %systemd_preun %{name}.service | |
122 | ||
123 | %files | |
124 | %defattr(644,root,root,755) | |
125 | %doc README.md CHANGELOG.md | |
126 | %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/gitlab-runner | |
127 | %attr(754,root,root) /etc/rc.d/init.d/gitlab-runner | |
128 | %dir %attr(750,root,root) %{_sysconfdir}/gitlab-runner | |
129 | %attr(755,root,root) %{_bindir}/gitlab-runner | |
130 | %{systemdunitdir}/gitlab-runner.service | |
131 | %dir %attr(750,gitlab-runner,gitlab-runner) /var/lib/gitlab-runner | |
132 | %dir %attr(750,gitlab-runner,gitlab-runner) /var/lib/gitlab-runner/.gitlab-runner |