Answers: <p>It <em>might</em> be possible, depending on your version control system.</p>
  
  <p>In Git, for example, for a dir structure like this:</p>
  
  <pre><code>dir_in_question/
    .git/
    .gitignore
    builds/
    config.xml
  </code></pre>
  
  <p>I can prevent git from seeing any of the changes under the <code>builds</code> directory simply by adding inside <code>.gitignore</code> (which I prefer to add to the git as well) this line:</p>
  
  <pre><code>builds/
  </code></pre>
  
  <p>Another thing to try would be to make <code>builds</code> 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 :)</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-08-22T22:44:59.070Z
Answers: I'm aware of that approach but would prefer to do a "hard" separation on disk
Answers: amphibient
Answers: CC BY-SA 3.0
Answers: 2017-08-22T22:50:53.893Z
Answers: see updated answer
Answers: Dan Cornilescu
Answers: CC BY-SA 3.0
Answers: 2017-08-22T22:38:39.033Z
Answers: 2017-08-22T22:50:37.693Z
Answers: 2017-08-22T22:50:37.693Z
Answers: Dan Cornilescu
Answers: <p>If you're interested in only backing up configs, try installing the <a href="https://wiki.jenkins.io/display/JENKINS/SCM+Sync+configuration+plugin" rel="nofollow noreferrer">SCM Sync Configuration Plugin</a>. This plugin syncs with a repo each time you change either a job or the Jenkins configs, but does not keep builds.</p>
  <blockquote>
  <p>SCM Sync Configuration Jenkins/Hudson plugin is aimed at 2 main features :</p>
  <p>Keep sync'ed your config.xml (and other ressources) jenkins/hudson files with a SCM repository</p>
  <p>Track changes (and author) made on every file with commit messages</p>
  </blockquote>
  <p>As a bonus you can set it to take a commit message each time you change a job, for easier restoration if necessary.</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-08-23T14:38:06.410Z
Answers: yeah -- this looks pretty awesome
Answers: amphibient
Answers: CC BY-SA 3.0
Answers: 2017-08-23T12:10:59.153Z
Answers: 2017-08-23T12:10:59.153Z
Answers: 2020-06-18T08:28:10.803Z
Answers: Alex
Body: <p>My <code>JENKINS_HOME</code> is (something like) <em>/var/lib/jenkins</em></p>
  
  <p>In there, there is <em>jobs</em> directory, in it a subdirectory for each job. In each job subdirectory, you have <code>config.xml</code> plus the <em>builds</em> subdirectory.</p>
  
  <p>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.</p>
  
  <p>Is there a way to separate just the job configs from the build logs in the filesystem?</p>
  
Tags: <jenkins>
Title: Separate Jenkins config from build logs
UserDisplayName: amphibient
ThreadText: # Separate Jenkins config from build logs
  
  (Asked by: username_0 on 2017-08-22)
  
  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?
  
  **Tags:** jenkins
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2017-08-23. Score: 4 | Accepted answer
  
  If you're interested in only backing up configs, try installing the [SCM Sync Configuration Plugin](https://wiki.jenkins.io/display/JENKINS/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.
  
  > **Comments:**
  > **username_0**: yeah -- this looks pretty awesome  
  
  ---
  
  ### Answer by username_1 on 2017-08-22. Score: 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 :)
  
  > **Comments:**
  > **username_0**: I'm aware of that approach but would prefer to do a "hard" separation on disk  
  > **username_1**: see updated answer  
  
  ---
  
  