Is there a way to keep Hudson / Jenkins configuration files in source control? Is there a way to keep Hudson / Jenkins configuration files in source control? jenkins jenkins

Is there a way to keep Hudson / Jenkins configuration files in source control?


Most helpful Answer

There is a plugin called SCM Sync configuration plugin.


Original Answer

Have a look at my answer to a similar question. The basic idea is to use the filesystem-scm-plugin to detect changes to the xml-files. Your second part would be committing the changes to SVN.

EDIT: If you find a way to determine the user for a change, let us know.

EDIT 2011-01-10 Meanwhile there is a new plugin: SCM Sync configuration plugin. Currently it only works with subversion and git, but support for more repositories is planned. I am using it since version 0.0.3 and it worked good so far.


Note that Vogella has a recent (January 2014, compared to the OP's question January 2010) and different take on this.
Consider that the SCM Sync configuration plugin can generate a lot of commits.
So, instead of relying on a plugin and an automated process, he manages the same feature manually:

Storing the Job information of Jenkins in Git

I found the amount of commits a bit overwhelming, so I decided to control the commits manually and to save only the Job information and not the Jenkins configuration.
For this switch into your Jenkins jobs directory (Ubuntu: /var/lib/jenkins/jobs) and perform the “git init” command.

I created the following .gitignore file to store only the Git jobs information:

builds/workspace/lastStablelastSuccessfulnextBuildNumbermodules/*.log

Now you can add and commit changes at your own will.
And if you add another remote to your Git repository you can push your configuration to another server.

Alberto actually recommend to add as well (in $JENKINS_HOME):

  • jenkins own config (config.xml),
  • the jenkins plugins configs (hudson*.xml) and
  • the users configs (users/*/config.xml)


To manually manage your configuration with Git, the following .gitignore file may be helpful.

# Miscellaneous Hudson litter*.log*.tmp*.old*.bak*.jar*.json# Generated Hudson state/.owner/secret.key/queue.xml/fingerprints//shelvedProjects//updates/# Tools that Hudson manages/tools/# Extracted plugins/plugins/*/# Job statebuilds/workspace/lastStablelastSuccessfulnextBuildNumber

See this GitHub Gist and this blog post for more details.