Jenkins Job Builder


By: Anisha Narang | @anisha_narang

FOSSASIA, Singapore 2016

Why Jenkins?


Why Jenkins Job Builder?

Installation:


pip install jenkins-job-builder

Execution:

jenkins-jobs test /path/to/jobs.yaml
jenkins-jobs update /path/to/jobs.yaml
jenkins-jobs delete job-name 

Let's write some JJB configurations...

 git clone https://github.com/anarang/jjb
git checkout -b mybranch 571a86bf1f95ea66ef9b42471d12e3a51a392fd7

Configuration:


[job_builder]
ignore_cache=True
include_path=.:scripts
allow_duplicates=False

[jenkins]
#user=jenkins
#password=1234567890abcdef1234567890abcdef
url=http://vm-67-179-132-209.osop.rhcloud.com/
					

Job Definitions

Job definitions for Jenkins Job Builder are kept in YAML files.


- job:
    name: job-name
					

Job Templates

A Job Template has the same syntax as a Job, but you may add variables anywhere in the definition.


- job-template:
    name: test-myname-{env}
    project-type: freestyle
    description: 'Created by Jenkins Job Builder'

- project:
    name: project-name
    env:
        - stage
        - prod
    jobs:
        - test-myname-{env}


Modules


  • parameters/properties
  • scm
  • triggers
  • wrappers
  • builders
  • publishers

Demo

Thank You

@anisha_narang | anarang@redhat.com

Slides available at: http://anarang.github.io/jenkinsjobbuilder