7

My JENKINS_HOME is (something like) /var/lib/jenkins

In there, there is jobs directory, in it a subdirectory for each job. In each job subdirectory, you have config.xml plus the builds subdirectory.

I would like to somehow separate my config.xml from the same file structure that contains builds so that I can check them in my version control but to not clutter its view by having all the build logs that each execution writes. If I change a job config, the corresponding config.xml is changed and I can (actually in a Jenkins job) check it in my version control automatically or if I change it manually in a text editor, it gets checked out and deployed. But I don't want the builds in the version management.

Is there a way to separate just the job configs from the build logs in the filesystem?

amphibient
  • 453
  • 5
  • 12

2 Answers2

4

If you're interested in only backing up configs, try installing the SCM Sync Configuration Plugin. This plugin syncs with a repo each time you change either a job or the Jenkins configs, but does not keep builds.

SCM Sync Configuration Jenkins/Hudson plugin is aimed at 2 main features :

Keep sync'ed your config.xml (and other ressources) jenkins/hudson files with a SCM repository

Track changes (and author) made on every file with commit messages

As a bonus you can set it to take a commit message each time you change a job, for easier restoration if necessary.

Alex
  • 4,512
  • 6
  • 27
  • 47
2

It might be possible, depending on your version control system.

In Git, for example, for a dir structure like this:

dir_in_question/
  .git/
  .gitignore
  builds/
  config.xml

I can prevent git from seeing any of the changes under the builds directory simply by adding inside .gitignore (which I prefer to add to the git as well) this line:

builds/

Another thing to try would be to make builds a symlink to a location outside the version control system, typically another filesystem. As a side effect you'd gain protection against builds filling up the jenkins' filesystem :)

Dan Cornilescu
  • 6,730
  • 2
  • 19
  • 44