Skip to content

Instantly share code, notes, and snippets.

@gotunandan
Forked from hfs/.gitignore
Created October 23, 2019 14:19
Show Gist options
  • Save gotunandan/000a31ff60fce9ee0457de840a5a9cec to your computer and use it in GitHub Desktop.
Save gotunandan/000a31ff60fce9ee0457de840a5a9cec to your computer and use it in GitHub Desktop.
How to keep Jenkins configurations in a git repository. Put .gitignore in Jenkins’ home directory (/var/lib/jenkins). Initialize a git repository and add a remote to push to. Create a new Jenkins job to run e.g. nightly with the content of backup.sh as shell execution build step.
# Non-config file types
*.log
*.log.*
*.tmp
*.old
*.bak
*.jar
*.jpi
*.jpi.pinned
*.json
# Security related
/.ssh
/secret.key*
/secrets
/credentials.xml
/identity.key
# Generated Jenkins state
/.owner
/queue.xml
/fingerprints/
/shelvedProjects/
/updates/
# Tools that Jenkins manages
/tools/
/cache/
# Extracted plugins
/plugins/*/
# Job state
builds/
workspace/
lastStable
lastSuccessful
nextBuildNumber
modules/
# Interactive shell stuff
.bash_history
/.vim*
.lesshst
.Xauthority
# Package cache
/.gradle/caches
/.ivy2/
/.m2/
/.node-gyp/
/.npm/
/.sbt/
# TFS plugin
/.microsoft
# FOP cache
/.fop
# Fontconfig cache
/.cache
# Move into the Jenkins master directory
cd $JENKINS_HOME
# Add all new, changed and deleted files
# Unwanted files must be listed in .gitignore
git add --all
# Commit, and ignore if the commit is empty
git commit -m "Jenkins config change" || true
# Push changes outside of the Jenkins directory
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment