This file contains hidden or 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
| #!/bin/bash | |
| # Jenkins Configuraitons Directory | |
| cd $JENKINS_HOME | |
| # Add general configurations, job configurations, and user content | |
| git add -- *.xml jobs/*/*.xml userContent/* ansible/* | |
| # only add user configurations if they exist | |
| if [ -d users ]; then | |
| user_configs=`ls users/*/config.xml` |
This file contains hidden or 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
| Some Jenkinsfile examples |
For this example i shall be using a dedicated server from Hertzner.https://www.hetzner.de/en/. A shout out to hetzner if your looking for cheap and beefy dedicated hosting then these guys are your best bet.
This guide assumes your server has Debian 8 (Jessie installed)
This file contains hidden or 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
| #!/bin/bash | |
| # Copies certain kinds of known files and directories from a given Jenkins master directory | |
| # into a git repo, removing any old ones, adds 'em, commits 'em, pushes 'em. | |
| set -ex | |
| if [ $# -ne 3 ]; then | |
| echo usage: $0 jenkins_home git_repos_url git_repos_name | |
| exit 1 | |
| fi |
This file contains hidden or 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
| #!/bin/bash | |
| # | |
| # Copies certain kinds of known files and directories from a given Jenkins master directory | |
| # into a git repo, removing any old ones, adds 'em, commits 'em, pushes 'em. | |
| # | |
| set -ex | |
| if [ $# -ne 2 ]; then | |
| echo usage: $0 root_dir jenkins_master |
This file contains hidden or 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
| Checking in/out: | |
| $ git clone [project url] - get a copy of repo in a folder | |
| $ git checkout [file] - check out last committed version of a file | |
| $ git add --patch [file] - Step through each section of changes in a file with option to stage or not stage | |
| $ git remote rm origin - remove origin | |
| $ git remote add origin [url] - add origin | |
| Working with Branches: | |
| $ git branch [foo] - create branch named foo |