-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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