A short presentation about our experience of using Jenkins and Jenkins Job Builder with Vagrant as a backend tool to manage complex environment (tens of virtual machines for every test run) for database proxy server testing.
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
Managing big test environment and running tests with Jenkins, Jenkins Job builder + Vagrant: our experience
1. Managing big test
environment and
running tests with
Jenkins, Jenkins Job
Builder + Vagrant
Our experience
Open Source
and Linux Lab
OSLL
2. Our setup: why is it so complex to run test?
• Product to build and test: Maxscale – database proxy, lots of plugins (routers, filters,
protocols, etc, etc, etc)
• Integration tests, Performance tests, “scientific experiments”
• Test environment:
– at least 9 VM (1 Maxscale server, 4 Master/Slave servers, 4-servers Galera cluster)
– libvirt/qemu, AWS virtual machines + Docker containers
– need to configure backend for every test run
– need to carefully clean up
• 12 Linux distributions, 3 major MariaDB version, 2 major MySQL version, a lot of
Maxscale plugins – any combination should be testable
• dependency on VM provider: it can easily FAIL
3. What does it mean for test management system?
• Lots of parameters for every test job
• Cascades of jobs: e.g. prepare backend, install Maxscale, run test, cleanup
• Error processing (e.g. backend VMs preparation failure) – how to do cleanup in this
case?
• Matrix jobs: test a lot of combinations of distros, backend MariaDB version, backend
parameters
• very dynamic setup
We wanted to put all test system into GIT repository
4. MariaDB Server uses BuildBot!
• not very popular tool with limited support
• lots of complains from MariaDB Server team
• but
– it has been in use from very beginning (since middle of 90th
)
– do we want different tools for every our product?
– there are many useful scripts for BuildBot
5. Jenkins
• “hey guys, you can of cause try” and “do not disturb our BuildBot guy too much”
• Parameterized Trigger Plugin
• matrix jobs
• well, UI
6. Jenkins Job Builder
• A tool from OpenStack developers https://docs.openstack.org/infra/jenkins-job-builder/
• YAML
• Pipelines did not exist when we started
• our jobs: https://github.com/mariadb-corporation/maxscale-jenkins-jobs
7. What can we get from JJB?
• All our jobs (>60) are represented as a code (branches, forks, review, pull requests, …)
• Parameters values are in one place for all jobs (easy maintenance of parameters defaults
and lists)
• Automatic validation of jobs takes place at every push to jobs repo
• very easy jobs deployment
• at the beginning: app. 20 jobs, we spent 1 week to convert to JJB code (1.5 persons)
13. Problems
• No parametrized !include
• a bit tricky to put right number of spaces in the beginning of every line (YAML problem)
• can not delete job automatically (rename case)
• Jenkins plugins have to be installed manually
• Views have to be configured manually
Jenkins CLI can solve it!
14. Problem number one: VM management
• obvious idea: “Create VM” job – run it 9 times (Matrix job)
– e.g. Amazon cloud: 8 of 10 attempts to create 9 VM fail! (out of our control)
– VM creation/provision restart management
– performance vs robustness problem
– too complex Vagrantfile
• so, Jenkins can not help! Own tool created: wrapper over Vagrant – MDBCI
https://github.com/mariadb-corporation/mdbci
• Jenkins only triggers 'mdbci up'
15. Problem number one: VM management
• “Setup Environment” job leaves running VMs: job can got stuck
– VM provider tool got stuck (timeouts?)
– ssh got stuck (started daemon, output from daemon blocks ssh, etc)
• Matrix job cancellation: leaves of lot of artifacts running
– our sub-jobs cleaning script
https://github.com/mariadb-corporation/maxscale-jenkins-jobs/tree/master/maxscale_jo
bs/include/parametrized_triggerred_subjobs_killer
– no easy solution for VMs: need to use VM provider tools (sometimes manually)
16. Problem number two: run test, report result
• Jenkins: all “run_test” jobs are the
same in the list
• any search engine in Jenkins?
• our solution:
– report email
– test script puts results into …
MariaDB, developers query DB
by writing SQL manually
17. Problem number two: run test, report result
• “run_test” throttle: test run is long, several runs on one host can cause trouble
• “Throttle Concurrent Builds Plugin” (build_all and run_test_matrix examples)
– we want: e.g. 5 'build' running on the node, one onle 'build_all' on the node, but several
'build_all' can be running on several nodes – i.e. different settings form 'build_all' and
sub-jobs ('build') – plugin can't do it (or can it?)
– matrix-configs: true – need to use categories from global Jenkins config (does not work if
throttle parameters defined in the job definition – plugin bug? JJB bug?)
– more flexibility wanted: throttle parameters should depend on 'run_test' parameters
18. Problem number three: server state monitoring
• monitoring jobs triggered by timer
• email warnings
19. Full automatic deployment
(our tool deployment out of scope now)
• load config
• install plugins
• load jobs
• configure views
Jenkins CLI
Ooops!
Jenkins Remote
CLI Vulnerability
Our Jenkins master was hacked,
bitcoin mining was running on it
only CLI via SSH is enabled now,
Jenkins bind to local host (use SSH tunnel)
20. Our additions
• simple wrapper to load jobs https://github.com/OSLL/jjg.git
– adds timestamps and git commit ID to job description
– easier way to manage Jenkins creds
– manage Views ('description' contains reference to 'View' to put the job)
• Job Visualizer (not ready yet, but working)
https://github.com/OSLL/jenkins_job_builder_visualization
Authors:
Evgeny Bovykin rebovykin@gmail.com
Mark Zaslavskiy mark.zaslavskiy@gmail.com
21. Job Visualizer: Call Graph
●
Do you call all the jobs
correctly?
●
Do you have cyclic
dependencies?
23. Plans
• full automatic deployment
• move Jenkins to VM or container
• try JobDSL (via JJB?)
• BuildBot is still in the view
• results visualization: plugin? 3rd
party tool? something own?
24. MariaDB Maxscale
Continuous Integration
Open Source
and Linux Lab
OSLL
in cooperation with
Open Source
and Linux Lab
Open Innovations Association FRUCT
and
http://fruct.org/
https://osllblog.wordpress.com/
https://mariadb.com/products/mariadb-maxscale
timofey.turenko@mariadb.com
Mark Zaslavskiy <mark.zaslavskiy@gmail.com>
Sergey Balandin <Sergey.Balandin@fruct.org>