Slide 1

Slide 1 text

Votre CI/CD aux petits oignons avec Gitlab CI !

Slide 2

Slide 2 text

SPEAKERS Jean-Baptiste Martin @mr_martingale Jean-Philippe Baconnais @jphi_baconnais

Slide 3

Slide 3 text

https://unsplash.com/@tme18

Slide 4

Slide 4 text

Nous les OPS !

Slide 5

Slide 5 text

Contexte de nos applications

Slide 6

Slide 6 text

https://unsplash.com/@ffstop

Slide 7

Slide 7 text

https://unsplash.com/@jjying

Slide 8

Slide 8 text

https://unsplash.com/@milkandbourbons

Slide 9

Slide 9 text

Arrivée d’une nouvelle application dans notre périmètre https://unsplash.com/@christianchen

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

https://unsplash.com/@chuttersnap

Slide 12

Slide 12 text

Nos mises en production ?

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

Faux

Slide 15

Slide 15 text

Pas d’automatisation pour livrer l’application

Slide 16

Slide 16 text

Les outils Gitlab https://unsplash.com/@jeshoots

Slide 17

Slide 17 text

No content

Slide 18

Slide 18 text

.gitlab-ci.yml https://unsplash.com/@clemhlrdt

Slide 19

Slide 19 text

Gitlab Runner https://unsplash.com/@cartega

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

tags: - le_tag_de_notre_runner_à_exécuter

Slide 23

Slide 23 text

https://unsplash.com/@domenicoloia Gitlab Pages

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

Gitlab Registry https://unsplash.com/@muaawiyahdadabhay

Slide 27

Slide 27 text

No content

Slide 28

Slide 28 text

No content

Slide 29

Slide 29 text

Concrètement ça donne quoi ? https://www.flickr.com/photos/52137170@N00/

Slide 30

Slide 30 text

.gitlab-ci.yml https://unsplash.com/@clemhlrdt

Slide 31

Slide 31 text

No content

Slide 32

Slide 32 text

No content

Slide 33

Slide 33 text

No content

Slide 34

Slide 34 text

Tester nos runners en local GitLab Runner https://unsplash.com/photos/Hcfwew744z4

Slide 35

Slide 35 text

📦 Back go : stage: build image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] script: - echo "Packaging de la partie Go" - [...] only: - master https://unsplash.com/photos/Hcfwew744z4

Slide 36

Slide 36 text

📦 Back go : stage: build image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] script: - echo "Packaging de la partie Go" - [...] only: - master https://unsplash.com/photos/Hcfwew744z4 gitlab-runner exec docker '📦 Back go'

Slide 37

Slide 37 text

https://unsplash.com/@domenicoloia Gitlab Pages

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

Stockage d’un CMS Gohugo

Slide 40

Slide 40 text

https://gitlab.com//.gitlab.io

Slide 41

Slide 41 text

.gitlab-ci.yml https://unsplash.com/@clemhlrdt

Slide 42

Slide 42 text

image: registry.gitlab.com/pages/hugo:latest variables: GIT_SUBMODULE_STRATEGY: recursive pages: script: - hugo artifacts: paths: - public only: - master

Slide 43

Slide 43 text

image: registry.gitlab.com/pages/hugo:latest variables: GIT_SUBMODULE_STRATEGY: recursive pages: script: - hugo artifacts: paths: - public only: - master

Slide 44

Slide 44 text

https://.gitlab.io disponible !

Slide 45

Slide 45 text

Gitlab CI : tests https://unsplash.com/@clemhlrdt

Slide 46

Slide 46 text

test de validation: stage: validation script: - './mvnw $MAVEN_CLI_OPTS verify' artifacts: paths: - target/ only: - develop

Slide 47

Slide 47 text

No content

Slide 48

Slide 48 text

No content

Slide 49

Slide 49 text

Gitlab CI : qualité de code https://unsplash.com/@clemhlrdt

Slide 50

Slide 50 text

analyse qualimetrique: stage : sonar dependencies: - test de validation script: - ./mvnw $MAVEN_CLI_OPTS sonar:sonar -Dsonar.host.url=' http://[...]/sonar006/ ' -Dsonar.projectKey=$CI_PROJECT_NAME-features -Dsonar.sources=src/main/java -Dsonar.exclusions=**/resources/**,**/bean/** -Dsonar.java.binaries=target/classes only: - develop

Slide 51

Slide 51 text

Les Webhooks https://unsplash.com/@clemhlrdt

Slide 52

Slide 52 text

No content

Slide 53

Slide 53 text

No content

Slide 54

Slide 54 text

Gitlab CI : build https://unsplash.com/@clemhlrdt

Slide 55

Slide 55 text

build: stage: build script: - mvn clean install

Slide 56

Slide 56 text

Gitlab CI : deploy https://unsplash.com/@clemhlrdt

Slide 57

Slide 57 text

deploy: only: refs: - master stage: deploy image: docker:stable services: - docker:dind script: - docker login -u gitlabci -p "$CI_SECRET" registry.gitlab.com - docker build -t registry.gitlab.com/jeanphi.baconnais/jdk8_gitlabci . - docker push registry.gitlab.com/jeanphi.baconnais/jdk8_gitlabci:latest

Slide 58

Slide 58 text

deploy: only: refs: - master stage: deploy image: docker:stable services: - docker:dind script: - docker login -u gitlabci -p "$CI_SECRET" registry.gitlab.com - docker build -t registry.gitlab.com/jeanphi.baconnais/jdk8_gitlabci . - docker push registry.gitlab.com/jeanphi.baconnais/jdk8_gitlabci:latest

Slide 59

Slide 59 text

Gitlab CI : deploy (bis) https://unsplash.com/@clemhlrdt

Slide 60

Slide 60 text

No content

Slide 61

Slide 61 text

🐳 build_push_image_docker: stage: build image: name: gcr.io/kaniko-project/executor:debug entrypoint: [""] script: - echo "{\"auths\":{\"$CI_REGISTRY\":{\"username\":\"$CI_REGISTRY_USER\",\"password\":\"$CI_REG ISTRY_PASSWORD\"}}}" > /kaniko/.docker/config.json - echo $CI_COMMIT_REF_NAME"_"$CI_PIPELINE_ID > /kaniko/version.txt - /kaniko/executor --context $CI_PROJECT_DIR --dockerfile $CI_PROJECT_DIR/Dockerfile --destination $CI_REGISTRY_IMAGE:$(cat /kaniko/version.txt)

Slide 62

Slide 62 text

Gitlab : déploiement https://unsplash.com/photos/80sv993lUKI

Slide 63

Slide 63 text

No content

Slide 64

Slide 64 text

No content

Slide 65

Slide 65 text

Gitlab : couplage avec jenkins

Slide 66

Slide 66 text

Au début, c’était compliqué...

Slide 67

Slide 67 text

Puis les choses se sont vite simplifiées

Slide 68

Slide 68 text

Pour de vrai et sans casser notre tirelire

Slide 69

Slide 69 text

Mission accomplie!

Slide 70

Slide 70 text

Il y a aussi ... https://unsplash.com/@clemhlrdt

Slide 71

Slide 71 text

Cache https://unsplash.com/@clemhlrdt

Slide 72

Slide 72 text

cache: key: ${CI_COMMIT_REF_SLUG} paths: - node_modules/ - public/ - vendor/ - .m2/repository/ - target/ # à éviter !

Slide 73

Slide 73 text

Intégration Kubernetes https://unsplash.com/@clemhlrdt

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

No content

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

🐋 deploy_gcp : stage: deploy image: google/cloud-sdk script: - kubectl create deployment hello-web --image=hello-world - kubectl expose deployment hello-web --type=LoadBalancer --port 80 --target-port 8080 environment: name: gke

Slide 78

Slide 78 text

🐋 deploy_gcp : stage: deploy image: google/cloud-sdk script: - kubectl apply -f k8s/hello-world.yaml environment: name: gke

Slide 79

Slide 79 text

No content

Slide 80

Slide 80 text

https://github.com/paulbouwer/hello-kubernetes

Slide 81

Slide 81 text

No content

Slide 82

Slide 82 text

Environnements

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

https://unsplash.com/@lukephotography

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

No content

Slide 87

Slide 87 text

No content

Slide 88

Slide 88 text

Build : Ok En résumé

Slide 89

Slide 89 text

Build : Ok Tester une application et générer un rapport Jacocco : Ok En résumé

Slide 90

Slide 90 text

Build : Ok Tester une application et générer un rapport Jacocco : Ok Construire une image Docker et la publier dans le registry Gitlab : Ok En résumé

Slide 91

Slide 91 text

Build : Ok Tester une application et générer un rapport Jacocco : Ok Construire une image Docker et la publier dans le registry Gitlab : Ok Brancher un jenkins à Gitlab : Ok En résumé

Slide 92

Slide 92 text

Build : Ok Tester une application et générer un rapport Jacocco : Ok Construire une image Docker et la publier dans le registry Gitlab : Ok Brancher un jenkins à Gitlab : Ok Se connecter sur un serveur distant : Ok En résumé

Slide 93

Slide 93 text

Build : Ok Tester une application et générer un rapport Jacocco : Ok Construire une image Docker et la publier dans le registry Gitlab : Ok Brancher un jenkins à Gitlab : Ok Se connecter sur un serveur distant : Ok Déployer une application sur le serveur distant: Ok En résumé

Slide 94

Slide 94 text

Build : Ok Tester une application et générer un rapport Jacocco : Ok Construire une image Docker et la publier dans le registry Gitlab : Ok Brancher un jenkins à Gitlab : Ok Se connecter sur un serveur distant : Ok Déployer une application sur le serveur distant: Ok Déployer une application sur kubernetes dans un cloud : Ok En résumé

Slide 95

Slide 95 text

Build : Ok Tester une application et générer un rapport Jacocco : Ok Construire une image Docker et la publier dans le registry Gitlab : Ok Brancher un jenkins à Gitlab : Ok Se connecter sur un serveur distant : Ok Déployer une application sur le serveur distant: Ok Déployer une application sur kubernetes dans un cloud : Ok Déployer en production après une action manuelle : Ok En résumé

Slide 96

Slide 96 text

La suite ?

Slide 97

Slide 97 text

La suite ? Continuer à travailler avec Gitlab : 1 seul outil Dev + OPS

Slide 98

Slide 98 text

Continuer à travailler avec Gitlab : 1 seul outil Dev + OPS Intégration d’outils facile La suite ?

Slide 99

Slide 99 text

Continuer à travailler avec Gitlab : 1 seul outil Dev + OPS Intégration d’outils facile Prise en main “assez” simple La suite ?

Slide 100

Slide 100 text

La suite ? Continuer à travailler avec Gitlab : 1 seul outil Dev + OPS Intégration d’outils facile Prise en main “assez” simple Travaux en cours pour déployer en auto la production

Slide 101

Slide 101 text

La suite ? Continuer à travailler avec Gitlab : 1 seul outil Dev + OPS Intégration d’outils facile Prise en main “assez” simple Travaux en cours pour déployer en auto la production Pas de migration jenkins vers Gitlab prévue

Slide 102

Slide 102 text

La suite ? Continuer à travailler avec Gitlab : 1 seul outil Dev + OPS Intégration d’outils facile Prise en main “assez” simple Travaux en cours pour déployer en auto la production Pas de migration jenkins vers Gitlab prévue Mais utilisation sur de nouveaux projets

Slide 103

Slide 103 text

La suite ? Continuer à travailler avec Gitlab : 1 seul outil Dev + OPS Intégration d’outils facile Prise en main “assez” simple Travaux en cours pour déployer en auto la production Pas de migration jenkins vers Gitlab Mais utilisation sur de nouveaux projets On conseille fortement !

Slide 104

Slide 104 text

mr_martingale JPhi_Baconnais MERCI DE VOTRE ATTENTION !

Slide 105

Slide 105 text

? QUESTIONS