# About
This project contains code to build, install and test [systemd](https://github.com/systemd/systemd/)
on test machines provisioned from a pool provided by the [CentOS CI](https://wiki.centos.org/QaWiki/CI) project,
using their [Duffy](https://wiki.centos.org/QaWiki/CI/Duffy) API.
As of right now these scripts provide CI for [upstream](https://github.com/systemd/systemd)
on CentOS 7 and Arch Linux, and for [RHEL downstream](https://github.com/systemd-rhel)
on both CentOS 7 and CentOS 8.
# Structure
The main entrypoint is the `agent-control.py` script, which is responsible for
getting a provisioned machine from the Duffy pool, run the respective CI scripts,
and gather results. To make this work with GitHub pull requests, the `jenkins/`
directory contains *glue* scripts which generate a correct set of arguments for
the `agent-control.py` script for each PR.
The CI scripts are scattered among several directories:
* `agent/`
Bootstrap and test runner scripts used to run tests directly on the provisioned
machines (i.e. for running tests on CentOS 7 and CentOS 8).
* `common/`
Various *libraries* and support functions used by other scripts.
* `jenkins/`
Scripts which are responsible for feeding `agent-control.py` correct parameters
based on data from the Jenkins GitHub plugin.
These scripts are used directly in the *Execute shell* step of each Jenkins job
in following manner:
```bash
#!/bin/sh
set -e
curl -q -o runner.sh https://raw.githubusercontent.com/systemd/systemd-centos-ci/master/jenkins/runners/upstream-centos7.sh
chmod +x runner.sh
./runner.sh
```
* `utils/`
Various utility scripts used by the pipeline.
* `vagrant/`
Setup, build, and test runner scripts to test systemd on other distributions than CentOS
using Vagrant VMs.
# Pipelines
Jenkins instance: https://jenkins-systemd.apps.ocp.ci.centos.org/
## Upstream on CentOS 7 (upstream-centos7)
```
agent-control.py +-> agent/bootstrap.sh +-> reboot +-> agent/testsuite.sh
```
To test compatibility of the upstream systemd with older kernels, this job builds, installs, and
tests an upstream PR on a CentOS 7 baremetal machine.
To achieve this, `agent-control.py` runs `agent/bootstrap.sh` script to fetch, build, and install
the respective PR (along with other necessary dependencies), reboots the machine, and executes
`agent/testsuite.sh` to to the actual testing.
## Downstream (RHEL) on CentOS 7 and CentOS 8 (rhel7-centos7 and rhel8-centos8)
The same worklflow as above, but for systemd in RHEL:
* [RHEL 7/CentOS 7](https://github.com/systemd-rhel/rhel-7)
```
agent-control.py +-> agent/bootstrap-rhel7.sh +-> reboot +-> agent/testsuite-rhel7.sh
```
* [RHEL 8/CentOS 8](https://github.com/systemd-rhel/rhel-8)
```
agent-control.py +-> agent/bootstrap-rhel8.sh +-> reboot +-> agent/testsuite-rhel8.sh
```
## Upstream on Arch Linux using Vagrant (upstream-vagrant-archlinux)
To achieve the exact opposite of the testing on CentOS 7, this pipeline check the compatibility
of systemd with the latest versions of kernel and other components. As the CentOS CI
pool provides only CentOS machines, this pipeline introduces an intermediary in form of
a [Vagrant](https://www.vagrantup.com) VM along with [vagrant-libvirt](https://github.com/vagrant-libvirt/vagrant-libvirt)
plugin to spin up a virtual machine in which we do the actual testing.
### Structure
Each VM consists of two images: the base image (Vagrant Box) and a runtime image.
Vagrant Box templates are stored under `vagrant/boxes/` and the images themselves
are rebuilt every few days by a separate job to keep the package set up-to-date,
but to not slow down the CI pipeline.
The templates for each VM used in the CI can be found in `vagrant/vagrantfiles/`.
As the majority of the current (single) Vagrantfile remains identical across several
instances of the VMs except for the bootstrap phase, the bootstrap scripts were
separated into their own directory - `vagrant/bootstrap_script/` and the Vagrantfile
itself is now parametrized, to avoid code duplication.
### Pipeline
```
agent-control.py +-> vagrant/vagrant-ci-wrapper.sh +-> vagrant/vagrant-build.sh +-> reboot +-> vagrant/vagrant-test.sh
+ ^ + ^
| | | |
v + v +
vagrant/vagrant-setup.sh vagrant/vagrantfiles/Vagrantfile_<distro>
+ ^
| |
v +
vagrant/bootstrap-scripts/<distro>-<type>.sh
```
The pipeline consists of several steps (scripts):
1. `vagrant/vagrant-ci-wrapper.sh`
This script acts as a bootstrap where it checks out the systemd repository
on a revision based on information passed down by the respective Jenkins
glue script, configures the underlying system for Vagrant (by calling
`vagrant/vagrant-setup.sh`) and the test suite, and starts the VM build process
by executing `vagrant/vagrant-build.sh`
2. `vagrant/vagrant-build.sh`
Builds a *runtime* VM image based on the base one (Vagrant Box). The Vagrantfile
for each VM (`vagrant/vagrantfiles/`) can reference an external bootstrap script
(`vagrant/bootstrap_scripts/`) making itself reusable for multiple different
scenarios.
When the VM is built, the local systemd repo is mounted into it over NFS
and the bootstrap script is executed, which builds the checked out revision
and makes other necessary changes to the VM itself.
After this step the VM is rebooted (*reloaded* in the Vagrant terms) and the
test runner script (`vagrant/vagrant-test.sh`) is executed inside.
## Upstream on Arch Linux with sanitizers using Vagrant (upstream-vagrant-archlinux-sanitizers)
To tackle the question of security a little bit, this job does *almost* the same thing
as the one above, but here systemd is compiled with [Address Sanitizer](https://github.com/google/sanitizers/wiki/AddressSanitizer)
and [Undefined Behavior Sanitizer](https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html). In this
case we skip the *reboot* step of the pipeline and replace the `vagrant/vagrant-test.sh` script
with `vagrant/vagrant-test-sanitizer.sh` one, as running the test suite under
sanitizers is a little bit trickier and limited. See the respective scripts for more
information.
## (Auxiliary) Rebuild the Vagrant images (vagrant-make-cache)
```
agent-control.py +-> vagrant/vagrant-make-cache.sh
```
To keep the images up-to-date but to not slow every CI pipeline down while doing so,
this job's sole purpose is to rebuild the base images (Vagrant Boxes) every few days
(based on Jenkins cron) and upload it to the artifacts server, where it can be
used by the respective Vagrantfile.
## (Auxiliary) Mirror the Copr repo with CentOS 7 dependencies (centos7-reposync)
```
utils/reposync.sh
```
As CentOS 7 is quite old, upstream systemd won't work/compile there without further help.
To amend this, we have a [Copr repo](https://copr.fedorainfracloud.org/coprs/mrc0mmand/systemd-centos-ci/)
with necessary (newer) build/runtime dependencies (specfiles for these packages
can be found in their [dedicated repository](https://github.com/systemd/systemd-centos-ci-specs)).
However, we found out that the infrastructure Copr is running in is quite unreliable
so a fair share of our jobs was failing just because they couldn't install dependencies.
Having a local mirror in the CentOS CI infrastructure definitely helps in this case and
the purpose of this script is to update it every few hours (again, using Jenkins cron).
## (Auxiliary) CI for the CI repository (ci-build)
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
关于 该项目包含使用项目提供的池(使用其 API)在测试机器上配置,构建,安装和测试代码。 目前,这些脚本为CentOS 7和Arch Linux的提供了CI,并为CentOS 7和CentOS 8的提供了 。 结构体 主要入口点是agent-control.py脚本,该脚本负责从Duffy池中获取配置的计算机,运行相应的CI脚本并收集结果。 为了与GitHub拉取请求一起使用, jenkins/目录包含粘合脚本,该脚本为每个PR的agent-control.py脚本生成一组正确的参数。 CI脚本分散在几个目录中: agent/ 引导程序和测试运行程序脚本用于直接在已配置的机器上运行测试(即,用于在CentOS 7和CentOS 8上运行测试)。 common/ 其他脚本使用的各种库和支持功能。 jenkins/ 负责根据Jenkins GitHub插件中的数据提供给agent-control.py正确参数的脚本。 这些脚本可通过以下方式直接在每个Jenkins作业的Execute shell步骤中使用: #! /bin/sh set -e curl -q -o r
资源详情
资源评论
资源推荐
收起资源包目录
systemd-centos-ci-master.zip (39个子文件)
systemd-centos-ci-master
.gitignore 16B
agent-control.py 19KB
utils
generate-index.sh 4KB
artifacts-copy-file.sh 1KB
reposync.sh 3KB
README.md 8KB
jenkins
runners
upstream-vagrant-archlinux.sh 1KB
rhel7-centos7.sh 666B
upstream-vagrant-rawhide-selinux.sh 556B
rhel8-centos8.sh 2KB
upstream-cron-build.sh 1014B
upstream-vagrant-archlinux-sanitizers.sh 2KB
upstream-centos7.sh 1KB
vagrant-make-cache.sh 2KB
LICENSE.LGPL2.1 26KB
common
task-control.sh 9KB
utils.sh 10KB
agent
testsuite-rhel8.sh 6KB
testsuite-rhel7.sh 2KB
bootstrap.sh 10KB
testsuite.sh 6KB
bootstrap-rhel8.sh 7KB
bootstrap-rhel7.sh 3KB
vagrant
test_scripts
test-arch.sh 7KB
test-arch-sanitizers-clang.sh 9KB
test-rawhide-selinux.sh 921B
test-arch-sanitizers-gcc.sh 29B
vagrant-ci-wrapper.sh 2KB
boxes
Vagrantfile_archlinux_systemd 3KB
Vagrantfile_rawhide_selinux 1KB
vagrantfiles
Vagrantfile_rawhide 2KB
Vagrantfile_arch 2KB
vagrant-build.sh 6KB
vagrant-make-cache.sh 5KB
bootstrap_scripts
arch-sanitizers-gcc.sh 3KB
arch-sanitizers-clang.sh 3KB
arch.sh 2KB
rawhide-selinux.sh 2KB
vagrant-setup.sh 5KB
共 39 条
- 1
谢平凡
- 粉丝: 17
- 资源: 4598
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论1