What is Gerrit?
Code hosting (git frontend)
What is a hook?
For each workflow step (event) a script gets executed
Default gerrit hooks flaws:
Solution:
Build a dispatcher!
What?
Label: label content
Where?
Commit message
Comment
Example:
Bug-Url: http://mytracker/bugid
Rerun-Hooks: all
Hook name template:
${event}.${chain}.${hook_name}
${event}.${hook_name}
${event}
INFO::STARTING::change-merged
DEBUG::get_hooks::change-merged on vdsm.git/hooks
INFO::::AVAILABLE HOOKS::[
'change-merged.set_MODIFIED',
'change-merged.update_tracker']
Each hook can:
Everything to logfile (configurable):
Common stdout format (each section is optional):
V:VERIFIED SCORE\n
R:REVIEW SCORE\n
COMMENT
Sum of all the reviews:
Execution summary of all the hooks:
Patches are always welcome!
Some simple generic libs available for the hooks:
source bz.sh
source gerrit.sh
gerrit.parse_params "$@" # Sets the parameters into global vars
# get the bug ids in the commit message of the commit passed as
# parameter (--commit SHA)
bug_ids=($(bz.get_bug_id "$commit"))
from gerrit import Gerrit
from config import load_config
config = load_config() ## Loads the config hierarchicaly into a dict
gerrit = Gerrit(config.get('GERRIT_SRV')) ## Connect to the gerrit instance
Update external tracker in bugzilla
Modify bug status when first patch sent
Problems with manual configuration
...
Add an extra scm to jobs for projects A, B and C
New branch for project M, duplicate all it's jobs
Disable all the jobs for a project
Test a job configuration before deploying
Jenkins job Builder to the rescue!
Some plugins that helped along the way:
Matrix configurations
Configuration slice
Job Config history
Scriptler
- job-group:
name: projectA
dist:
- fc19
- fc20
jobs:
- '{name}-wahtever-{dist}'
- job-template:
name: '{name}-whatever-{dist}'
node: 'slave-{dist}'
triggers:
- timed: '@midnight'
builders:
- shell: make whatever
publishers:
- archive:
artifacts: '*.log'
Oh! But I want to add a new distro, el6
- job-group:
name: projectA
dist:
- fc19
- fc20
- el6
jobs:
- '{name}-wahtever-{dist}'
And a cleanup after
- job-template:
name: '{name}-whatever-{dist}'
node: 'slave-{dist}'
triggers:
- timed: '@midnight'
builders:
- shell: make whatever
- shell: make clean
publishers:
- archive:
artifacts: '*.log'
Official Openstack links:
Docs:
Code:
oVirt links
yum -y install copr-cli
copr-cli build vdsm http://jenkins.ovirt.org/view/vdsm-4.14.10-11.git1081e76.el6.src.rpm
Scarce resources
Isolate test environments
Leverage package builds