_images/autojobs-logo-expanded.png

Introduction

Jenkins-autojobs is a set of scripts that automatically create Jenkins jobs from template jobs and the branches in an SCM repository. Jenkins-autojobs supports Git, Mercurial and Subversion.

A routine run goes through the following steps:

  • Read settings from a configuration file.
  • List branches or refs from SCM.
  • Creates or updates jobs as configured.

In its most basic form, the configuration file specifies:

  • How to access Jenkins and the SCM repository.
  • Which branches to process and which to ignore.
  • Which template job to use for which branches.
  • How new jobs should be named.

Autojobs can also:

  • Add newly created jobs to Jenkins views.
  • Cleanup jobs for which a branch no longer exists.
  • Perform text substitutions on all text elements of a job’s config.xml.
  • Update jobs when their template job is updated.
  • Set the enabled/disabled state of new jobs. A new job can inherit the state of its template job, but an updated job can keep its most recent state.

Please refer to the tutorial and the example output to get started. You may also have a look at the annotated git, svn and hg config files.

Notice: The documentation is in the process of being completely rewritten. Things may seem incomplete and out of place.

Installing

The latest stable version of jenkins-autojobs can be installed from pypi using pip.

$ pip install jenkins-autojobs

Jenkins-autojobs depends on a version of lxml with support for XML canonicalization (c14n). Setup will attempt to install one if it is not present on your system. You might have to install the libxml and libxslt development headers if you haven’t already done so:

On a Debian compatible OS:

$ apt-get install libxml2-dev libxslt1-dev

On a Redhat compatible OS:

$ yum install libxml2-devel libxslt-devel

On Arch Linux or derivatives:

$ pacman -S libxslt libxml2

Development

License

Jenkins-autojobs is released under the terms of the Revised BSD License. All figures are derived from the Jenkins logo and are released under the CC BY-SA 3.0 license.