]> git.pld-linux.org Git - packages/gitlab-runner.git/blob - gitlab-ci-multi-runner.spec
440760c42ae962c0245f0f1e0380d4338ca7c24b
[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.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 Source3:        %{name}.init
24 Source4:        %{name}.sysconfig
25 Source5:        %{name}.service
26 Patch0:         nodim_gz.patch
27 Patch1:         branch-preserver.patch
28 URL:            https://gitlab.com/gitlab-org/gitlab-ci-multi-runner
29 BuildRequires:  git-core
30 %{?with_bindata:BuildRequires:  go-bindata >= 3.0.7-1.a0ff2567}
31 BuildRequires:  golang >= 1.4
32 BuildRequires:  rpmbuild(macros) >= 1.202
33 Requires(postun):       /usr/sbin/groupdel
34 Requires(postun):       /usr/sbin/userdel
35 Requires(pre):  /bin/id
36 Requires(pre):  /usr/bin/getgid
37 Requires(pre):  /usr/sbin/groupadd
38 Requires(pre):  /usr/sbin/useradd
39 Requires:       bash
40 Requires:       ca-certificates
41 Requires:       curl
42 Requires:       git-core
43 Requires:       tar
44 Suggests:       docker >= 1.8
45 Provides:       group(gitlab-runner)
46 Provides:       user(gitlab-runner)
47 ExclusiveArch:  %{ix86} %{x8664} %{arm}
48 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
49
50 # go stuff
51 %define _enable_debug_packages 0
52 %define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
53 %define import_path     gitlab.com/gitlab-org/gitlab-ci-multi-runner
54
55 %description
56 This is the official GitLab Runner written in Go. It runs tests and
57 sends the results to GitLab. GitLab CI is the open-source continuous
58 integration service included with GitLab that coordinates the testing.
59
60 %prep
61 %setup -qc
62
63 # for doc
64 mv gitlab-ci-multi-runner-*/*.md .
65
66 # don't you love go?
67 install -d src/$(dirname %{import_path})
68 mv gitlab-ci-multi-runner-* src/%{import_path}
69 cd src/%{import_path}
70
71 %{!?with_bindata:%patch0 -p1}
72 %patch1 -p5
73
74 %if %{with bindata}
75 install -d out/docker
76 ln -s %{SOURCE1} out/docker
77 ln -s %{SOURCE2} out/docker
78 # touch, otherwise make rules would download it nevertheless
79 touch out/docker/prebuilt-*.tar.xz
80 %endif
81
82 # avoid docker being used even if executable found
83 cat <<'EOF' > docker
84 #!/bin/sh
85 echo >&2 "No docker"
86 exit 1
87 EOF
88 chmod a+rx docker
89
90 %build
91 export GOPATH=$(pwd)
92 cd src/%{import_path}
93 export PATH=$(pwd):$PATH
94
95 %if %{with bindata}
96 # build docker bindata. if you forget this, you get such error:
97 # executors/docker/executor_docker.go:180: undefined: Asset
98 %{__make} docker
99 %endif
100
101 %{__make} version | tee version.txt
102
103 CN=gitlab.com/gitlab-org/gitlab-ci-multi-runner/common
104 LDFLAGS="-X $CN.NAME=gitlab-ci-multi-runner -X $CN.VERSION=%{version} -X $CN.REVISION=%{revision}"
105 %gobuild
106
107 # verify that version matches
108 ./gitlab-ci-multi-runner -v > v
109 v=$(awk '$1 == "Version:" {print $2}' v)
110 test "$v" = "%{version}"
111
112 %install
113 rm -rf $RPM_BUILD_ROOT
114 install -d $RPM_BUILD_ROOT{%{_sysconfdir}/gitlab-runner,%{_bindir},/etc/{rc.d/init.d,sysconfig},%{systemdunitdir},/var/lib/gitlab-runner/.gitlab-runner}
115
116 install -p src/%{import_path}/%{name} $RPM_BUILD_ROOT%{_bindir}/gitlab-runner
117 install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
118 cp -p %{SOURCE4} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
119 cp -p %{SOURCE5} $RPM_BUILD_ROOT%{systemdunitdir}
120
121 # backward compat name for previous pld packaging
122 ln -s gitlab-runner $RPM_BUILD_ROOT%{_bindir}/gitlab-ci-multi-runner
123
124 %if %{without bindata}
125 cp -p %{SOURCE1} $RPM_BUILD_ROOT/var/lib/gitlab-runner
126 cp -p %{SOURCE2} $RPM_BUILD_ROOT/var/lib/gitlab-runner
127 %endif
128
129 %clean
130 rm -rf $RPM_BUILD_ROOT
131
132 %pre
133 %groupadd -g 330 gitlab-runner
134 %useradd -u 330 -d /var/lib/gitlab-runner -g gitlab-runner -c "GitLab Runner" gitlab-runner
135
136 %postun
137 if [ "$1" = "0" ]; then
138         %userremove gitlab-runner
139         %groupremove gitlab-runner
140 fi
141
142 %files
143 %defattr(644,root,root,755)
144 %doc README.md CHANGELOG.md
145 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/gitlab-ci-multi-runner
146 %attr(754,root,root) /etc/rc.d/init.d/gitlab-ci-multi-runner
147 %dir %attr(750,root,root) %{_sysconfdir}/gitlab-runner
148 %attr(755,root,root) %{_bindir}/gitlab-ci-multi-runner
149 %attr(755,root,root) %{_bindir}/gitlab-runner
150 %{systemdunitdir}/gitlab-ci-multi-runner.service
151 %dir %attr(750,gitlab-runner,gitlab-runner) /var/lib/gitlab-runner
152 %dir %attr(750,gitlab-runner,gitlab-runner) /var/lib/gitlab-runner/.gitlab-runner
153
154 %if %{without bindata}
155 /var/lib/gitlab-runner/prebuilt-arm.tar.xz
156 /var/lib/gitlab-runner/prebuilt-x86_64.tar.xz
157 %endif
This page took 0.034095 seconds and 2 git commands to generate.