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

From massive pull requests to trunk-based devel...

From massive pull requests to trunk-based development in Ruby

Massive, long-lived pull requests are often such a headache. In this session we go through a move into a trunk-based development source-control workflow which eliminates the need for these “code avalanche” pull requests.

After short introduction of trunk-based development and the fears people have for implementing it, we will go through concrete examples, lifted from a production system, of code, architecture, and workflows to tackle those fears when working on improving the development and deployment happiness of the team working on the application.

After this talk the attendee are emboldened to start their own trunk-based development journey or excited to apply some of the techniques from the talk to their existing development processes and codebases.

Vesa Vänskä

October 25, 2022
Tweet

More Decks by Vesa Vänskä

Other Decks in Programming

Transcript

  1. What is trunk-based development? Source-control branching & collaboration model Collaboration

    happens in trunk (aka master/main) No other long-lived branches
  2. "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" 😞
  3. 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
  4. Feature flags # routes.rb resources :widgets, constraints: -> { |request|

    request.session[:user_id] && Flipper.enabled?(:widgets, User.find(request.session[:user_id]) }
  5. 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
  6. 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%
  7. 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