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

GitOps: Using Git as a deployment mechanism

GitOps: Using Git as a deployment mechanism

Git is used by a lot of developers to keep track of their changes and to collaborate on projects. While the source code is typically hosted on a central server (Github, Gitlab, etc...), this server is generally not used for more advanced workflows.

Because most of the tasks you perform on a repository are very descriptive, you can use them to trigger build and deployment events. Pushing code to the server could trigger a deploy to the testing server, pushing a tag to the server could trigger a deploy to production, and so on! If you use semantic versioning, you can even target more specific deployment servers.

Git is already part of your development workflow, start using it as part of your deployment workflow: GitOps.

4ce755c7f3ddf4e0c92e1aeaeea7677b?s=128

Jachim Coudenys

November 14, 2017
Tweet

Transcript

  1. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e GitOps Using Git

    as a deployment mechanism Jachim Coudenys jachimcoudenys@gmail.com @coudenysj
  2. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  3. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  4. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  5. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  6. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e GitOps Using Git

    as a deployment mechanism
  7. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  8. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Quiz Repository Commit

    Cloning Branch Tag Remote Push Merge Request
  9. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Remotes Remotes

  10. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Other features Code

    Repository Tickets Merge Requests Wiki ... Running idle most of the time
  11. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Important Git "events"

    & "concepts" special branches merge commits tags ...
  12. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e git-flow

  13. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  14. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e develop The main

    development branch Ideally this branch only contains merge commits
  15. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  16. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e master This branch

    represents code in production This branch must only contain merge commits
  17. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  18. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e feature/* New development

    is done in a feature branch This branch is started from develop and will be merged back into develop when it’s done By using a feature branch, you can leverage merge request
  19. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  20. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e release/* This branch

    sits between develop and master (getting ready for a new production release) This branch is short-lived and totally optional
  21. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  22. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e hotfix/* When something

    is wrong in production, a fix can be produced via a hotfix branch This branch is started from master and will be merged into both master and develop
  23. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  24. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Summary develop master

  25. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Continuous Integration

  26. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e In software engineering,

    continuous integration (CI) is the practice of merging all developer working copies to a shared mainline several times a day. -- https://en.wikipedia.org/wiki/Continuous_integration
  27. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Extreme programming (XP)

    adopted the concept of CI and did advocate integrating more than once per day – perhaps as many as tens of times per day. -- https://en.wikipedia.org/wiki/Continuous_integration
  28. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Avoiding Integration Hell

  29. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Key Points 1.

    Commit Early, Commit Often 2. Never Commit Broken Code 3. Fix build failures immediately 4. Fail Fast 5. Act on metrics 6. Build in every target environment 7. Create artefacts from every build
  30. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Continuous Delivery

  31. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Continuous delivery (CD)

    is a software engineering approach in which teams produce software in short cycles, ensuring that the software can be reliably released at any time. -- https://en.wikipedia.org/wiki/Continuous_delivery
  32. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e It aims at

    building, testing, and releasing software faster and more frequently. The approach helps reduce the cost, time, and risk of delivering changes by allowing for more incremental updates to applications in production. A straightforward and repeatable deployment process is important for continuous delivery. -- https://en.wikipedia.org/wiki/Continuous_delivery
  33. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Deployment pipeline

  34. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  35. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Continuous Delivery ≠

    Continuous Deployment Continuous deployment: every change is automatically deployed to production. Continuous delivery: ensures every change can be deployed to production. In order to do continuous deployment one must be doing continuous delivery.
  36. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e GitOps?

  37. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Coined by Weaveworks

  38. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Operations by Pull

    Requests
  39. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Git as the

    Source of Truth version control history peer review rollback
  40. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e SvnOps at my

    first job Mimic server filesystem in SVN Rsync new files to server Restart services (linked to file path)
  41. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e ChatOps How GitOps

    relates to ChatOps
  42. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  43. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e ChatOps, a term

    widely credited to GitHub, is all about conversation-driven development. By bringing your tools into your conversations and using a chat bot modified to work with key plugins and scripts, teams can automate tasks and collaborate, working better, cheaper and faster. -- https://www.pagerduty.com/blog/what-is-chatops/
  44. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e While in a

    chat room, team members type commands that the chat bot is configured to execute through custom scripts and plugins. These can range from code deployments to security event responses to team member notifications. The entire team collaborates in real-time as commands are executed. -- https://www.pagerduty.com/blog/what-is-chatops/
  45. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Visibility Across The

    Board
  46. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Automate Manual Tasks

  47. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e GitOps in combination

    with ChatOps Git has better history Git(lab) has a more bundled view Report to chat, finale GO from chat ...
  48. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  49. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Pipelines

  50. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e .gitlab-ci.yml

  51. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  52. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Semantic Versioning

  53. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Semantic versioning is

    a way of applying versions to your software so it’s clear what impact it may have. https://blog.jachim.be/2017/07/git-flow-dtap-semver/
  54. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Given a version

    number MAJOR.MINOR.PATCH, increment the: MAJOR version when you make incompatible API changes, MINOR version when you add functionality in a backwards-compatible manner, and PATCH version when you make backwards-compatible bug fixes. Additional labels for pre-release and build metadata are available as extensions to the MAJOR.MINOR.PATCH format.
  55. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Only the master

    branch receives tags
  56. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Merge develop in

    master: MAJOR.MINOR tag (only increment the MAJOR number is the change is big enough)
  57. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Merge hotfix branch

    into master: increase the PATCH version
  58. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  59. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e DevOps How GitOps

    relates to DevOps
  60. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  61. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e DevOps toolchain Code

    — code development and review, source code management tools, code merging Build — continuous integration tools, build status Test — continuous testing tools that provide feedback on business risks Package — artifact repository, application pre-deployment staging Release — change management, release approvals, release automation Configure — infrastructure configuration and management, Infrastructure as Code tools Monitor — applications performance monitoring, end–user experience
  62. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Combell Autogit

  63. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e

  64. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Further reading How

    we're building GitLab into the complete DevOps toolchain. Beyond CI/CD: GitLab's DevOps vision Auto DevOps Auto DevOps brings DevOps best practices to your project by automatically configuring your build, test, code quality assurance, review apps, deployment, and monitoring in a single environment.
  65. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Summary Put everything

    it Git Don't do anything manually Put the server to work! Take a look at Gitlab CI/CD
  66. Jachim Coudenys - - jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e Thank you Jachim

    Coudenys jachimcoudenys@gmail.com @coudenysj https://joind.in/talk/d8b4e