]> git.pld-linux.org Git - packages/gitlab-runner.git/blame_incremental - gitlab-runner.spec
rename to gitlab-runner as upstream, version 10.0
[packages/gitlab-runner.git] / gitlab-runner.spec
... / ...
CommitLineData
1Summary: The official GitLab CI runner written in Go
2Name: gitlab-runner
3Version: 10.0.0
4Release: 1
5License: MIT
6Group: Development/Building
7Source0: https://gitlab.com/gitlab-org/gitlab-runner/repository/archive.tar.gz?ref=v%{version}&/%{name}-%{version}.tar.gz
8# Source0-md5: 767648a99974adf7c4efd4106f9afe69
9Source3: %{name}.init
10Source4: %{name}.sysconfig
11Source5: %{name}.service
12Patch0: nodim_gz.patch
13Patch1: branch-preserver.patch
14URL: https://gitlab.com/gitlab-org/gitlab-runner
15BuildRequires: git-core
16BuildRequires: golang >= 1.6
17BuildRequires: rpmbuild(macros) >= 1.647
18Requires(post,preun): /sbin/chkconfig
19Requires(post,preun,postun): systemd-units >= 38
20Requires(postun): /usr/sbin/groupdel
21Requires(postun): /usr/sbin/userdel
22Requires(pre): /bin/id
23Requires(pre): /usr/bin/getgid
24Requires(pre): /usr/sbin/groupadd
25Requires(pre): /usr/sbin/useradd
26Requires: bash
27Requires: ca-certificates
28Requires: git-core
29Requires: rc-scripts
30Requires: systemd-units >= 0.38
31Requires: tar
32Suggests: docker >= 1.8
33Suggests: gitlab-ci-multi-runner-image-arm
34Suggests: gitlab-ci-multi-runner-image-x86_64
35Provides: group(gitlab-runner)
36Provides: user(gitlab-runner)
37ExclusiveArch: %{ix86} %{x8664} %{arm}
38BuildRoot: %{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
46This is the official GitLab Runner written in Go. It runs tests and
47sends the results to GitLab. GitLab CI is the open-source continuous
48integration service included with GitLab that coordinates the testing.
49
50%prep
51%setup -qc
52
53# for doc
54mv gitlab-runner-*/*.md .
55
56# don't you love go?
57install -d src/$(dirname %{import_path})
58mv gitlab-runner-* src/%{import_path}
59cd src/%{import_path}
60
61%patch0 -p5
62%patch1 -p1
63
64# avoid docker being used even if executable found
65cat <<'EOF' > docker
66#!/bin/sh
67echo >&2 "No docker"
68exit 1
69EOF
70chmod a+rx docker
71
72%build
73export GOPATH=$(pwd)
74cd src/%{import_path}
75export PATH=$(pwd):$PATH
76
77%{__make} version | tee version.txt
78
79CN=gitlab.com/gitlab-org/gitlab-runner/common
80LDFLAGS="-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
85v=$(awk '$1 == "Version:" {print $2}' v)
86test "$v" = "%{version}"
87
88%install
89rm -rf $RPM_BUILD_ROOT
90install -d $RPM_BUILD_ROOT{%{_sysconfdir}/gitlab-runner,%{_bindir},/etc/{rc.d/init.d,sysconfig},%{systemdunitdir},/var/lib/gitlab-runner/.gitlab-runner}
91
92install -p src/%{import_path}/%{name} $RPM_BUILD_ROOT%{_bindir}/gitlab-runner
93install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
94cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
95cp -p %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}
96
97%clean
98rm -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
105if [ "$1" = "0" ]; then
106 %userremove gitlab-runner
107 %groupremove gitlab-runner
108fi
109%systemd_reload
110
111%post
112/sbin/chkconfig --add %{name}
113%service %{name} restart
114%systemd_post %{name}.service
115
116%preun
117if [ "$1" = "0" ]; then
118 %service -q %{name} stop
119 /sbin/chkconfig --del %{name}
120fi
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
This page took 1.921143 seconds and 4 git commands to generate.