Share
Embed
GitHub CI+CD+ChatOps pour @ZenikaLille
Philippe CHARRIERE
November 22, 2016
Transcript
55 slides
-
How people build software " 2 " Philippe Charrière SE
@ G @k33g ! @k33g_org mais comment X va m’aider à innover ? X ❤ -
How people build software " Agenda 3 " GitHub Philosophie
GitHub Flow - CI - CD Démonstration Explications I Explications II -
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 -
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 -
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 -
How people build software " GitHub pour … 10 "
• Travailler ensembles sur les mêmes projets • à travers le monde (asynchrone donc) -
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 -
the best way to build and ship software 13 "
La recette “courte” INTÉGRATION CONTINUE CHATOPS $ % COMMUNICATION ASYNCHRONE & PHILOSOPHIE COMMUNE ' -
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 -
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é, … ? -
How people build software " 18 " Le mot-clé chez
GitHub, c’est la simplicité -
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 -
How people build software " 21 " Create a Feature
Branch GitHub Flow -
How people build software " 23 " Open a Pull
Request GitHub Flow -
How people build software " 24 " Discuss and Review
Code GitHub Flow -
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 -
How people build software " 27 " c’est autour de
ce concept que GitHub “fabrique” GitHub -
How people build software " La chaîne | Intégration continue
28 " ( ( ) * + , code source + tests partagés > VCS -
How people build software " La chaîne | Intégration continue
29 " ( ( ) * + , - code source + tests partagés > VCS updates ⚡ jobs list Janky -
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 -
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 -
How people build software " La chaîne | Intégration continue
32 " ( ( ) * + , - . / code source + tests partagés > VCS updates ⚡ jobs list ☀⛅⛈❌✅ Janky -
How people build software " La chaîne | Chatops 33
" ( ( ) * + , - . / code source + tests partagés > VCS updates ⚡ jobs list ☀⛅⛈❌✅ Janky -
How people build software " La chaîne | Chatops +
Déploiement continu 34 " ( ( ) * + , - . / code source + tests partagés > VCS updates ⚡ jobs list ☀⛅⛈❌✅ Janky ✅ Heaven -
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 -
the best way to build and ship software AFlow 41
" @mention ) ( WEB HOOK Issue 0 USERS BOTS -
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 -
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 -
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 -
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 -
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 - -
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 $ -
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 -
How people build software " Le code BOB THE BOT
51 " HTTPS://GITHUB.COM/ROCKETCHAT/ROCKET.CHAT HTTPS://GITHUB.COM/GITHUB/HUBOT -
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"