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

Trunk-based developmentのすゝめ

Trunk-based developmentのすゝめ

Ryuichi Fukami

January 13, 2022
Tweet

More Decks by Ryuichi Fukami

Other Decks in Programming

Transcript

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

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

    & ϦϦʔεʹؚΊͯ΋Α͍ͱ൑அ͞Εͨ৔߹ɺϒϥϯνAΛτϥ ϯΫʹऔΓࠐΉ(Feature f lagͰ੍ޚՄೳͳ৔߹͸ϦϦʔελΠϛϯάͰͳ͘ ͯ΋ϚʔδՄೳ)
  3. 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
  4. Trunk-Based developmentͷϝϦοτ • ϦϦʔε೔ΛؾʹͤͣτϥϯΫʹϚʔδͰ͖ΔτϥϯΫʹϚʔδͰ͖Δ 
 ※ ৔߹ʹΑͬͯ͸Feature f lagͳͲͷ੍ޚʹΑͬͯɺϦϦʔε൛Ͱ͸ػೳΛӅ͢(= μʔΫϩʔϯν͢Δ)

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

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

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

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

    f lagͳͲΛ࢖༻͍ͯ͠ͳ͍νʔϜ΄ ͲɺTrunk-Based developmentͷϝϦοτ͸େ͖͍ 💪 • ͍ͣΕʹͯ͠΋ϝϦοτ͹͔Γ & ಪ೥🐯ͳͷͰɺՄೳͳݶΓTrunk-Based developmentΛ͠Α͏🚀