2. Lucio Grenzi
l.grenzi@gmail.com – Freelance
2
Who am I?
• Delphi developer for 11 years
• Now freelance and Web developer
• Javascript addicted
Nonantolando.blogspot.com
https://plus.google.com/108943068354277861330
http://it.linkedin.com/pub/lucio-grenzi/27/2bb/2a
4. Lucio Grenzi
l.grenzi@gmail.com – Freelance
4
Jenkins: a complete solution
• Jenkins is an automated continuous integration
server
• Automated testing, building, mantaining your
code
• Enforce quality control
• Manage release process → continuos delivery
5. Lucio Grenzi
l.grenzi@gmail.com – Freelance
5
Jenkins: facts
• Written in java
• 600+ to customize Jenkins in every aspects
• 1000+ public repositories in Github
• 500+ contributors
• Free and open source
• Widely used tools for maintaing continuos
integration cycle
7. Lucio Grenzi
l.grenzi@gmail.com – Freelance
7
Why Jenkins?
• Testing, building, maintaining, doing releases
by hand is error prone
• promote test driven development reduce
surprises
• frequent deployment
• Find bugs quickly
8. Lucio Grenzi
l.grenzi@gmail.com – Freelance
8
Jenkins
• Easy to install, upgrade and configure
• Monitor external tools
• No limit of number of jobs
• Lots of external tool to explore
9. Lucio Grenzi
l.grenzi@gmail.com – Freelance
9
Continuous integration
• is the practice of merging all developer working
copies with a shared mainline several times a
day. Its main aim is to prevent integration
problems
- wikipedia -
10. Lucio Grenzi
l.grenzi@gmail.com – Freelance
10
Continuous delivery
• is a software development discipline where you
build software in such a way that the software
can be released to production at any time.
11. Lucio Grenzi
l.grenzi@gmail.com – Freelance
11
You’re doing continuous delivery when:
• Your software is deployable throughout its lifecycle
• Your team prioritizes keeping the software deployable
over working on new features
• Anybody can get fast, automated feedback on the
production readiness of their systems any time somebody
makes a change to them
• You can perform push-button deployments of any version
of the software to any environment on demand
- http://martinfowler.com/bliki/ContinuousDelivery.html -
12. Lucio Grenzi
l.grenzi@gmail.com – Freelance
12
Install on an Ubuntu server
• wget -q -O - http://pkg.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
13. Lucio Grenzi
l.grenzi@gmail.com – Freelance
13
Link between Django and jenkins
• Apt-get install python-pip
• Pip install django-jenkins
• Pip install virtualenvwrapper
• Pip install django
14. Lucio Grenzi
l.grenzi@gmail.com – Freelance
14
Configuring django project
• Add 'django_jenkins' to your INSTALLED_APPS
list
• $ ./manage.py jenkins
• JENKINS_TASKS = (
'django_jenkins.tasks.run_pylint',
'django_jenkins.tasks.with_coverage',)
15. Lucio Grenzi
l.grenzi@gmail.com – Freelance
15
Testing web apps
• Sometimes is a complex task,
• a Web application is made of several layers of
logic
– HTTP-level request handling,
– form validation and processing,
– template rendering.
16. Lucio Grenzi
l.grenzi@gmail.com – Freelance
16
The Django’s way
• Unittest: module built in to the Python standard
library
• Nose framework: uses custom test loader
causes troubles with Django code
• django-discover-runner requires Django 1.4
built-in in Django 1.6
17. Lucio Grenzi
l.grenzi@gmail.com – Freelance
17
django-discover-runner
• add a test_settings.py file to your app package
• django-admin.py test
--settings=myapp.test_settings myapp
19. Lucio Grenzi
l.grenzi@gmail.com – Freelance
19
Best practices
• Plan disk usage
• Do distribute builds
• Discard old build records to keep Jenkins
status healthy