Upgrade to Pro — share decks privately, control downloads, hide ads and more …

GitHub CI+CD+ChatOps pour @ZenikaLille

GitHub CI+CD+ChatOps pour @ZenikaLille

Philippe CHARRIERE

November 22, 2016
Tweet

More Decks by Philippe CHARRIERE

Other Decks in Programming

Transcript

  1. How people build software " 2 " Philippe Charrière SE

    @ G @k33g ! @k33g_org mais comment X va m’aider à innover ? X ❤
  2. How people build software " Agenda 3 " GitHub Philosophie

    GitHub Flow - CI - CD Démonstration Explications I Explications II
  3. How people build software " 5 " FOUNDED 2008 EMPLOYEES

    574 UNIVERSITIES USING GITHUB 1,000+ TOTAL 
 REGISTERED USERS 14M TOTAL REPOSITORIES 36M PAYING ORGANIZATIONS >65,000
  4. How people build software " 7 " • Distributed Concurrent

    Versions System (Créé par Linus Torvalds en 2005) • Versions System • un “Version Control System” sur ma machine • tout le projet! • “Time Machine” / historique • Concurrent • récupérer les modifications du reste de l’équipe • proposer ses modifications • gérer les conflits • Distributed (Décentralisé) • manipulations faciles / moins de stress • système de branches • OpenSource
  5. How people build software " GitHub pour … 9 "

    • Savoir travailler de manière “historisée” & asynchrone • Modifications du code • Conversations autour du code • Recettes de cuisine • Remplacer l’e-mail - Informations partagées • Travailler ensembles sur les mêmes projets • à travers le monde
  6. How people build software " GitHub pour … 10 "

    • Travailler ensembles sur les mêmes projets • à travers le monde (asynchrone donc)
  7. How people build software " GitHub pour … 11 "

    • Travailler ensembles sur les mêmes projets • à travers le monde (asynchrone donc) • livrer des features rapidement • en continu
  8. the best way to build and ship software 13 "

    La recette “courte” INTÉGRATION CONTINUE CHATOPS $ % COMMUNICATION ASYNCHRONE & PHILOSOPHIE COMMUNE '
  9. How people build software " The Zen of GitHub (notre

    philosophie) 15 " • Responsive is better than fast • It’s not fully shipped until it’s fast • Anything added dilutes everything else •Practicality beats purity • Approachable is better than simple • Mind your words, they are important •Speak like a human • Half measures are as bad as nothing at all • Encourage flow • Non-blocking is better than blocking • Favor focus over features • Avoid administrative distraction • Design for failure •Keep it logically awesome
  10. How people build software " 16 " Comment faciliter la

    vie/le travail collaboratif des développeurs, architectes, chefs de projet, QA,… Éviter les distractions, Améliorer la productivité, … ?
  11. How people build software " 18 " Le mot-clé chez

    GitHub, c’est la simplicité
  12. how software is built Create a Branch Open a Pull

    Request Merge and deploy " 20 The GitHub Flow - Experimentation without risk hypothesis & test discuss & conclude accept or discard
  13. How people build software " GitHub Flow 26 " •

    This workflow is: • easy to use • easy to learn • easy to scale • To avoid conflicts: • “small features” are easier to merge • push often • one feature - one person
  14. How people build software " 27 " c’est autour de

    ce concept que GitHub “fabrique” GitHub
  15. How people build software " La chaîne | Intégration continue

    28 " ( ( ) * + , code source + tests partagés > VCS
  16. How people build software " La chaîne | Intégration continue

    29 " ( ( ) * + , - code source + tests partagés > VCS updates ⚡ jobs list Janky
  17. How people build software " La chaîne | Intégration continue

    30 " ( ( ) * + , - code source + tests partagés > VCS updates ⚡ mkdir somewhere_001 cd somewhere_001 git clone http://vcs.at.home/ACME/killerapp.git cd killerapp git checkout wip-something jobs list Janky
  18. How people build software " La chaîne | Intégration continue

    31 " ( ( ) * + , - code source + tests partagés > VCS updates ⚡ npm --cache-min 9999999 install; npm test { "name": "killerapp", "version": "1.0.0", "description": "", "main": "src/index.js", "scripts": { "test": "./node_modules/.bin/mocha tests/**" }, "repository": { "type": "git" }, "author": "@k33g", "license": "MIT", "devDependencies": { "chai": "^3.5.0", "mocha": "^2.5.3" } } "use strict"; const assert = require('chai').assert; describe("geek value equals 42", () => { let geek = 42; it("should return 42", () => { assert.equal(geek, 42) }); }); package.json myTest01.js jobs list Janky
  19. How people build software " La chaîne | Intégration continue

    32 " ( ( ) * + , - . / code source + tests partagés > VCS updates ⚡ jobs list ☀⛅⛈❌✅ Janky
  20. How people build software " La chaîne | Chatops 33

    " ( ( ) * + , - . / code source + tests partagés > VCS updates ⚡ jobs list ☀⛅⛈❌✅ Janky
  21. How people build software " La chaîne | Chatops +

    Déploiement continu 34 " ( ( ) * + , - . / code source + tests partagés > VCS updates ⚡ jobs list ☀⛅⛈❌✅ Janky ✅ Heaven
  22. How people build software " Ressources 35 " https://developer.github.com/guides/building-a-ci-server/ https://github.com/github/janky

    https://developer.github.com/guides/delivering-deployments/ https://github.com/atmos/heaven
  23. the best way to build and ship software AFlow 41

    " @mention ) ( WEB HOOK Issue 0 USERS BOTS
  24. the best way to build and ship software AFlow 42

    " @mention ) ( WEB HOOKS Issue 0 USERS BOTS Create a branch ! " Add commits Open a Pull Request # AAPI % hey this is my code WEB HOOKS
  25. the best way to build and ship software AFlow 43

    " @mention ) ( WEB HOOKS Issue 0 USERS BOTS Create a branch ! " Add commits Open a Pull Request # AAPI hey this is my code AAPI STATUS: PENDING % WEB HOOKS
  26. the best way to build and ship software AFlow 44

    " @mention ) ( WEB HOOKS Issue 0 USERS BOTS Create a branch ! " Add commits Open a Pull Request # AAPI hey this is my code AAPI STATUS: ❌✅ Build OK - Build fails - AAPI STATUS: PENDING % - WEB HOOKS
  27. the best way to build and ship software AFlow 45

    " @mention ) ( WEB HOOKS Issue 0 USERS BOTS Create a branch ! " Add commits Open a Pull Request # AAPI hey this is my code AAPI STATUS: ❌✅ Build OK - Build fails - AAPI STATUS: PENDING % WEB HOOKS - REST
  28. the best way to build and ship software AFlow 46

    " @mention ) ( WEB HOOKS Issue 0 USERS BOTS Create a branch ! " Add commits Open a Pull Request # AAPI hey this is my code AAPI STATUS: ❌✅ Build OK - Build fails - AAPI STATUS: PENDING % WEB HOOKS - REST Discuss and review code 0 @mention ) " Add commits Publish 1 Merge $ Build OK -
  29. the best way to build and ship software AFlow 47

    " @mention ) ( WEB HOOKS Issue 0 USERS BOTS Create a branch ! " Add commits Open a Pull Request # AAPI hey this is my code AAPI STATUS: ❌✅ Build OK - Build fails - AAPI STATUS: PENDING % WEB HOOKS - REST Merge> master $
  30. How people build software " “algo CI & CD” 49

    " une application Express: qui écoute un webhook app.post('/ci', (req, res) => {… récupère un event (du hook) let event = req.headers['x-github-event']; => case “push”: => PR status == “pending” (G API) => “monter” le projet à partir d’une branche => si branche == branche de “prod” (eg: master) ==> on déploie (à partir d’un script dans le repo) => sinon ==> on lance les tests d’intégration (à partir d’un script dans le repo) => PR status == “success” (G API) => PR status == “error” (G API) case “pull_request”: => PR + “closed” => == merge => déploiement possible
  31. How people build software " Le code BOB THE BOT

    51 " HTTPS://GITHUB.COM/ROCKETCHAT/ROCKET.CHAT HTTPS://GITHUB.COM/GITHUB/HUBOT
  32. How people build software " 52 " Préparation Dans GitHub

    > créer un utilisateur “bob” > créer un personal access token pour bob Dans RocketChat > en tant qu’administrateur: ajouter un user “bob” avec le rôle “bot” > créer une room “ops” > inviter “bob” Avec Hubot > utiliser le plugin "hubot-rocketchat"