1 Continuous Integration Architecture
2 ===================================
4 In Ceph, we rely on multiple CI pipelines in our development. Most of these pipelines
5 are centered around Jenkins. And their configurations are generated using `Jenkins Job Builder`_.
7 .. _Jenkins Job Builder: https://docs.openstack.org/infra/jenkins-job-builder/
9 Let's take the ``make check`` performed by Jenkins as an example.
14 ``ceph-pull-requests`` is a jenkins job which gets triggered by a GitHub pull
15 request or a trigger phrase like::
17 jenkins test make check
19 There are multiple parties involved in this jenkins job:
26 label="<git> git_repo | <webhooks> webhooks | <api> api";
28 href="https://github.com/ceph/ceph";
30 subgraph cluster_lab {
32 href="https://wiki.sepia.ceph.com/doku.php";
35 href="http://apt-mirror.front.sepia.ceph.com";
38 href="https://shaman.ceph.com";
42 href="https://chacra.ceph.com";
44 subgraph cluster_jenkins {
46 href="https://jenkins.ceph.com";
47 jenkins_controller [ label = "controller" ];
48 jenkins_agents [ label = "agents", peripheries=3 ];
53 package_repos [ peripheries=3 ];
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" ];
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.
76 are a set of machines which perform the CI jobs. In this case, they
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``
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.
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.
97 As the following shows, `chacra`_ manages multiple projects whose metadata
98 are stored in a database. These metadata are exposed via Shaman as a web
99 service. `chacractl`_ is a utility to interact with the `chacra`_ service.
118 shaman -> postgresql;
119 chacra -> postgresql;
123 chacra -> other_repos;
126 .. _Sepia Lab: https://wiki.sepia.ceph.com/doku.php
127 .. _Web UI: https://shaman.ceph.com
132 Just like lots of other software projects, Ceph has both build-time and
133 run-time dependencies. Most of time, we are inclined to use the packages
134 prebuilt by the distro. But there are cases where
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.
142 No matter what the reason is, we either need to build them from source, or
143 to package them as binary packages instead of using the ones shipped by the
144 distro. Quite a few build-time dependencies are included as git submodules,
145 but in order to avoid rebuilding these dependencies repeatedly, we pre-built
146 some 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
148 repos hosting these packages instead of building them.
150 So far, following packages are prebuilt for ubuntu focal, and then uploaded to
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.
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
168 packages `libzbd`_ . The upstream libzbd includes debian packaging already.
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 .
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``.
183 .. _boost: https://www.boost.org
184 .. _libzbd: https://github.com/westerndigitalcorporation/libzbd
185 .. _pmdk: https://github.com/pmem/pmdk
187 But in addition to these libraries, ``ceph-mgr-dashboard``'s frontend uses lots of
188 JavaScript packages. Quite a few of them are not packaged by distros. Not to
189 mention the trouble of testing different combination of versions of these
190 packages. So we decided to include these JavaScript packages in our dist tarball
193 Also, because our downstream might not want to use the prepackaged binaries when
194 redistributing the precompiled Ceph packages, we also need to include these
195 libraries in our dist tarball. They are
201 ``make-dist`` is a script used by our CI pipeline to create dist tarball so the
202 tarball can be used to build the Ceph packages in a clean room environment. When
203 we need to upgrade these third party libraries, we should
205 - update the CMake script
206 - rebuild the prebuilt packages and
207 - update this script to reflect the change.
209 Uploading Dependencies
210 ----------------------
212 To ensure that prebuilt packages are available by the jenkins agents, we need to
213 upload them to either ``apt-mirror.front.sepia.ceph.com`` or `chacra`_. To upload
214 packages to the former would require the help our our lab administrator, so if we
215 want to maintain the package repositories on regular basis, a better choice would be
216 to manage them using `chacractl`_. `chacra`_ represents packages repositories using
217 a resource hierarchy, like::
219 <project>/<branch>/<ref>/<distro>/<distro-version>/<arch>
224 in general, it is used for denoting a set of related packages. For instance,
228 branch of project. This mirrors the concept of a Git repo.
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.
239 the distro name for which the packages are built. Currently, following distros are
249 the version of the distro. For instance, if a package is built on ubuntu focal,
250 the ``distro-version`` should be ``20.04``.
253 the architecture of the packages. It could be:
259 So, for example, we can upload the prebuilt boost packages to chacra like
263 ls *.deb | chacractl binary create \
264 libboost/master/099c0fd56b4a54457e288a2eff8fffdc0d416f7a/ubuntu/focal/amd64/flavors/default
266 .. _chacra: https://github.com/ceph/chacra
267 .. _chacractl: https://github.com/ceph/chacractl
269 Update ``install-deps.sh``
270 --------------------------
272 We also need to update ``install-deps.sh`` to point the built script to the new
273 repo. Please refer to the `script <https://github.com/ceph/ceph/blob/master/install-deps.sh>`_,