Pro Yearly is on sale from $80 to $50! »

新機能作成時に開発ブランチに細かくmergeしていく戦略/merge-strategy-for-new-feature

0ac642c69b7f699a69e3ae3372244dc6?s=47 shibayu36
August 07, 2017

 新機能作成時に開発ブランチに細かくmergeしていく戦略/merge-strategy-for-new-feature

0ac642c69b7f699a69e3ae3372244dc6?s=128

shibayu36

August 07, 2017
Tweet

Transcript

  1. ৽ػೳ࡞੒࣌ʹ։ൃϒϥϯν ʹࡉ͔͘merge͍ͯ͘͠ઓུ ࣾ಺ٕज़ษڧձ 2017/08/03 id:shiba_yu36

  2. ࠷ۙ͸େ͖Ίͳ৽ػೳΛ࡞Δ࣌ɺ ։ൃϒϥϯνʹࡉ͔͘merge͢ ΔઓུΛ࢖͍ͬͯΔͷͰ঺հ

  3. جຊతͳઓུ • Ϣʔβʔʹ৽ػೳ͕ݟ͑ͳ͍Α͏ʹ͢Δ޻෉Λ͠ɺ ৽ػೳͷbranch΋ͲΜͲΜmerge͍ͯ͘͠ • PR͸ՄೳͳݶΓࡉ͔͘ • ࠷ޙʹϢʔβʔʹ৽ػೳΛݟ͑ΔΑ͏ͳϦϦʔεΛ ͢Δ

  4. Πϝʔδ NBTUFS EFWFMPQ G SFMFBTF G G ࠷ऴSFMFBTF

  5. ͍ΖΜͳࣦഊ͔Β ͜ͷઓུʹࢸͬͨ

  6. Α͋͘Δࣦഊύλʔϯͦͷ1 ڊେPRύλʔϯ

  7. ڊେPRύλʔϯ • ৽ػೳͷͨΊͷίʔυΛҰͭͷPRʹ·ͱΊͯ mergeͯ͠ϦϦʔε GCJHCBOH EFWFMPQ    

  8. ࠔΔ͜ͱ • ௒ίϯϑϦΫτ໰୊ • ϨϏϡʔ͢Δ؍఺͕ଟ͗ͯ͢ݟམͱ͢ -> ҆ఆੑ× • ࢦఠ͕ଟ͘ͳΓ͕ͪ ->

    ϨϏϡʔ͞ΕΔଆ͕ർฐ • ϨϏϡʔͷԠुͰർฐ͢Δ -> Ͳͬͪ΋ਏ͍
  9. ײ֮తʹ500ߦ ௒͖͑ͯͨลΓͰਏ͍

  10. Α͋͘Δࣦഊύλʔϯͦͷ2 ৽ػೳϦϦʔεϒϥϯνύλʔϯ

  11. ৽ػೳϦϦʔεϒϥϯν • ৽ػೳͷϦϦʔε༻ϒϥϯνΛҰͭ༻ҙͯ͠ɺͦ͜ ʹPRΛૹΔύλʔϯ • PR͸ࡉ͔͘ϨϏϡʔ͞ΕɺϦϦʔε༻ϒϥϯν΁

  12. GSFMFBTF EFWFMPQ G G

  13. ࠔΔ͜ͱ • ௒ίϯϑϦΫτ໰୊࠶ͼ • ࠷ޙʹϦϦʔεPRΛશνΣοΫ͠ͳ͍ͱ҆৺Ͱ ͖ͳ͍ • ଞͷػೳͰඞཁʹͳͬͨϝιουΛcherry-pick ͠·͘Δ

  14. ࠔΔ͜ͱ • ௒ίϯϑϦΫτ໰୊࠶ͼ • ࠷ޙʹϦϦʔεPRΛશνΣοΫ͠ͳ͍ͱ҆৺Ͱ ͖ͳ͍ • ଞͷػೳͰඞཁʹͳͬͨϝιουΛcherry-pick ͠·͘Δ ಛʹ͜Ε͕΍͹͍

  15. • feature1Ͱfind_hoge_blogͱ͍͏ϝιουΛ࡞Δ • feature2Ͱ΋ಉ͡ϝιουΛ࢖͏͜ͱʹͳͬͨ • find_hoge_blogΛ࡞ͬͨcommitΛcherry-pick͢ Δ? • ͔ͦ͠͠ͷcommitΛcherry-pick͢Δͱมͳίʔ υ΋ฆΕͯ͘Δ

    • ίϐϖ͢Δ͔͠ͳ͍ʁʁʁ
  16. ͍͍ײ͡ʹ΍Δํ๏΋͋Γ ͦ͏͚ͩͲɺͱʹ͔͘େม

  17. ͜ͷΑ͏ͳࣦഊ͔Β ࠷ॳͷઓུΛऔΔΑ͏ʹ

  18. (࠶ܝ)جຊతͳઓུ • Ϣʔβʔʹ৽ػೳ͕ݟ͑ͳ͍Α͏ʹ͢Δ޻෉Λ͠ɺ ৽ػೳͷbranch΋ͲΜͲΜmerge͍ͯ͘͠ • PR͸ՄೳͳݶΓࡉ͔͘ • ࠷ޙʹϢʔβʔʹ৽ػೳΛݟ͑ΔΑ͏ͳϦϦʔεΛ ͢Δ

  19. (࠶ܝ)جຊతͳઓུ • Ϣʔβʔʹ৽ػೳ͕ݟ͑ͳ͍Α͏ʹ͢Δ޻෉Λ͠ɺ ৽ػೳͷbranch΋ͲΜͲΜmerge͍ͯ͘͠ • PR͸ՄೳͳݶΓࡉ͔͘ • ࠷ޙʹϢʔβʔʹ৽ػೳΛݟ͑ΔΑ͏ͳϦϦʔεΛ ͢Δ

  20. ύλʔϯ • ϩδοΫͷϝιου͔Β࡞Δ • Ϣʔβʔʹݟ͑ͳ͍෦෼͔Β࡞Δ • ΤϯυϙΠϯτΛຊ൪Ͱ͸ݟ͑ͳ͍Α͏ʹ͢Δ • Ұ෦ͷHTML͚ͩຊ൪Ͱ͸Ӆ͓ͯ͘͠ •

    ϦχϡʔΞϧύλʔϯ
  21. ύλʔϯ1 ϩδοΫͷϝιου͔Β࡞Δ

  22. • Logic::Blog->find_public_blogsͱ͔ɺLogic::Blog- >createͱ͔͚ͩ࡞ͬͯPR • ϩδοΫΛϢʔβʔʹݟ͑ΔControllerͱ͔Ͱ࢖Θ ͳ͚Ε͹౰વӨڹͳ͠

  23. ஫ҙ • ϢʔεέʔεΛ෼ੳ͓͔ͯ͠ͳ͍ͱɺ࣮ࡍʹ࢖͏࣌ ʹ࢖͑ͳ͍͜ͱʹؾͮ͘ • ࢖͍ํٖࣅίʔυΛॻ͖ͭͭɺͦΕ΋߹ΘͤͯϨ Ϗϡʔͯ͠΋Β͏ͱྑ͍

  24. sub endpoint { my ($req, $res) = @_; # λΠτϧͱઆ໌จΛrequest͔Β

    # ͜͜Ͱvalidate΋͢Δ my ($title, $desc) = validate( title => $req->param('title'), desc => $req->param('desc'), ); # titleͱdescriptionΛ౉͢ Logic::Blog->create(...) }
  25. ύλʔϯ2 Ϣʔβʔʹݟ͑ͳ͍෦෼͔Β࡞Δ

  26. ྫ) MySQLͷLIKEݕࡧ͔ΒɺElasticsearch ʹஔ͖׵͑ͯࣗ༝ͳιʔτ΋ར༻Մೳʹ

  27. ෼ׂ͢Δ 1. Elasticsearchͷ։ൃ؀ڥ࡞Γ(खݩɺ։ൃ؀ڥɺຊ൪) 2. ݕࡧ͍ͨ͠σʔλͷElasticsearch΁ͷಉظ 3. ݕࡧΫΤϦͰͷݕࡧཪଆΛMySQL͔ΒElasticsearchʹ ஔ͖׵͑ 4. ElasticsearchΛ࢖ͬͯιʔτΛ࣮૷

  28. 3൪·Ͱ͸Ϣʔβʔ͔Β͸ݟ͑ ͳ͍ͷͰɺਵ࣌ϦϦʔεՄೳ

  29. ෼ׂ͢Δ 1. Elasticsearchͷ։ൃ؀ڥ࡞Γ(खݩɺ։ൃ؀ڥɺຊ൪) 2. ݕࡧ͍ͨ͠σʔλͷElasticsearch΁ͷಉظ 3. ݕࡧΫΤϦͰͷݕࡧཪଆΛMySQL͔ΒElasticsearch ʹஔ͖׵͑ 4. ElasticsearchΛ࢖ͬͯιʔτΛ࣮૷

  30. ύλʔϯ3 ΤϯυϙΠϯτΛຊ൪Ͱ͸ ݟ͑ͳ͍Α͏ʹ

  31. ༻్ • ৽ػೳΛಛఆͷURLͰఏڙ͢Δ࣌ʹ ࢖͑Δ

  32. ΍Γํ • ։ൃ؀ڥͰ͸URLͰͦͷػೳʹΞΫηε Ͱ͖ΔΑ͏ʹ • ຊ൪؀ڥͰ͸Not Foundʹ͢Δ • ୯ͳΔϑϥά͚ͩͰ࣮૷Մೳ

  33. # /feature1ͰΞΫηεͰ͖ΔΤϯυϙΠϯτ sub feature1 { my ($req, $res) = @_;

    # ։ൃ؀ڥͰͷΈONʹͳΔϑϥά # TODO(feature1_release): ϦϦʔεલʹফ͢ if (!$ENV{CAN_SHOW_NEW_FEATURE}) { return $res->not_found; } ... }
  34. ϑϥά͸؀ڥม਺Ͱ΋ Config::ENVతͳ΋ͷ࢖͏ͷͰ ΋ͳΜͰ΋

  35. ׬੒ͨ͠ΒϑϥάΛ࢖ͬͨif จΛফͨ͠ΒϦϦʔεͰ͖Δ

  36. ύλʔϯ4 Ұ෦ͷHTML͚ͩຊ൪Ͱ͸ Ӆ͓ͯ͘͠

  37. ༻్ • ͋ΔϖʔδͷҰ෦ʹ৽ػೳ௥Ճ ͢Δ࣌

  38. ΍Γํ • ςϯϓϨʔτΤϯδϯΛ࢖͍ͬͯΔ ͱ؆୯ • ϑϥάΛςϯϓϨʔτʹ౉ͯ͠ɺಛఆ HTMLΛফͨ͠Γ͢Δ͚ͩ

  39. ... [%- IF can_show_new_feature %] <section id="feature1"> ... </section> [%-

    END %] ...
  40. JSͱ͔΋ཁૉ͕͋Δ࣌ͷ Έ༗ޮʹ͢ΔͷͰରॲՄೳ

  41. ׬੒ͨ͠ΒϑϥάΛ࢖ͬͨif จΛফͨ͠ΒϦϦʔεͰ͖Δ

  42. ύλʔϯ5 ϦχϡʔΞϧύλʔϯ

  43. ༻్ • ৽ػೳͰϖʔδ͕ΨϥοͱมΘΓɺ ಛఆHTMLΛӅ͢ͱ͔Ͱରॲෆೳͳ࣌

  44. ΍Γํ • ίϯτϩʔϥͱςϯϓϨʔτͷηοτΛ ΋͏1ͭ༻ҙ͢Δ • ৽͍͠ίϯτϩʔϥ͸ຊ൪Ͱ͸ݟ͑ͳ͍ Α͏ʹ • ࠷ޙʹલͷ΍ͭͱͦͬ͝ͱೖΕସ͑Δ

  45. # /feature1_renewalͰΞΫηεͰ͖ΔΤϯυϙΠϯτ sub feature1_renewal { my ($req, $res) = @_;

    # ։ൃ؀ڥͰͷΈONʹͳΔϑϥά # TODO(feature1_release): ϦϦʔεલʹফ͢ if (!$ENV{CAN_SHOW_NEW_FEATURE}) { return $res->not_found; } ... }
  46. feature1_renewal.html lessͱ͔JSͱ͔͸͍͍ײ͡ʹ

  47. • sub feature1_renewal -> sub feature1 • feature1_renewal.html -> feature1.html

    • lessͱ͔΋ҰؾʹҠಈ • ࠷ޙ͚ͩͪΐͬͱେมͰ͸͋Δ
  48. ·ͱΊ • େ͖Ίͳ৽ػೳ࡞Γͷ࣌ͷmergeઓུʹͭ ͍ͯͷ࿩ • ࣦഊܦݧ͔ΒϢʔβʔʹݟ͑ͳ͍Α͏ʹͲ ΜͲΜ։ൃϒϥϯνʹmerge͢ΔΑ͏ʹ ͳͬͨ • ݟ͑ͳ͍Α͏ʹ͢Δύλʔϯ͸͍Ζ͍Ζ