From c1b7904af6689bd01646f008b0561d4f19a0e972 Mon Sep 17 00:00:00 2001
From: Sam Gleske <875669+samrocketman@users.noreply.github.com>
Date: Sun, 7 Apr 2019 13:01:39 -0400
Subject: [PATCH] gitignore for JENKINS_HOME Jenkins settings (#1763)

* gitignore for JENKINS_HOME Jenkins settings

This allows an admin to use git to keep a backup of Jenkins settings
without tracking binary artifacts.  Useful for preserving settings during
plugin upgrades.

Note: secret.key is purposefully not tracked by git.  This should be
backed up separately because configs may contain secrets which were
encrypted using the secret.key.

See also:

* http://jenkins-ci.org/
* https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins

* Add a few entries to Jenkins gitignore
---
 JENKINS_HOME.gitignore | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 JENKINS_HOME.gitignore

diff --git a/JENKINS_HOME.gitignore b/JENKINS_HOME.gitignore
new file mode 100644
index 00000000..6df01d62
--- /dev/null
+++ b/JENKINS_HOME.gitignore
@@ -0,0 +1,25 @@
+#Learn more about Jenkins and JENKINS_HOME directory for which this file is intended.
+#  http://jenkins-ci.org/
+#  https://wiki.jenkins-ci.org/display/JENKINS/Administering+Jenkins
+
+#ignore all JENKINS_HOME except jobs directory, root xml config, and .gitignore file
+/*
+!/jobs
+!/.gitignore
+!/*.xml
+
+#ignore all files in jobs subdirectories except for folders
+#note: git doesn't track folders, only file content
+jobs/**
+!jobs/**/
+
+#uncomment the following line to save next build numbers with config
+#!jobs/**/nextBuildNumber
+
+#exclude only config.xml files in repository subdirectories
+!config.xml
+
+#don't track workspaces (when users build on the master)
+jobs/**/*workspace
+
+#as a result only settings and job config.xml files in JENKINS_HOME will be tracked by git