jenkins - midcamp.org or how i... · jenkins • long, long time ago was 'hudson' •...

38
JENKINS or: How I learned to stop worrying and love automation #MidCamp 2018 – Jeff Geerling

Upload: others

Post on 21-Mar-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

JENKINS

or: How I learned to stop worrying and love automation

#MidCamp 2018 – Jeff Geerling

Page 2: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

Jeff Geerling (geerlingguy)

• Drupalist and Acquian

• Writer

• Automator of things

Page 3: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be
Page 4: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

AGENDA

1. Installing Jenkins

2. Configuation and Backup

3. Jenkins and Drupal

Page 5: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

JENKINS

Page 6: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

JENKINS

• Long, long time ago was 'Hudson'

Page 7: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

JENKINS

• Long, long time ago was 'Hudson'

Page 8: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

JENKINS

• Long, long time ago was 'Hudson'

Page 9: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

JENKINS

• Long, long time ago was 'Hudson'

• After Oracle: "Time for a new name!"

Page 10: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

JENKINS

• Long, long time ago was 'Hudson'

• After Oracle: "Time for a new name!"

• Now under the stewardship of Cloudbees

Page 11: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

JENKINS

• Long, long time ago was 'Hudson'

• After Oracle: "Time for a new name!"

• Now under the stewardship of Cloudbees

• Used to be only name in the open source CI game

• Today: GitLab CI, Concourse, Travis CI, CircleCI, CodeShip...

Page 12: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

RUNNING JENKINS

• Server:

• RAM (Jenkins is a hungry butler!)

• CPU (if jobs need it)

• Disk (don't fill the system disk!)

Page 13: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

RUNNING JENKINS

• Monitor RAM, CPU, Disk

• Monitor jenkins service if RAM is limited

• enforce-jenkins-running.sh

Page 14: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

INSTALLING JENKINS

• Install Java.

• Install Jenkins.

• Done!

Image source: https://medium.com/@ricardoespsanto/jenkins-is-dead-long-live-concourse-ce13f94e4975

Page 15: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

INSTALLING JENKINS

• Install Java.

• Install Jenkins.

• Done!

Image source: https://medium.com/@ricardoespsanto/jenkins-is-dead-long-live-concourse-ce13f94e4975

Page 16: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

Image source: https://www.albany.edu/news/69224.php

(Your Jenkins server, 3 years later)

Page 17: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

INSTALLING JENKINS

• Securely:

• Java

• Jenkins

• Nginx

• Let's Encrypt

Page 18: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

INSTALLING JENKINS

• Repeatably:

• CI for Jenkins (CI-ception!)

• Local or test Jenkins environment

• You wouldn't develop a Drupal site in prod (riiiiight?), so why would you develop your automation in prod?!

Page 19: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

INSTALLING JENKINS

(If you want to skip ahead...)

https://github.com/geerlingguy/drupal-jenkins-multisite

Page 20: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

INSTALLING JENKINS

(If you want the easier, but expensive-r, route)

https://www.cloudbees.com/

Page 21: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

INSTALLING JENKINS

(If you want it RIGHT NOW!)

docker run -d -p 8080:8080 jenkinsci/blueocean

Page 22: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

WE'RE IN

Page 23: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

CONFIGURING JENKINS

• Plugins:

• Very much like Drupal modules

• (This has good and bad implications 😛)

Page 24: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

CONFIGURING JENKINS

• Blue Ocean:

• No more 00's UI!

• Follow this issue for setting it as default

Page 25: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

CONFIGURING JENKINS

• Secrets:

• SSH keys

• API keys

• AWS credentials

Image source: https://livinghiv.com/2014/09/07/least-secret-secret/

Page 26: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be
Page 27: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

CONFIGURING JENKINS

Image source: http://ru.memegenerator.net/instance/69770876/overly-excited-oprah-you-get-root-you-get-root-everyone-gets-root

Page 28: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

CONFIGURING JENKINS

• Access Control:

• Use the Role Strategy Plugin

• BUT, be careful, and TEST after upgrades!

Image source: https://livinghiv.com/2014/09/07/least-secret-secret/

Page 29: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

BACKING UP JENKINS

Back up JENKINS_HOME to Amazon S3

tl;dr: jenkins-backup.yml

Page 30: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

JENKINS & DRUPAL

What can we do with them?

Page 31: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

JENKINS & DRUPAL

• Quite a lot, actually!

• Run tests (PHPUnit, Behat, etc.)

• Build dependencies (Composer, npm/yarn)

• Run cron

• Deploy new sites

• Deploy updates to existing sites

Page 32: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be
Page 33: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

JENKINS & DRUPAL

• midwesternmac.com ('mm'):

• Drupal 7

• Multisite, 6 sites total

Page 34: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

JENKINS & DRUPAL

(Demo)

Page 35: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

Hey, I do this more than one time ever... I should

automate it!

Image source: Jack Moreh / freerangestock.com

Page 36: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

XKCD: 1205

Page 38: JENKINS - midcamp.org or how I... · JENKINS • Long, long time ago was 'Hudson' • After Oracle: "Time for a new name!" • Now under the stewardship of Cloudbees • Used to be

THANKS!

• Support my open source work on Patreon: https://www.patreon.com/geerlingguy