Slide 1

Slide 1 text

From massive pull requests to trunk-based development in Ruby Vesa Vänskä Euruko 2022

Slide 2

Slide 2 text

The pain of long-lived branches

Slide 3

Slide 3 text

No content

Slide 4

Slide 4 text

Vesa Vänskä

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

Offtopic curl -s https://api.github.com/users/vesan | grep created_at "created_at": "2008-04-03T16:32:37Z",

Slide 7

Slide 7 text

GitHub Flow

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

Trunk-based development

Slide 11

Slide 11 text

What is trunk-based development? Source-control branching & collaboration model Collaboration happens in trunk (aka master/main) No other long-lived branches

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

Caveat: This talk is about services.

Slide 14

Slide 14 text

"It will never work!" "This feature will take months to build" "Broken code will go to production all the time" "But we are not Google" 😞

Slide 15

Slide 15 text

"This feature will take months to build. My branch needs to be long-lived."

Slide 16

Slide 16 text

Feature flags

Slide 17

Slide 17 text

Feature flags <%# erb file %> <% if Flipper.enabled?(:widgets, current_user) %> <%= render "widgets" %> <% end %>

Slide 18

Slide 18 text

Feature flags # rails console Flipper.enable_actor :widgets, user Flipper.enable_group :widgets, :beta_testers Flipper.enable_percentage_of_actors :widgets, 2 Flipper.enable :widgets

Slide 19

Slide 19 text

Feature flags # routes.rb resources :widgets, constraints: -> { |request| request.session[:user_id] && Flipper.enabled?(:widgets, User.find(request.session[:user_id]) }

Slide 20

Slide 20 text

"Broken code will go to production all the time."

Slide 21

Slide 21 text

Continuous Integration server

Slide 22

Slide 22 text

Monitoring

Slide 23

Slide 23 text

ActiveSupport::Notifications

Slide 24

Slide 24 text

ActiveSupport::Notifications ActiveSupport::Notifications.instrument("widgets.manufacture", widget_id: widget.id) do # Run the code end ActiveSupport::Notifications.instrument("widgets.manufacture_failed", widget_id: widget.id) ActiveSupport::Notifications.subscribe("widgets.manufacture") do |name, start, finish, id, payload| push_event_to_monitoring(name, start, finish, id, payload) end

Slide 25

Slide 25 text

No content

Slide 26

Slide 26 text

"We are not Google"

Slide 27

Slide 27 text

CI/CD

Slide 28

Slide 28 text

CI CD

Slide 29

Slide 29 text

"Any improvements made anywhere besides the bottleneck are an illusion." Eliyahu Goldratt, Theory of Constraints

Slide 30

Slide 30 text

No content

Slide 31

Slide 31 text

State of DevOps report

Slide 32

Slide 32 text

DORA metrics

Slide 33

Slide 33 text

DORA metrics Deployment Frequency Lead Time for Changes Change Failure Rate Time to Restore Service

Slide 34

Slide 34 text

State of DevOps survey 2022 results

Slide 35

Slide 35 text

State of DevOps survey 2022 results 😮

Slide 36

Slide 36 text

State of DevOps survey 2022 results 😮😬

Slide 37

Slide 37 text

State of DevOps survey 2022 results 😮😬😅

Slide 38

Slide 38 text

State of DevOps survey 2022 medium tier Deployment frequency: Between once per week and once per month Lead time to changes: Between one week and one month Time to restore service: Between one day and one week Change failure rate: 16%–30%

Slide 39

Slide 39 text

Start experimenting!

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

Resources to get further The site https://trunkbaseddevelopment.com State of DevOps report https://cloud.google.com/blog/products/devops-sre/dora-2022-accelerate-state-of-devops-report-now- out Check out Kisko Labs virtual booth

Slide 42

Slide 42 text

Thank you! Vesa Vänskä · twitter.com/vesan · [email protected]

Slide 43

Slide 43 text

Images DHH Github image: https://signalvnoise.com/posts/2486-bootstrapped-profitable-proud-github GitHub Flow image: https://github.com/SvanBoxel/release-based-workflow/issues/1 GitHub logo: https://www.flaticon.com/free-icon/github-logo_25231

Slide 44

Slide 44 text

No content