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

FeatureFlagを用いた新機能の安全なマージ&リリース / FeatureFlag

lni_T
October 30, 2019

FeatureFlagを用いた新機能の安全なマージ&リリース / FeatureFlag

lni_T

October 30, 2019
Tweet

More Decks by lni_T

Other Decks in Programming

Transcript

  1. ࣗݾ঺հ w 5XJUUFS!MOJ@5
 (JU)VC!MOJU w .FE1FFS&OHJOFFS ʙ  w ޷͖ͳ3BJMTͷϝιου


    QSFTFODF w ݏ͍ͳ3BJMTͷϝιου
 BDDFQUT@OFTUFE@BUUSJCVUFT@GPS
  2. ղܾΞϓϩʔν͍Ζ͍Ζ  ϒϥϯν͍ͨ΁Μ໰୊  ૊৫ߏ੒ͷมߋ  ίʔυ҆ఆԽ  ػೳΛࡉ͔͘࡞Δ 

    ϦϦʔεՄೳ඼࣭Λอͭ  ຊ൪͜Θ͍໰୊  ݕূ؀ڥͷ੔උ  ຊ൪ʹ͍ۙςετσʔλ  ؀ڥࠩ෼ͷআڈ  ຊ൪Ͱಈ࡞ݕূ͢Δ
  3. ղܾΞϓϩʔν͍Ζ͍Ζ  ϒϥϯν͍ͨ΁Μ໰୊  ૊৫ߏ੒ͷมߋ  ίʔυ҆ఆԽ  ػೳΛࡉ͔͘࡞Δ 

    ϦϦʔεՄೳ඼࣭Λอͭ  ຊ൪͜Θ͍໰୊  ݕূ؀ڥͷ੔උ  ຊ൪ʹ͍ۙςετσʔλ  ؀ڥࠩ෼ͷআڈ  ຊ൪Ͱಈ࡞ݕূ͢Δ
  4. อଘઌ͸HFNͰ੾Γସ͑  ྫ"DUJWF3FDPSEͰ%#ʹอଘ  NJHSBUJPOϑΝΠϧ࡞੒  'MJQQFSར༻࣌ʹ"EBQUFSΛࢦఆ  ଞʹ΋3FEJT .POHP%#ͳͲͳͲ

    adapter = Flipper::Adapters::ActiveRecord.new flipper = Flipper.new(adapter) $ gem install flipper-active_record $ rails g flipper:active_record
  5. ݸผϢʔβʔରԠ΋؆୯ class User def flipper_id "User;#{id}" end end # ----

    Flipper[:stats].enable(user) Flipper[:stats].enabled?(user) # true Flipper[:stats].disable(user) Flipper[:stats].enabled?(user) # false
  6. ར༻ྫ  $POUSPMMFS7JFXͰ࢖͍΍͍͢Α͏ϥοϓ  CFGPSF@BDUJPOͳͲͰ0/0''֬ೝͯ͠ʹ͢ΔͳͲ module DarkLaunch extend ActiveSupport::Concern included

    do helper_method :authorized_feature? end private def authorized_feature?(sym) Flipper[sym].enabled? current_user end end
  7. ·ͱΊ  ػೳ0/0''ͷػߏΛ࡞ͬͯ޾ͤʹͳΖ͏ʂ  'FBUVSF'MBH ·ͨ͸'FBUVSF5PHHMF   3VCZͷ৔߹ʮ'MJQQFSʯͱ͍͏HFN͕࢖͑Δ 

    ଞʹ΋ʮ3PMMPVUʯͱ͔͍Ζ͍Ζ  ΋ͪΖΜࣗલ࣮૷Ͱ΋0,ʂ  ҆શͳϦϦʔεͷʲಛޮༀʳͰ͸ͳ͍Αʂ