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

Continuously integrating at ease! / a GitLab CI story

Continuously integrating at ease! / a GitLab CI story

Continuous Integration (CI) is the process of automating the build and testing of code every time a team member commits changes to version control. In this talk I'll talk about what should we expect from a modern CI solution and what is our approach at InterTicket. What should happen for every line of code that is checked into a repository? What are these strange words: pipelines, stages and jobs everyone talks about?

Richard Szabo

February 26, 2018
Tweet

More Decks by Richard Szabo

Other Decks in Programming

Transcript

  1. agenda • introduction • continuous integration • development flow •

    branching strategy • CI solutions • setup • pipelines and stuff • summary • questions interticket
  2. introduction • Hi, I'm Richard • iOS developer since 2014

    • leading the mobile efforts @interticket interticket
  3. introduction • interticket is • a ticket company - jegy.hu

    • selling tickets in 15+ country • we have other interesting projects as well • 10 man strong mobile team interticket
  4. –Martin Fowler “Continuous Integration is a software development practice where

    members of a team integrate their work frequently, usually each person integrates at least daily - leading to multiple integrations per day. Each integration is verified by an automated build (including test) to detect integration errors as quickly as possible.” interticket continuous integration / what?
  5. interticket continuous integration / why? • easier integration • every

    change is verified by your standards • the result is more cohesive software
  6. interticket CI solutions / why not Jenkins? • plugin ecosystem

    is a pain to manage • hard to setup • UX disaster • pipelines are new
  7. interticket CI solutions / our requirements • versioned • supports

    gitlab • scalable • easy configuration • docker compatibility • lightweight
  8. interticket CI solutions / why GitLab CI? • all our

    requirements were checked • source control & CI in the same place • we love OSS • GitLab is a really nice software, we expect the same from their CI solution
  9. interticket setup / .gitlab-ci.yml • this is the file where

    you configure what CI does with your project • place it in the root of you repository • GitLab will look for this at pushes to your repository
  10. interticket setup / .gitlab-ci.yml example stages: - build - test

    test: stage: test script: - xcodebuild -scheme "$DEBUG_SCHEME" -destination "$SIMULATOR_DEVICE" test only: - branches
  11. interticket setup / gitlab-runner • runners are the heart of

    GitLab CI • open source tool to manage runners • Settings -> CI / CD
  12. interticket pipelines and stuff • pipelines • stages • jobs

    • scheduled pipelines • how do we use it @interticket?
  13. interticket pipelines and stuff / pipelines • runs for each

    pushed change • 1 push = 1 pipeline • 1 pipeline = stages x jobs
  14. interticket pipelines and stuff / stages • 1 pipeline can

    have n number of stages • grouping for your jobs • jobs inside executed in parallel
  15. interticket pipelines and stuff / jobs • status • failed

    • pending • running • cancelled • success • etc • defined in .gitlab-ci.yml
  16. interticket pipelines and stuff / jobs danger: stage: build script:

    - bundle exec danger --fail-on-errors=true merge-request: stage: build script: - bundle exec fastlane merge_request unit-test: stage: test script: - bundle exec fastlane unit_test except: - schedules test: stage: test script: - bundle exec fastlane test only: - schedules crashlytics-beta: stage: deploy script: - bundle exec fastlane beta only: - development except: - schedules
  17. interticket pipelines and stuff / scheduled pipelines • you can

    schedule a pipeline via a cron like environment in GitLab
  18. interticket pipelines and stuff / other stuff • job artifacts

    • support submodules • triggering pipelines • secret variables
  19. interticket pipelines and stuff / how do we use it

    @interticket? on each push to the repository danger static analysis unit tests generate reports on code quality on each merged merge request release to fabric everyday @4AM run UI tests
  20. interticket summary • good for your sanity as it reduces

    risk and makes it easier to deploy code • makes your team happier • generate analysis & reporting • doesn't matter which one you use, but pick one!