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/ceph/ceph-boost.
158 See https://github.com/ceph/ceph-boost/commit/2a8ae02932b2a1fd6a68072da8ca0df2b99b805c
159 for an example of how to bump the version number. The commands used to
160 build 1.79 on a vanilla Ubuntu Focal OS are below.
164 sudo apt install debhelper dctrl-tools chrpath libbz2-dev libicu-dev bison \
165 flex docbook-to-man help2man xsltproc doxygen dh-python python3-all-dev graphviz
166 wget http://download.ceph.com/qa/boost_1_79_0.tar.bz2
167 git clone https://github.com/ceph/ceph-boost
168 tar xjf boost_1_79_0.tar.bz2
169 cp -ra ceph-boost/debian boost_1_79_0/
171 export DEB_BUILD_OPTIONS='parallel=6 nodoc'
172 dpkg-buildpackage -us -uc -b
174 BOOST_SHA=$(git ls-remote https://github.com/ceph/ceph-boost main | awk '{ print $1 }')
175 ls *.deb | chacractl binary create \
176 libboost/master/$BOOST_SHA/ubuntu/focal/amd64/flavors/default
179 packages `libzbd`_ . The upstream libzbd includes debian packaging already.
182 packages `pmdk`_ . Please note, ``ndctl`` is one of the build dependencies of
183 pmdk, for an updated debian packaging, please see
184 https://github.com/ceph/ceph-ndctl .
188 please ensure that the package version and the release number of the
189 packaging are properly updated when updating/upgrading the packaging,
190 otherwise it would be difficult to tell which version of the package
191 is installed. We check the package version before trying to upgrade
192 it in ``install-deps.sh``.
194 .. _boost: https://www.boost.org
195 .. _libzbd: https://github.com/westerndigitalcorporation/libzbd
196 .. _pmdk: https://github.com/pmem/pmdk
198 But in addition to these libraries, ``ceph-mgr-dashboard``'s frontend uses lots of
199 JavaScript packages. Quite a few of them are not packaged by distros. Not to
200 mention the trouble of testing different combination of versions of these
201 packages. So we decided to include these JavaScript packages in our dist tarball
204 Also, because our downstream might not want to use the prepackaged binaries when
205 redistributing the precompiled Ceph packages, we also need to include these
206 libraries in our dist tarball. They are
212 ``make-dist`` is a script used by our CI pipeline to create dist tarball so the
213 tarball can be used to build the Ceph packages in a clean room environment. When
214 we need to upgrade these third party libraries, we should
216 - update the CMake script
217 - rebuild the prebuilt packages and
218 - update this script to reflect the change.
220 Uploading Dependencies
221 ----------------------
223 To ensure that prebuilt packages are available by the jenkins agents, we need to
224 upload them to either ``apt-mirror.front.sepia.ceph.com`` or `chacra`_. To upload
225 packages to the former would require the help our our lab administrator, so if we
226 want to maintain the package repositories on regular basis, a better choice would be
227 to manage them using `chacractl`_. `chacra`_ represents packages repositories using
228 a resource hierarchy, like::
230 <project>/<branch>/<ref>/<distro>/<distro-version>/<arch>
235 in general, it is used for denoting a set of related packages. For instance,
239 branch of project. This mirrors the concept of a Git repo.
242 a unique id of a given version of a set packages. This id is used to reference
243 the set packages under the ``<project>/<branch>``. It is a good practice to
244 version the packaging recipes, like the ``debian`` directory for building deb
245 packages and the ``spec`` for building rpm packages, and use the sha1 of the
246 packaging receipe for the ``ref``. But you could also use a random string for
247 ``ref``, like the tag name of the built source tree.
250 the distro name for which the packages are built. Currently, following distros are
260 the version of the distro. For instance, if a package is built on ubuntu focal,
261 the ``distro-version`` should be ``20.04``.
264 the architecture of the packages. It could be:
270 So, for example, we can upload the prebuilt boost packages to chacra like
274 ls *.deb | chacractl binary create \
275 libboost/master/099c0fd56b4a54457e288a2eff8fffdc0d416f7a/ubuntu/focal/amd64/flavors/default
277 .. _chacra: https://github.com/ceph/chacra
278 .. _chacractl: https://github.com/ceph/chacractl
280 Update ``install-deps.sh``
281 --------------------------
283 We also need to update ``install-deps.sh`` to point the built script to the new
284 repo. Please refer to the `script <https://github.com/ceph/ceph/blob/master/install-deps.sh>`_,