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?

2 Answers 2

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.

1
  • yeah -- this looks pretty awesome
    – amphibient
    Commented Aug 23, 2017 at 14:38
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 :)

2
  • I'm aware of that approach but would prefer to do a "hard" separation on disk
    – amphibient
    Commented Aug 22, 2017 at 22:44
  • see updated answer Commented Aug 22, 2017 at 22:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.