]> git.proxmox.com Git - ceph.git/blame - ceph/doc/dev/continuous-integration.rst
import quincy beta 17.1.0
[ceph.git] / ceph / doc / dev / continuous-integration.rst
CommitLineData
20effc67
TL
1Continuous Integration Architecture
2===================================
3
4In Ceph, we rely on multiple CI pipelines in our development. Most of these pipelines
5are centered around Jenkins. And their configurations are generated using `Jenkins Job Builder`_.
6
7.. _Jenkins Job Builder: https://docs.openstack.org/infra/jenkins-job-builder/
8
9Let's take the ``make check`` performed by Jenkins as an example.
10
11ceph-pull-requests
12------------------
13
14``ceph-pull-requests`` is a jenkins job which gets triggered by a GitHub pull
15request or a trigger phrase like::
16
17 jenkins test make check
18
19There are multiple parties involved in this jenkins job:
20
21.. graphviz::
22
23 digraph {
24 rankdir="LR";
25 github [
26 label="<git> git_repo | <webhooks> webhooks | <api> api";
27 shape=record;
28 href="https://github.com/ceph/ceph";
29 ];
30 subgraph cluster_lab {
31 label="Sepia Lab";
32 href="https://wiki.sepia.ceph.com/doku.php";
33 shape=circle;
34 apt_mirror [
35 href="http://apt-mirror.front.sepia.ceph.com";
36 ];
37 shaman [
38 href="https://shaman.ceph.com";
39 ];
40 chacra [
41 peripheries=3;
42 href="https://chacra.ceph.com";
43 ];
44 subgraph cluster_jenkins {
45 label="jenkins";
46 href="https://jenkins.ceph.com";
47 jenkins_controller [ label = "controller" ];
48 jenkins_agents [ label = "agents", peripheries=3 ];
49 };
50 };
51 {
52 rank=same;
53 package_repos [ peripheries=3 ];
54 pypi;
55 npm;
56 }
57 github:webhooks -> jenkins_controller [ label = "notify", color = "crimson" ];
58 jenkins_controller -> jenkins_agents [ label = "schedule jobs" ];
59 jenkins_agents -> github:git [ label = "git pull" ];
60 jenkins_agents -> shaman [ label = "query for chacra repo URL" ];
61 jenkins_agents -> chacra [ label = "pull build dependencies" ];
62 jenkins_agents -> package_repos [ label = "pull build dependencies" ];
63 jenkins_agents -> pypi [ label = "pull Python packages" ];
64 jenkins_agents -> npm [ label = "pull JavaScript packages" ];
65 jenkins_agents -> apt_mirror [ label = "pull build dependencies" ];
66 jenkins_agents -> github:api [ label = "update", color = "crimson" ];
67 }
68
69Where
70
71Sepia Lab
72 `Sepia Lab`_ is a test lab used by the Ceph project. This lab offers
73 the storage and computing resources required by our CI infra.
74
75Jenkins agents
76 are a set of machines which perform the CI jobs. In this case, they
77
78 #. pull the git repo from GitHub and
79 #. rebase the pull request against the latest master
80 #. set necessary environment variables
81 #. run ``run-make-check.sh``
82
83Chacra
84 is a server offering RESTful API allowing the clients to store and
85 retrieve binary packages. It also creates the repo for uploaded
86 packages automatically. Once a certain repo is created on chacra, the
87 configured shaman server is updated as well, then we can query shaman
88 for the corresponding repo address. Chacra not only hosts Ceph packages,
89 it also hosts quite a few other packages like various build dependencies.
90
91Shaman
92 is a server offering RESTful API allowing the clients to query the
93 information of repos hosted by chacra nodes. Shaman is also known
94 for its `Web UI`_. But please note, shaman does not build the
95 packages, it just offers information on the builds.
96
97As the following shows, `chacra`_ manages multiple projects whose metadata
98are stored in a database. These metadata are exposed via Shaman as a web
99service. `chacractl`_ is a utility to interact with the `chacra`_ service.
100
101.. graphviz::
102
103 digraph {
104 libboost [
105 shape=cylinder;
106 ];
107 libzbd [
108 shape=cylinder;
109 ];
110 other_repos [
111 label="...";
112 shape=cylinder;
113 ];
114 postgresql [
115 shape=cylinder;
116 style=filled;
117 ]
118 shaman -> postgresql;
119 chacra -> postgresql;
120 chacractl -> chacra;
121 chacra -> libboost;
122 chacra -> libzbd;
123 chacra -> other_repos;
124 }
125
126.. _Sepia Lab: https://wiki.sepia.ceph.com/doku.php
127.. _Web UI: https://shaman.ceph.com
128
129build dependencies
130------------------
131
132Just like lots of other software projects, Ceph has both build-time and
133run-time dependencies. Most of time, we are inclined to use the packages
134prebuilt by the distro. But there are cases where
135
136- the necessary dependencies are either missing in the distro, or
137- their versions are too old, or
138- they are packaged without some important feature enabled.
139- we want to ensure that the version of a certain runtime dependency is
140 identical to the one we tested in our lab.
141
142No matter what the reason is, we either need to build them from source, or
143to package them as binary packages instead of using the ones shipped by the
144distro. Quite a few build-time dependencies are included as git submodules,
145but in order to avoid rebuilding these dependencies repeatedly, we pre-built
146some of them and uploaded them to our own repos. So, when performing
147``make check``, the building hosts in our CI just pull them from our internal
148repos hosting these packages instead of building them.
149
150So far, following packages are prebuilt for ubuntu focal, and then uploaded to
151`chacra`_:
152
153libboost
154 packages `boost`_. The packages' names are changed from ``libboost-*`` to
155 ``ceph-libboost-*``, and they are instead installed into ``/opt/ceph``, so
156 they don't interfere with the official ``libboost`` packages shipped by
157 distro. Its build scripts are hosted at https://github.com/tchaikov/ceph-boost.
158
159 .. prompt:: bash $
160
161 tar xjf boost_1_76_0.tar.bz2
162 git clone https://github.com/ceph/ceph-boost
163 cp -ra ceph-boost/debian boost_1_76_0/
164 export DEB_BUILD_OPTIONS='parallel=6 nodoc'
165 dpkg-buildpackage -us -uc -b
166
167libzbd
168 packages `libzbd`_ . The upstream libzbd includes debian packaging already.
169
170libpmem
171 packages `pmdk`_ . Please note, ``ndctl`` is one of the build dependencies of
172 pmdk, for an updated debian packaging, please see
173 https://github.com/ceph/ceph-ndctl .
174
175.. note::
176
177 please ensure that the package version and the release number of the
178 packaging are properly updated when updating/upgrading the packaging,
179 otherwise it would be difficult to tell which version of the package
180 is installed. We check the package version before trying to upgrade
181 it in ``install-deps.sh``.
182
183.. _boost: https://www.boost.org
184.. _libzbd: https://github.com/westerndigitalcorporation/libzbd
185.. _pmdk: https://github.com/pmem/pmdk
186
187But in addition to these libraries, ``ceph-mgr-dashboard``'s frontend uses lots of
188JavaScript packages. Quite a few of them are not packaged by distros. Not to
189mention the trouble of testing different combination of versions of these
190packages. So we decided to include these JavaScript packages in our dist tarball
191using ``make-dist``.
192
193Also, because our downstream might not want to use the prepackaged binaries when
194redistributing the precompiled Ceph packages, we also need to include these
195libraries in our dist tarball. They are
196
197- boost
198- liburing
199- pmdk
200
201``make-dist`` is a script used by our CI pipeline to create dist tarball so the
202tarball can be used to build the Ceph packages in a clean room environment. When
203we need to upgrade these third party libraries, we should
204
205- update the CMake script
206- rebuild the prebuilt packages and
207- update this script to reflect the change.
208
209Uploading Dependencies
210----------------------
211
212To ensure that prebuilt packages are available by the jenkins agents, we need to
213upload them to either ``apt-mirror.front.sepia.ceph.com`` or `chacra`_. To upload
214packages to the former would require the help our our lab administrator, so if we
215want to maintain the package repositories on regular basis, a better choice would be
216to manage them using `chacractl`_. `chacra`_ represents packages repositories using
217a resource hierarchy, like::
218
219 <project>/<branch>/<ref>/<distro>/<distro-version>/<arch>
220
221In which:
222
223project
224 in general, it is used for denoting a set of related packages. For instance,
225 ``libboost``.
226
227branch
228 branch of project. This mirrors the concept of a Git repo.
229
230ref
231 a unique id of a given version of a set packages. This id is used to reference
232 the set packages under the ``<project>/<branch>``. It is a good practice to
233 version the packaging recipes, like the ``debian`` directory for building deb
234 packages and the ``spec`` for building rpm packages, and use the sha1 of the
235 packaging receipe for the ``ref``. But you could also use a random string for
236 ``ref``, like the tag name of the built source tree.
237
238distro
239 the distro name for which the packages are built. Currently, following distros are
240 supported:
241
242 - centos
243 - debian
244 - fedora
245 - rhel
246 - ubuntu
247
248distro-version
249 the version of the distro. For instance, if a package is built on ubuntu focal,
250 the ``distro-version`` should be ``20.04``.
251
252arch
253 the architecture of the packages. It could be:
254
255 - arm64
256 - amd64
257 - noarch
258
259So, for example, we can upload the prebuilt boost packages to chacra like
260
261.. prompt:: bash $
262
263 ls *.deb | chacractl binary create \
264 libboost/master/099c0fd56b4a54457e288a2eff8fffdc0d416f7a/ubuntu/focal/amd64/flavors/default
265
266.. _chacra: https://github.com/ceph/chacra
267.. _chacractl: https://github.com/ceph/chacractl
268
269Update ``install-deps.sh``
270--------------------------
271
272We also need to update ``install-deps.sh`` to point the built script to the new
273repo. Please refer to the `script <https://github.com/ceph/ceph/blob/master/install-deps.sh>`_,
274for more details.