Post on 16-Apr-2017
Diapositiva 1
Jenkins and Django
Lucio Grenzi
l.grenzi@gmail.com
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
Agenda
Jenkins: an intro
Why use it
Installation on a Ubuntu machine
Testing
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
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
Non java languages supported
Python
Ruby
PHP
Node.js
..
Why Jenkins?
Testing, building, maintaining, doing releases by hand is error prone
promote test driven development reduce surprises
frequent deployment
Find bugs quickly
Jenkins
Easy to install, upgrade and configure
Monitor external tools
No limit of number of jobs
Lots of external tool to explore
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 -
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.
Youre 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 -
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
Link between Django and jenkins
Apt-get install python-pip
Pip install django-jenkins
Pip install virtualenvwrapper
Pip install django
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',)
Testing web apps
Sometimes is a complex task,
a Web application is made of several layers of logicHTTP-level request handling,
form validation and processing,
template rendering.
The Djangos 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
django-discover-runner
add a test_settings.py file to your app package
django-admin.py test --settings=myapp.test_settings myapp
Quality managment
Continuos performance testSelenium
Graphite
Cobertura
Best practices
Plan disk usage
Do distribute builds
Discard old build records to keep Jenkins status healthy
Demo
Questions?
Thank you
Creative Commons via tcmaker.org
19/06/14
AUTORE
Lucio Grenzil.grenzi@gmail.com Freelance
19/06/14
AUTORE