This repository contains the files used to setup the CI environment for vnStat testing. The setup is intended for running make check
and other tooling easily for multiple distributions resulting in multiple compiler and library version combinations getting tested.
Triggers to content changes in the actual repository have been intentionally left out. Some content may also unintentionally be missing.
- Docker
- Jenkins with Docker connectivity
- Using latest LTS release is suggested
- Following Jenkins plugins:
- Pipeline
- Docker
- Docker Pipeline
- Git
- File System SCM
- HTML Publisher
- Job DSL
- Warnings Next Generation
- Cppcheck
- Copy Artifact
- Environment Injector
- Sectioned View
- Timestamper
- Optional "nice to have" plugins:
- Job Configuration History
- Rebuilder
Note that not all of the required plugins are visible in the initial startup Jenkins setup wizard.
- Setup Jenkins
- Edit
CI_DIR
injobs/Update_Setup/Jenkinsfile
to match the checkout directory of this repository - Create new Pipeline job named Update_Setup
- Select Pipeline script from SCM and File System for SCM
- Set path to checkout directory +
jobs/Update_Setup
- Keep script path as default (
Jenkinsfile
) - Save
- Build Update_Setup
- This will create rest of the necessary jobs and the vnStat view
- In case of
ERROR: script not yet approved for use
, approve the script and start the job again
- Build Build_Containers
- This will build the Docker containers for several distributions using needed tooling
- Expect this to take some time
- This same job can be used to also update the existing containers
- Build Stage_from_GitHub
- Build Start_Containertests
- Build Stage_from_GitHub
- Build Start_Containertests
Build Build_Containers when necessary to update existing containers.
- The
containers
directory contains the Dockerfiles used for all tested distributions- The
build.sh
script in the directory can be used to build (or update) all or a single Docker image - Created Docker images are named according to the directory of the Dockerfile under
containers
and prefixed withvnstat/
- Each image needs to have the necessary build tools and development libraries installed for compiling vnStat, including the image output and tests + the
lsb_release
command that provides information about the used image (can also be a wrapper script, seealpine:latest
for an example)
- The
- The
jobs
directory contains directories used for creating the Jenkins jobs either directly or acting as templatesgcc_template
is the template used for all jobs usinggcc
as compiler and therefore must be generic enough to work with all imagesgcc_jobs
contains the job -> Docker image mapping- The filename is the name of the job to be created
- The single line in the file is the Docker image name to be used by the job
Update_Setup
contains the Job DSL plugin script for creating and updating all jobs and views
- Not all distributions available as containers are included in cases where the addition would result in an already existing compiler / library combination
- It's unknown if this setup works with anything else than x86-64 containers
- Doxygen plugin isn't included as it lacks pipeline support, HTML Publisher doesn't either provide a full view of the content
- Running Jenkins in a container hasn't been tested
- The number of parallelly running containers can somewhat be controlled by adjusting the number of executors of the Jenkins master
- Trying to use all this from behind a proxy is likely to require changes in several locations
- The vnstat/debian:unstable container has additionally
clang
,clang-tools
andlcov
installed - Stage_from_GitHub is the only job cloning the GitHub repository, all other jobs needing the vnStat archive will copy it from this staging job in order to avoid fetching the same content multiple times