$30 off During Our Annual Pro Sale. View Details »

動作確認のための社内アプリ配信サービスを新たに作った話 / iOSDC 2018

Tomohiro Moro
September 01, 2018

動作確認のための社内アプリ配信サービスを新たに作った話 / iOSDC 2018

iOSDC 2018 9/1 16:20〜 Track C の発表資料です。

Tomohiro Moro

September 01, 2018
Tweet

More Decks by Tomohiro Moro

Other Decks in Programming

Transcript

  1. ಈ࡞֬ೝͷͨΊͷࣾ಺ΞϓϦ഑৴ αʔϏεΛ৽ͨʹ࡞ͬͨ࿩ 2018/09/01 iOSDC Japan 2018 Track C ໜ࿊ ஐେ

    @slightair 1
  2. ࣗݾ঺հ • ໜ࿊ ஐେ / @slightair • ΫοΫύουגࣜձࣾ ٕज़෦ ϞόΠϧج൫άϧʔϓॴଐ

    • ࣾ಺ͷ։ൃ؀ڥ੔උɺαʔϏε։ൃ෦ॺͷٕज़తࢧԉ͕ۀ຿ 2
  3. ࠓ೔ͷ͓࿩ • ๻ͨͪͷࣾ಺ΞϓϦ഑৴ͷ࢖͍ํ • ࠓ·Ͱར༻͖ͯͨ͠ΞϓϦ഑৴αʔϏε • ৽͘͠࡞ͬͨΞϓϦ഑৴αʔϏεͷ঺հ • վળ͞Εͨ఺ɾؾΛ͚ͭͨ఺ •

    ΞϓϦ഑৴ʹؔ͢Δ޻෉ͷ঺հ 3
  4. ։ൃ͍ͯ͠ΔΞϓϦɺ͍࣮ͭػʹ͍Εͯ৮Δʁ • ࢼ͠ʹ࡞ͬͯΈͨػೳΛ։ൃؔ܎ऀΈΜͳͰ৮ΔͨΊ • मਖ਼ͷPRΛग़ͨ͠ͱ͖ • ௥Ճɾमਖ਼ͨ͠ػೳͷಈ࡞֬ೝ • ૢ࡞ײͷ֬ೝ •

    ϦϦʔεલͷಈ࡞֬ೝ 4
  5. ೔ৗੜ׆ͷதͰͷ࢖͍৺஍Λࢼ͍ͨ͠ • ࣮ࡍʹΞϓϦ͕࢖ΘΕΔͰ͋Ζ͏λΠϛϯάͰΞϓϦΛࢼ͍ͨ͠ • ྉཧ͠ͳ͕Β • ҠಈதͳͲɺྉཧͷ͜ͱΛߟ͑ͦ͏ͳλΠϛϯά • ৽ΞϓϦɾ৽ػೳͳΒͳ͓͞Βɺ࢖ΘΕΔ૝ఆͷγʔϯͰ •

    ࣾһͷࢲ෺ͷεϚʔτϑΥϯʹ΋։ൃ൛ͷΞϓϦΛೖΕͯࢼͤΔ Α͏ʹ͍ͯ͠Δ 5
  6. DeployGate Enterprise • ಺੡ͱҧ͍഑৴αʔϏεࣗମͷϝϯς͕ෆཁͳͷ͸͏Ε͍͠ • Enterprise൛Ͱ͸૊৫ͷϝϯόʔɾάϧʔϓ؅ཧ͕Ͱ͖Δ • ར༻ऀͷୀ৬࣌ͳͲΛߟ͑ΔͱඞਢɺͰ΋؅ཧ͸େม… • άϧʔϓ؅ཧ͸͠͹Β͕͘Μ͹ͬͯ࢖ͬͯΈ͚ͨͲɺ๻ͨͪ

    ͷ࢖͍ํͩͱࡉ͔͍άϧʔϓ෼͚͸ඞཁͳ͔ͬͨ 6
  7. TestFlight • ങऩલ͸େม͓ੈ࿩ʹͳ͍ͬͯͨ • Apple ެࣜͷ࢓૊Έ • ࣾ಺഑৴Ͱ͸ Internal Tester

    ͕༻్ͱ͍͚ۙΕͲ • ࢲ෺Ͱ࢖͍ͬͯΔ AppleID ΛձࣾͷνʔϜʹొ࿥ͨ͘͠ͳ͍ • ٯʹձࣾͰऔͬͨ AppleID Λࢲ෺ͷ iPhone ʹೖΕͯ࢖͏͔ͱ͍͏ͱɺͦ͏΋ͳΒͳ͍1 • ͙͢ʹෆ࠾༻ʹͳͬͨ 1 Android/PlayStoreͷํ͸ΞΧ΢ϯτपΓͷ༥௨͕ޮ͖ͦ͏ͩͬͨɻAlphaϦϦʔεͷػೳ͸ར༻Ͱ͖ͦ͏ɻ 7
  8. ࢖͍͍ͨਓ͕ٸʹ૿ݮ͢Δͱ͖େม໰୊ • ʮ։ൃ͖ͯͨ͠ΞϓϦ͕େମͰ͖ͨͷͰࣾ಺ςετ൛഑৴։࢝͠ ͨΑʂΈΜͳ࢖ͬͯʂʯʢࣾ಺ϒϩάʣ • → ഑৴αʔϏεͷΞΧ΢ϯτ௥Ճґཔ͕େྔൃੜ • ࿮ͦΜͳʹۭ͖͕ͳ͍ͧɺϝϯόʔ੔ཧ͠ͳ͖Ό… •

    ͠͹Β͘͢Δͱར༻ࣗମ͕མͪண͍ͪΌ͏ • ར༻ස౓తʹશࣾһʹΞΧ΢ϯτల։͢Δͷ΋ݫ͍͠ 8
  9. ಉ͡ΞϓϦͰ΋ෳ਺ͷઃఆͰ ผΞϓϦͱͯ͠഑৴͢Δ • ΞϓϦʹΑͬͯ৭ʑͳ഑৴ઃఆ͕͋Δ • BETA: ࠷৽ͷmasterϒϥϯνͷ಺༰Λ഑৴͢Δ • TEST: ϦϦʔε௚લͷಈ࡞֬ೝ΍ࢼ࡞ஈ֊ͷػೳΛ

    ௥Ճ͠ػೳͷݕূ͢Δ • PR: PR୯ҐͰमਖ਼ɾػೳ௥Ճͷಈ࡞֬ೝΛߦ͏ • ಉ͡ΞϓϦ͸ҰՕॴ·ͱΊ͓͖͍ͯͨ • ઀ଓઌ2ͷมߋ͸ΞϓϦ಺ͷσόοάπʔϧͰมߋͰ͖ ΔΑ͏ʹ͍ͯ͠Δ 2 produc)onɺstagingɺ֤։ൃऀͷ։ൃ؀ڥͳͲ 9
  10. ๻Β͕ཉ͍͠৚݅ɺղܾ͍ͨ͠໰୊ • ഑৴αʔϏεͷҡ࣋ɾ؅ཧෛ୲ΛՄೳͳݶΓ཈͍͑ͨ • ΞΧ΢ϯτ؅ཧΛ͕Μ͹Γͨ͘ͳ͍ • ࣾ಺ͷਓؒͳΒ࢖͑Δ͘Β͍ͷ੍ݶͰे෼ͦ͏ɺάϧʔϓͳͲࡉ͔͍ઃఆ· Ͱ͸ඞཁͳ͔ͬͨ • ֤ࣗͷՈͳͲɺࣾ֎Ͱ΋ΠϯετʔϧͰ͖ΔΑ͏ʹ͍ͨ͠

    • ଞͷࣾ಺πʔϧͷΞΧ΢ϯτɾΞΫηεݖݶ؅ཧͱ·ͱ·ͬͯΔͱ͏Ε͍͠ • ଟ਺ͷΞϓϦɺͦΕΒʹෳ਺ͷ഑৴ઃఆ͕͋ͬͯ΋͖Ε͍ʹ·ͱΊ͍ͨ 10
  11. haneda • iOS/Android ޲͚ͷ಺੡ͷࣾ಺ΞϓϦ ഑৴αʔϏε • ΞϓϦҰཡϖʔδͱΞϓϦৄࡉϖʔδ ͕͋Δ͘Β͍ͷγϯϓϧͳ಺༰ • ઃఆόϦΤʔγϣϯΛkindͱݺͼɺ

    ΞϓϦ୯ҐͰ·ͱΊΔ • ࣾ಺ωοτϫʔΫ ·ͨ͸ G Suiteೝূ Λ௨ͬͨ୺຤ͷΈΞΫηε͕Մೳ 11
  12. 12

  13. haneda ͷߏ੒ • AWS S3ʹϏϧυͨ͠όΠφϦͱϝλσʔλΛهड़ͨ͠JSONΛ഑ஔ͢Δ • CIͰϑΝΠϧੜ੒ͱΞοϓϩʔυΛߦ͏ͨΊͷfastlane ac4onΛ༻ҙͨ͠ • WebΞϓϦ

    • S3ͷJSONΛݩʹHTMLΛϨϯμϦϯά͢Δ • iOSΞϓϦμ΢ϯϩʔυ༻ͷmanifestΛಈతੜ੒͢Δ • DB͸࢖͍ͬͯͳ͍ • ೝূʹ͸ࣾ಺ڞ௨ͷϦόʔεϓϩΩγΛར༻͢Δ3 3 groupad(ࣾ಺ϒϩάɾWiki)ͳͲͷࣾ಺πʔϧͱڞ௨ͷΞΫηε੍ޚɻղઆهࣄ 13
  14. haneda ʹΑΓվળ͞Εͨ͜ͱ • G Suite ೝূʹͨ͠ͷͰೖࣾ࣌ʹࣾ಺ΞΧ΢ϯτ͕ൃߦ͞ΕΔͱಉ ࣌ʹར༻Մೳʹͳͬͨ4 • ଞͷࣾ಺πʔϧ܈ͱಉ͡ΞΧ΢ϯτɾΞΫηεݖݶͰར༻Մೳ ʹɺࣾ಺֎໰Θ༷ͣʑͳ৔ॴͰશࣾһ͕ར༻Ͱ͖Δ

    • લड़ͷΑ͏ͳγϯϓϧͳߏ੒ͷͨΊ഑৴αʔϏεࣗମͷ؅ཧෛ୲ ΋ͦ͜·Ͱ্͕ΒͣʹࡁΜͩ 4 DeployGate ͕ G Suite ࿈ܞʹରԠͨ͠ࡍʹܧଓར༻΋ݕ౼͕ͨ͠ɺҰ෦ػೳ͕଍Βͣݟૹͬͨ 14
  15. in-house fastlane ϓϥάΠϯ • in-house fastlane ϓϥάΠϯ5Λ࡞Γࣾ಺഑৴Λ৽نΞϓϦ։ൃʹಋ ೖ͠΍͍͢؀ڥʹͨ͠ • haneda

    ͷ S3 όέοτ໊ͳͲͷઃఆ஋͸ϓϥάΠϯʹؚΊɺ࠷௿ ݶͷઃఆ͚ͩͰΞοϓϩʔυͰ͖ΔΑ͏ʹ • Beta ͳͲͷΑ͘࢖͏όοδΛ͚ͭͨΓɺάϨΠεέʔϧʹ͢Δͳ ͲΞΠίϯΛՃ޻͢Δ ac5on ΋෇ଐ͢Δ 5 ࣾ಺ Gem Server Ͱ؅ཧɺfastlane ʹ֎෦ Gem Server ͔ΒϓϥάΠϯΛಋೖͰ͖Δ࢓૊ΈΛ௥Ճͨ͠ 15
  16. ϓϥάΠϯͷΞΫγϣϯ܈ • upload_mobile_app_to_s3 / haneda • pre5y_badge • save_adhoc_archive •

    Cer;ficates / Profiles • generate_provisioning_profile • generate_apns_cer;ficate • GitHub API wrappers • create_issue • add_labels • add_comment • has_label 16
  17. fastlane match ʹΑΔূ໌ॻɾ伴؅ཧ • ূ໌ॻɺൿີ伴ɺProvisioning Profile ͳͲΛ҉߸Խͯ͠ϦϙδτϦͰ؅ཧ͠ ͍ͯΔ6 • ΞϓϦͷ਺ɾkind

    ͕૿͑ͯ΋Ұݩ؅ཧͰ͖Δ • EnterpriseProgramͷݖݶ͕ڧ͍ূ໌ॻͳͲΛΈͩΓʹ։ൃऀʹ౉ͨ͘͠ͳ ͍ɺCIϚγϯͷΈΞΫηεͰ͖Ε͹Α͍ • CIϚγϯ͕ෳ਺͋ͬͯ΋Πϯετʔϧͷख͕ؒ૿͑ͳ͍ 6 iOSΞϓϦͷαϒϛοτࣗಈԽͱূ໌ॻ؅ཧͷޮ཰Խ - ΫοΫύου։ൃऀϒϩά 17
  18. ΞϓϦ഑৴ͷͨΊͷ lane ఆٛྫ lane :build_and_upload_to_haneda do app_identifier = base_app_identifier +

    '-beta' match(app_identifier: app_identifier, type: "enterprise", git_branch: "enterprise", readonly: true) pretty_badge(kind: 'beta', grayscale: false) gym(...) haneda( app_id: base_app_identifier, app_name: 'Overcookpad', kind_id: 'beta' ) end 18
  19. ಛఆͷϥϕϧ͕͍ͭͨPRͷΈ഑৴ॲཧΛߦ͏ lane :pull_request do |params| pr_number = params[:pr]&.to_i UI.user_error!('Pull request

    number required') unless pr_number # (Ϣχοτςετ/֤छ෼ੳͳͲ...) next unless has_label(id: pr_number, label: 'InHouseBuild') build_and_upload_to_s3(staging: true, build_kind: :pr) build_url = Actions.lane_context[SharedValues::UPLOADED_MOBILE_APP_BUILD_URL] add_comment(id: pr_number, body: "Build uploaded to #{build_url}") end 19
  20. ·ͱΊ • ࣾ಺ͷΞϓϦ഑৴ͷ࢖͍ํʹ߹Θͤͯɺ಺੡ͷ഑৴αʔϏε haneda Λ࡞ͬͨ • Ͱ͖ΔݶΓγϯϓϧͳߏ੒Ͱߏங͠ɺ಺੡Ͱ͋ͬͯ΋؅ཧෛ୲͕૿͑ͳ͍Α ͏ʹ޻෉ͨ͠ • ଞͷࣾ಺Webπʔϧͱͷ࢖͍উखͱͦΖ͑Δ͜ͱ͕Ͱ͖ɺΞΧ΢ϯτ؅ཧͷ

    ໰୊΋ղܾͨ͠ • ΞϓϦ։ൃϓϩδΣΫτ͕૿͑ͯ͘Δͳ͔ɺ഑৴αʔϏεΛ͢͹΍͘ಋೖ͢ ΔͨΊͷ࢓૊Έ΋߹ΘͤͯͦΖ͑Δ͜ͱ͕Ͱ͖ͨ 20