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

Trunk-based developmentのすゝめ

Trunk-based developmentのすゝめ

B756246de973beca94fbb1fd858f2688?s=128

Ryuichi Fukami

January 13, 2022
Tweet

Transcript

  1. Trunk-Based Development🐯 Ryuichi Fukami @ryu1sazae @ABEMA iOSνʔϜ಺ษڧձ 
 2022/01/13

  2. ໨࣍ • Trunkͱ͸ • Feature branch development • Trunk-Based development

    • Feature branch development vs Trunk-Based development • ·ͱΊ
  3. Trunkͱ͸ • װɺथװɺ(टɾ࢛ࢶͱ۠ผͯ͠ମͷ)಑ɺ಑ମɺ(΋ͷͷ)ຊମɺओཁ෦ɺ • ϝΠϯɺϝΠϯϥΠϯͱ΋ݺ͹ΕΔ • ͜ͷεϥΠυͰ͸ϝΠϯϒϥϯνͷ͜ͱΛࢦ͢

  4. Feature branch development 1. τϥϯΫ͔ΒϒϥϯνAΛ࡞੒ 2. ͦͷϒϥϯνAͰɺ໨తͷ࣮૷͕׬ྃ͢Δ·Ͱɺ࡞ۀΛߦ͏ɻͦͷؒɺඞཁ Ͱ͋Ε͹ϒϥϯνA͔Βࡉ͔͘ϒϥϯνΛ੾Δ 3. ࣮૷͕׬ྃ

    & ϦϦʔεʹؚΊͯ΋Α͍ͱ൑அ͞Εͨ৔߹ɺϒϥϯνAΛτϥ ϯΫʹऔΓࠐΉ(Feature f lagͰ੍ޚՄೳͳ৔߹͸ϦϦʔελΠϛϯάͰͳ͘ ͯ΋ϚʔδՄೳ)
  5. Trunk-Based development • ιϑτ΢ΣΞ σϦόϦʔͱ૊৫ͷύϑΥʔϚϯεΛվળ͢ΔೳྗͰ͋Γɺ DevOpsͷҰͭ 1. ։ൃऀ͕ࣗ෼ͷ୲౰ࢪࡦΛINVESTͷݪଇʹैͬͯখ͞ͳόονʹ෼ׂ 2. ʮτϥϯΫ͔ΒϒϥϯνΛ੾Γɺ࡞ۀ͕׬ྃ࣍ୈ௚઀τϥϯΫʹϚʔδ͢

    ΔʯΛόονຖʹߦ͏
  6. INVESTͷݪଇ • ಠཱ͍ͯ͠Δ(Independent) 
 όονຖΛՄೳͳݶΓಠཱͤ͞Δ(͋ΔόονΛଞͷόονʹґଘͤ͞ͳ͍)͜ͱͰɺνʔϜϝϯόʔ͕೚ҙͷॱংͰ࡞ۀΛߦ͑ΔΑ͏ʹ͢Δ • ަবͰ͖Δ(Negotiable) 
 ϑΟʔυόοΫΛಘΒΕΔΑ͏ʹ͢Δ e.g.

    ViewͷσβΠφʔ֬ೝ, ࡉ͔͍ػೳͷQA • Ձ஋͕͋Δ(Valuable) 
 ؔ܎ऀʹՁ஋ΛఏڙͰ͖Δ • ݟੵ΋ΓΛՄೳʹ͢Δ(Estimable) 
 ޻਺ݟੵ΋Γ͕Մೳ • খ͘͢͞Δ(Small) 
 ਺͔࣌ؒΒ਺೔ͰτϥϯΫʹϚʔδՄೳ • ςετͰ͖Δ(Testable) 
 ߦͬͨ࡞ۀ͕Կ͔͠Βͷํ๏Ͱظ଴௨Γʹಈ࡞͢Δ͜ͱΛ֬ೝͰ͖Δ e.g. Ϣχοτςετ, QA, ϞχλϦϯάπʔϧ, etc… ࢀߟ: https://cloud.google.com/architecture/devops/devops-process-working-in-small-batches#how_to_work_in_small_batches
  7. Trunk-Based developmentͷϝϦοτ • ϦϦʔε೔ΛؾʹͤͣτϥϯΫʹϚʔδͰ͖ΔτϥϯΫʹϚʔδͰ͖Δ 
 ※ ৔߹ʹΑͬͯ͸Feature f lagͳͲͷ੍ޚʹΑͬͯɺϦϦʔε൛Ͱ͸ػೳΛӅ͢(= μʔΫϩʔϯν͢Δ)

    ඞཁ͋Γ • όον͝ͱͷ։ൃظؒ(= τϥϯΫʹϚʔδ͞ΕΔ·Ͱͷظؒ)͕୹͘ͳΔ • τϥϯΫ(ϝΠϯϒϥϯν)ΛϚʔδͨ͠ࡍʹίϯϑϦΫτ͕ൃੜ͠ʹ͍͘ (ൃੜͨ͠ͱͯ͠΋ඍྔͰࡁΉ) • ίʔυΛৗʹ࠷৽ͷঢ়ଶʹอͭ͜ͱ͕Ͱ͖Δ • τϥϯΫʹϚʔδ͞ΕΔόον1ͭͷมߋ͕খ͍ͨ͞ΊɺόάൃੜͷϦεΫ͕ ܰݮ͞ΕΔ
  8. Trunk-Based developmentͷσϝϦοτ • ၆ᛌͨ͠ϨϏϡʔ͕೉͍͠৔߹͕͋Δ • Feature f lagͷ੍ޚʹ͔ͳΓؾΛ࢖͏ඞཁ͕͋Δ • ϨϏϡʔͷස౓Λ্͛Δඞཁ͕͋Γɺ͜ΕΛϨϏϡϫʔ͕ڐ༰Ͱ͖ͣʹɺPRͷbase-branch͕

    ωετ͠ଓ͚Ε͹ɺϝϦοτΛڗडͰ͖ͳ͘ͳΔ ↪︎ ϨϏϡʔස౓͕௿͍ͱɺ։ൃऀ͸ΑΓଟ͘ͷมߋΛ̍PRʹऩΊΑ͏ͱͯ͠͠·͏ ↪︎ มߋ͕େ͖͍ͱϨϏϡʔͷϞνϕʔγϣϯ͕௿Լɺக໋తͳϛεΛݟಀ͢ՄೳੑUP😭 
 ※ Feature branch developmentͰ΋ಉ༷ʹPRΛ੾Γ෼͚͍ͯΔ৔߹͸ͲͪΒʹ΋౰ͯ͸·Δ ↓ҎԼͷ͜ͱ͕ඞཁ 1. ϨϏϡʔΛͳΔ΂͘ૣ͘ߦ͏จԽ࡞Γ💪 ɹ2. ϨϏϡʔͷ༏ઌॱҐΛܾΊΔ
  9. Feature branch development vs Trunk-Based development Feature branch development Trunk-Based

    development τϥϯΫʹϚʔδ͢ΔࡍʹϦϦʔε೔Λ ؾʹ͢Δඞཁ͕͋Δ͔ ※ Feature fragͳͲͰ੍ޚ͍ͯ͠Δ৔߹͸ࠩ͸ͳ͍ ͋Δ 🥺 ͳ͍ 🥳 
 ※ ৔߹ʹΑͬͯ͸͋Δ τϥϯΫʹϚʔδ͞ΕΔ·Ͱͷظؒ ਺िؒ ~ ਺ϲ݄ 🥺 ਺࣌ؒ ~ ਺೔ 🥳 τϥϯΫʹϚʔδޙͷόάൃੜ֬཰ ߴ 🥺 ௿ 🥳 ίϯϑϦΫτղফίετ ߴ 🥺 ௿ 🥳 ϨϏϡʔස౓(ϨϏϡϫʔͷෛՙ) 
 ※ Feature branch developmentͰ΋ಉ༷ʹϒϥϯνΛ੾Γ෼͚͍ͯΔ 
 ৔߹͸ࠩ͸ͳ͍ ௿ 🥳 ߴ 🥺
  10. Trunk-Based developmentͷ༗ޮੑͷଌΓํ 1. ΞΫςΟϒͳϒϥϯν਺ΛνʔϜͰܾΊͨ਺ҎԼʹͰ͖͍ͯΔ͔ 
 → ϒϥϯν͕࢒Γଓ͚͍ͯΕ͹ɺϒϥϯνΛ࠷৽ͷঢ়ଶʹอ͍ͯͯͳ͍͜ͱʹͳΔ 2. ίϯϑϦΫτ͍ͯ͠Δ࣌ؒ(≒ ίϯϑϦΫτղফʹ͔͔Δ࣌ؒ)ͷ௕͞

    
 → ίϯϑϦΫτղফʹ͕࣌ؒܰݮ͞ΕΔ͜ͱ͕ϝϦοτނʹ 3. τϥϯΫʹϚʔδ͞ΕΔϒϥϯν਺ / τϥϯΫ͔Β੾ΒΕΔϒϥϯν਺ 
 → 1ͷࢦඪΛΛ͞ΒʹݫີԽ 4. ϨϏϡʔϦΫΤετૹ৴ ~ มߋͷঝೝʹ͔͔Δ࣌ؒͷ௕͞ 
 → ͜Ε͕Ͱ͖͍ͯͳ͍ͱ։ൃऀ͸1PRʹؚΉมߋΛେ͖͘͢Δ܏޲ʹ͋Δ
  11. ·ͱΊ • Trunk-Based developmentΛߦ͏͜ͱͰɺόάൃੜ֬཰ & ίϯϑϦΫτղফ ίετ͕ͷͰɺ৺ཧత҆શੑUP ☺ • ϦϦʔε࣌ʹػೳΛӅͨ͢ΊʹɺFeature

    f lagͳͲΛ࢖༻͍ͯ͠ͳ͍νʔϜ΄ ͲɺTrunk-Based developmentͷϝϦοτ͸େ͖͍ 💪 • ͍ͣΕʹͯ͠΋ϝϦοτ͹͔Γ & ಪ೥🐯ͳͷͰɺՄೳͳݶΓTrunk-Based developmentΛ͠Α͏🚀
  12. ࢀߟ • https://cloud.google.com/architecture/devops/devops-tech-trunk-based- development • https://cloud.google.com/architecture/devops/devops-process-working- in-small-batches