tech meetup: jenkins, the moody buttler

48
Matías Herranz Nelson Secchi www.santexgroup.com Jenkins The (moody) butler

Upload: santex-group

Post on 07-Apr-2017

34 views

Category:

Software


0 download

TRANSCRIPT

Page 1: Tech Meetup: Jenkins, the moody buttler

Matías HerranzNelson Secchi

www.santexgroup.com

JenkinsThe (moody) butler

Page 2: Tech Meetup: Jenkins, the moody buttler

www.santexgroup.com

$ whoami --mati

Page 3: Tech Meetup: Jenkins, the moody buttler

Some famous Nelsons

www.santexgroup.com

$ whoami --nel

Page 4: Tech Meetup: Jenkins, the moody buttler

¿Cómo va a ser la cosa?

Intro - Contenidos

Page 5: Tech Meetup: Jenkins, the moody buttler

1. Introa. Intro, conceptos, common grounds,b. Integración y deployment continuo

c. ¿para qué? ¿Por qué? ¿cómo?

2. Hands on!a. Cómo instalar Jenkins desde cero,

b. Tour de Jenkins

c. Idea: Salir sabiendo cómo dejar andando Jenkins desde cero.

3. Q&A and ovations.

Intro - Contenidos

Page 6: Tech Meetup: Jenkins, the moody buttler

What is CI?

Don’t believe the suit!

CI - Basics

Page 7: Tech Meetup: Jenkins, the moody buttler

What is CI

In software engineering, continuous integration (CI) is the practice of merging all developer working copies to a shared mainline several times a day.

Page 8: Tech Meetup: Jenkins, the moody buttler

What is CI

Grady Booch first named and proposed CI in his 1991 method, although he did not advocate integrating several times a day.

Extreme programming (XP) adopted the concept of CI and did advocate integrating more than once per day - perhaps as many as tens of times per day.

Page 9: Tech Meetup: Jenkins, the moody buttler

What is CI

Ventajas

● Los desarrolladores pueden detectar y solucionar problemas de integración

de forma continua, evitando el caos de última hora cuando se acercan las

fechas de entrega.

● Disponibilidad constante de una versión para pruebas, demos o

lanzamientos anticipados.

● Ejecución inmediata de las pruebas unitarias (unittests).

● Monitorización continua de las métricas de calidad del proyecto (¡como

coverage!).

Page 11: Tech Meetup: Jenkins, the moody buttler

What is CIHerramientas, que a su vez usan herramientas

Mientras que las herramientas de la slide anterior seencargan de controlar las ejecuciones, éstas lo hacenapoyadas en otras herramientas como:

● Ant o Maven (también para proyectos Java),● Nant o MSBUILD (para .Net) que se encargan de realizar las compilaciones,

ejecutar las pruebas y realizar los informes.● Y una infinita lista de etcéteras.

Page 12: Tech Meetup: Jenkins, the moody buttler

What is CI

A menudo la integración continua está asociada con las metodologías de programación extrema y desarrollo ágil.

Page 13: Tech Meetup: Jenkins, the moody buttler

What is CIWhat does “No CI” look like?- Madness,- one single central codebase repository,- large number of changes in big integration events- => harsh code integrations when >= 1 dev

Page 14: Tech Meetup: Jenkins, the moody buttler

What is CIIn order to avoid the previously described issues, developers need to integrate their partially complete work back into the main repository on a daily basis, or even a couple of times a day.To accomplish this, they first need to pull in all the changes added to the main repository while they were working on the code.

Page 15: Tech Meetup: Jenkins, the moody buttler

CD - Continuous Deployment

Now we are talking!

● What is it?● Cases● How to implement it?

Page 16: Tech Meetup: Jenkins, the moody buttler

Let’s Jenkins!

Page 17: Tech Meetup: Jenkins, the moody buttler

Setup!

Kitematic + Docker

Page 18: Tech Meetup: Jenkins, the moody buttler

Select the Jenkins Official Container

Page 19: Tech Meetup: Jenkins, the moody buttler

Setup the Jenkins Official Container

Page 20: Tech Meetup: Jenkins, the moody buttler

Setup the Jenkins Official Container

Page 21: Tech Meetup: Jenkins, the moody buttler

Plugins!

Page 22: Tech Meetup: Jenkins, the moody buttler

Plugins!

Page 23: Tech Meetup: Jenkins, the moody buttler

Admin user setup

Page 24: Tech Meetup: Jenkins, the moody buttler

And we are good to go!

Page 25: Tech Meetup: Jenkins, the moody buttler

Getting the show on the road

Instalemos los plugins necesarios y armemos algunos jobs

Page 26: Tech Meetup: Jenkins, the moody buttler

Plugins

Page 27: Tech Meetup: Jenkins, the moody buttler

- There are a whole bunch, for right about anything you may think of.

- To get the list of all plugins available within Jenkins, one can visit the link → https://wiki.jenkins-ci.org/display/JENKINS/Plugins

- Today’s project flavor, Python!→ https://github.com/matiasherranz/pyjenkins

Plugins

Page 28: Tech Meetup: Jenkins, the moody buttler

Algunos plugins que usamos:

- Shining Panda, Python virtualenv plugin- https://wiki.jenkins-ci.org/display/JENKINS/ShiningPanda+Plugin

- GitHub, integration plugin- http://wiki.jenkins-ci.org/display/JENKINS/Github+Plugin

- Email Extension Plugin, using Gmail for email sending- https://wiki.jenkins-ci.org/display/JENKINS/Email-ext+plugin

- Project Statistics Plugin- https://wiki.jenkins-ci.org/display/JENKINS/Project+Statistics+Plugin

Plugins

Page 29: Tech Meetup: Jenkins, the moody buttler

virtualenv plugin

Plugins - Instalación

Page 30: Tech Meetup: Jenkins, the moody buttler

Installing plugins is a piece o'cake

Plugins - Instalación

Page 31: Tech Meetup: Jenkins, the moody buttler

Build execution

Page 32: Tech Meetup: Jenkins, the moody buttler

- El punto más importante del job, donde se realiza “el build” en sí mismo.

- Compilación, UTs, generación de reportes, etc.

- En este paso se suele, en la mayoría de los casos, definir el resultado del build:- ABORTED,- SUCCESS,- UNSTABLE,- FAILURE.

Build execution

Page 33: Tech Meetup: Jenkins, the moody buttler

Build execution- En entornos *NIX, bash does the trick:

Page 34: Tech Meetup: Jenkins, the moody buttler

Build execution

Page 35: Tech Meetup: Jenkins, the moody buttler

Build execution

- La definición del build puede tener complejidad arbitraria,- Usar plugins,- Usar variables de entorno,- Usar parámetros del job,- La flexibilidad es absoluta,

Básicamente

Page 36: Tech Meetup: Jenkins, the moody buttler

Pre / Post / build steps

Page 37: Tech Meetup: Jenkins, the moody buttler

Si bien pueden usar plugins, son propios de cada job.

Pre build steps:- Suelen utilizarse para configurar el entorno,- Satisfacer dependencias a nivel sistema,- Obtener el código del proyecto,- Configurar cómo va a ser el output de consola del job,- etc.

Vamos a ver 2:- Origen del código fuente (GitHub),- Seteo de entorno de ejecución (mostrar timestamps).

Pre-build steps

Page 38: Tech Meetup: Jenkins, the moody buttler

Si bien pueden usar plugins, son, también, propios de cada job.

Post build steps:- Suelen utilizarse para decidir qué hacer con lo que se buildeó,- Notificaciones a los interesados / responsables / equipo,- Punto de integración para CD,- Publicación de informes, métricas, estadísticas, etc.- Build status integrado con GitHub.

Vamos a ver 2:- Publish coverage.py HTML reports- Send emails

- to the team- to broken-build culprit :O

Post-build steps

Page 39: Tech Meetup: Jenkins, the moody buttler

Coverage reports

Page 40: Tech Meetup: Jenkins, the moody buttler

Coverage reports

Page 41: Tech Meetup: Jenkins, the moody buttler

Emails!

● La configuración de email es global a Jenkins (no de un job en particular),● ¿Dónde?

○ Jenkins → Administrar Jenkins → Configurar Sistema● Para usar Gmail, usar app-specific passwords,

○ ¡Más seguro!○ Usar SSL, no TLS, puerto 465, SMTP.

● Se puede probar la configuración inline para chequear que funciona correctamente.

¡Y para enviar emails podemos usar Gmail!

Page 42: Tech Meetup: Jenkins, the moody buttler

Emails!Pantalla de configuración:

Page 43: Tech Meetup: Jenkins, the moody buttler

Emails!Email de testeo de que anduvo el setup:

Page 44: Tech Meetup: Jenkins, the moody buttler

Emails!Broken build:

Page 45: Tech Meetup: Jenkins, the moody buttler

Emails!Build back to OK

Page 46: Tech Meetup: Jenkins, the moody buttler

Questions?

Page 47: Tech Meetup: Jenkins, the moody buttler

Thank you!

Page 48: Tech Meetup: Jenkins, the moody buttler