A continuous integration tool written in Java. Continuous integration is the process of merging development work among multiple developers. It also serves to automate unit testing and I am certain other types of testing in test driven development.
To simplify all that, it is build automation and in my opinion an automated deployment system (preferably for testing, q&a and staging).
- Works with Git
- Webhook from git can build/deploy/test after each commit
- Multiple plugins available to integrate with development tools/project management
- Web Interface…I guess this is a pro
- Can employ scripts to run after successful builds
- Rollback…not sure…
- REST API
Where I have enjoyed the benefits is that if you use git for versioning and yuou are making multiple commits, there is an instantaneous test and deploy after each commit. Rather than the wasteful approach of commiting on local dev, pushing to remote, logging in to testing server, pulling from repo, testing; after every commit.
Theother open source alternatives are:
Setting up Jenkins Automated Deployments with your own Git Server
Haven’t created your personal git repo yet? Try this tutorial or a better one.
Setting up Jenkins on Debian:
wget -q -O - https://jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
As far as I know that is it, provided you have apache installed…
The first thing you should do is lock down Jenkins so only you can access it
Jenkins->Manage Jenkins->Configure Global Security
Setup security as you wish, you will need to manage users for this too.
Now I am assuming you are using git for source control, if you are not you are wrong.
For a non-managed git server, ie. a private git server you have setup yourself you will need to add the git plugin in Jenkins.
Manage Jenkins -> Manage Plugins -> Install the GIT plugin
Now create an ssh key for jenkins:
sudo su jenkins
ssh-keygen -t rsa -C "firstname.lastname@example.org"
It should install to /var/lib/jenkins/.ssh
Copy the public key, of the ssh key pair.
append that public key to your git server’s git user’s authorizes_keys
Should be sorted now, but hold on to the key you will need it.
Create a new item, add project name and click freestyle project.
Jenkins -> New Item -> Freestyle Project
Source Code Management
and add the git repo details along with the public key created earlier.
Well you build and it should be good. It builds to:
So things to do and I might update this post is:
1. Setup a script to copy the build to document root (staging / live site)…but why is this required? Furthermore shouldn’t the testing be done in a hosted environement, specifically end-to-end tests?
2. Setup a webhook (from the private personal git repo, and not github) to tell jenkins there has been a commit to master….
Another top article on Setting up Jenkins
With regards to 2. Setting up a webhook, or push based builds using jenkins take a look at the below site:
We need to set Jenkins up to trigger builds remotely:
Then create a script (name it: post-receive in
/your_bare_repo.git/hooks/.) with the token you just created:
I didn’t need a username and password but I think it would be advisable to have a more secure method instead of jsut the token, because analytics tracking and server logs would have logged that query string parameter, and someone could potentially bombard your system with builds constantly.
/usr/bin/curl -s \
You may have an issue with authentication, if so view the jenkins scripted clients page.
Now we may need to look at testing deployments and copying to web server if successful.