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

Gitlab CI - Der Fuchs im Schafspelz

Jonas
June 27, 2019

Gitlab CI - Der Fuchs im Schafspelz

Der Kampf durch zahllose Konfigurationsseiten bei jedem Build-Job ist ein frustrierendes Erlebnis im Entwickleralltag. Pipeline-as-code vermeidet diese Frustration und sorgt gleichzeitig dafür, dass die CI-Pipeline immer zur Version der Applikation passt. Außer Pipeline-as-code bietet Gitlab CI gute Integrationsmöglichkeiten für eigene Docker-Services, die während der Pipeline benutzt werden können.

Der Talk bereitet kurz die Grundlagen von CI/CD auf und zeigt dann praktisch, wie man eine Pipeline für eine Spring-Boot Anwendung mit Integrations-Tests für Gitlab CI konzipiert. Nach der Demo erzählt Jonas, warum der Fuchs den alten Platzhirschen Jenkins bei uns verdrängt hat.

Jonas

June 27, 2019
Tweet

More Decks by Jonas

Other Decks in Technology

Transcript

  1. Benefits of Continuous Integration • Early feedback to developer •

    Improves bug detection • Improves collaboration • Visibility project status • Boosting Time-to-Market CC-BY Thomas Ferris Nicolaisen tfnico.com
  2. • Pipelines are versioned in the code repository • CI

    Server can be configured faster & easier to debug • Modularizable & Reusable Pipeline as Code
  3. • GitLab core is Open Source • Source Code Repository


    with integrated CI/CD service • Growing range of functions
  4. hello: #Job name image: alpine:latest #Docker image script: - echo

    "Hello World" #commands to run Hello World
  5. Stages stages: - build - test image: maven:3-jdk-11-slim #Docker image

    build: #Job name stage: build #dedicated stage script: - mvn clean package -DskipTests test: stage: test script: - mvn clean verify
  6. Cache #Global cache cache: paths: - .m2/repository build: stage: build

    script: - mvn clean package #Local cache build: stage: build script: - mvn clean package cache: paths: - .m2/repository
  7. Artifacts image: maven:3-jdk-11-slim build: stage: build script: - mvn clean

    package artifacts: #Artifact policy expire_in: 1 week paths: - target/*.jar #Artifact Path build-docker-images: stage: pack script: - docker -t ... build . - docker push ... dependencies: build #Marks dependencies # Job fails when artifacts have expired.
  8. YML-Anchor vs extends .deploy: &deploy stage: deploy script: - ...

    only: - master deploy-staging: <<: *deploy stage: deploy-staging after_script: - ... variables: envname: stage deploy-production: <<: *deploy stage: deploy-production before_script: - ... variables: envname: production .deploy: script: - ... only: - master deploy-staging: extends: .deploy stage: deploy-staging after_script: - ... variables: envname: stage deploy-production: extends: .deploy stage: deploy-production before_script: - ... variables: envname: production
  9. Services test: stage: test image: maven:3-jdk-11 script: - mvn clean

    package services: - name: postgres:9.6 alias: postgres variables: POSTGRES_DB: poll POSTGRES_PASSWORD: testing-password POSTGRES_USER: user cache: paths: - .m2/repository
  10. Start an other pipeline start-hello: stage: start-next image: appropriate/curl:latest script:

    - 'curl --request POST --header "PRIVATE-TOKEN: $CI_API_TOKEN” https://gitlab.com/api/v4/projects/{id}/pipeline?ref=master'
  11. • Pre-defined CI/CD configuration • Automatically detect, build, test, deploy,

    and monitor your applications. • Easy bootstrapping of K8s and your services • If you want to do something unusual, forget about auto devops. Auto DevOps
  12. Nächster Talk … talks.cosee.biz | blog.cosee.biz | @coseeaner | #coseetechtalks

    Besser spät als nie: Testsuite in bestehenden React-Apps nachziehen Mirjam Bäuerlein | 25.07.2019