Save 37% off PRO during our Black Friday Sale! »

Codepipelineの話

Abb5e2feabc47b19f18cb16afe0893fd?s=47 Shun Satou
October 03, 2018

 Codepipelineの話

Abb5e2feabc47b19f18cb16afe0893fd?s=128

Shun Satou

October 03, 2018
Tweet

Transcript

  1. Codepipelineͷ࿩ ιχʔωοτϫʔΫίϛϡχέʔγϣϯζגࣜձࣾ ࠤ౻ॠ 2018.10.3 JAWSUG Yokohama DevOps࿮LT

  2. ୭ʁ ࠤ౻ɹॠ ιχʔωοτϫʔΫίϛϡχέʔγϣϯζגࣜձࣾ
 ʢ2016ʙʣ ςϨϏ΍ϨίʔμʔͷαʔόʔαΠυΛ୲౰͍ͯ͠·͢

  3. ୭ʁ ԣ඿ࡏॅͰ͢ ʢԣ඿Ξϐʔϧʣ

  4. ஶॻʢڞஶʣ 2015/3 ग़൛ 2016/4 ग़൛ 2018/3 ग़൛ վగ

  5. Codepipeline

  6. ࢖ͬͯ·͔͢ʁ

  7. Codepipelineͷར༻ঢ়گ Dev/Staging/ProdͳͲɺશ؀ڥ߹Θͤͯ40ຊఔ౓ͷPipeline CodePipeline ECS EC2 Lambda Github Dev/Staging Push Dev/Staging͸GithubΛTriggerʹσϓϩΠ

  8. Codepipelineͷར༻ঢ়گ Dev/Staging/ProdͳͲɺશ؀ڥ߹Θͤͯ40ຊఔ౓ͷPipeline CodePipeline ECS EC2 Lambda Prod ࣮ߦ Prod͸खಈͰPipelineΛ࣮ߦ →ެ։೔ͳͲɺλΠϛϯάΛௐ੔͢Δඞཁ͕͋ΔͨΊ

  9. ͱ͍͏ײ͡Ͱɺ ͦͦ͜͜࢖͖ͬͯ·ͨ͠

  10. ྑ͍఺΍ࠔͬͯΔ͜ͱʹ͍ͭͯ TipsͬΆ͘ޠ͍ͬͯ͜͏ͱࢥ͍·͢

  11. Codepipelineͷྑ͍఺

  12. Codepipelineͷྑ͍఺ • Sourceͷॊೈੑ • GithubҎ֎ͷSourceΛࢦఆͰ͖Δ • S3ͷτϦΨʔͰͷىಈ͸࢖͍ॴ͕ଟ͍ • Codepipelineͷෆ଍෦෼ΛิͬͯΔ͚ͩͱ΋ݴ͑Δ͕ɾɾɾ
 ʢޙड़ʣ

    • ෳ਺ͷϦϙδτϦΛInputʹͰ͖Δ • Github ͱ S3ΦϒδΣΫτΛ྆ํInputʹ͢Δ͜ͱ΋Ͱ͖Δ
  13. Codepipelineͷྑ͍఺ • JenkinsΛ࢖͑Δʢ࢖͑ͯ͠·͏ʁʣ • طʹBuild΍Deployͷδϣϒ͕͋Δ৔߹͸ɺͦͷ··࢖͑Δ • ͱΓ͋͑ͣɺCodepipelineʹ৐ͤͯɺޙͰCodeBuildʹ
 Ҡ͕͢Ͱ͖Δ ͜Ε͕͋ͬͨͷͰCodepipelineΛબ୒ͨ͠෦෼͕͋Δ Build/DeployͳͲͷ֤࡞ۀ͸JenkinsͰδϣϒԽ͞Ε͓ͯΓɺ

    ͦΕͳΓʹ࡞Γࠐ·Ε͍ͯͨͷͰҠߦ͕؆୯Ͱ͸ͳ͔ͬͨ
  14. Codepipelineͷྑ͍఺ • AWSͷଞαʔϏεͱͷ࿈ܞ • CodeBuildɺECSɺCloudFormationɺLambdaͳͲ • ଞͷCI/CDαʔϏεͰ΋ɺCLI౳ͰAPIୟ͚͹͍͍ͷͰɺ ػೳతʹ͜͜ʹେ͖ͳ༏Ґੑ͸ͳ͍ͱࢥ͏ • IAMͷೝূճΓͰAccessKey/SecretKeyΛ౉͞ͳͯ͘


    ͍͍͘Β͍
  15. Codepipelineͷྑ͍఺ • CloudWatch EventͰͷPipelineىಈ • Github΁ͷPushҎ֎ʹ΋༷ʑͳΠϕϯτͰىಈͰ͖Δ • ࠓͷͱ͜S3͔͠࢖ͬͯͳ͍͕ɺଞʹ΋Կ͔࢖͑ͦ͏ͳ ؾ͸͍ͯ͠Δ

  16. CodepipelineͷࠔΓ͝ͱ

  17. CodepipelineͷࠔΓ͝ͱ • GitͷTagࢦఆͰιʔεΛऔಘͰ͖ͳ͍ • TagࢦఆͰιʔεΛऔΓ͍ͨέʔε͕݁ߏ͋Δ • Dev/StagingͰݕূ͕ऴΘͬͨόʔδϣϯΛ
 TagͰࢦఆͯ͠σϓϩΠ͢ΔɹɹͳͲ Github CodePipeline

    Jenkins S3 TagΛऔಘ Upload JenkinsͱS3Ͱ΍ͬͯΔ
  18. CodepipelineͷࠔΓ͝ͱ • ύϥϝʔλʔΛࢦఆͯ͠PipelineΛ࣮ߦ͍ͨ͠ • ʢͦ΋ͦ΋ɺͦͷӡ༻͕ਖ਼͍͔͠͸ஔ͍ͱ͍ͯʣ • ؀ڥ໊ʢDev/Staging/ProdʣͳͲɺ
 ύϥϝʔλʔͰ౉͍ͨ͠΋ͷ͕͋Δ • S3ʹYAMLΛஔ͍ͨΓɺLambdaͰύϥϝʔλʔΛ


    ੜ੒ͯ͠ରॲ CodePipeline parameter.yml source
  19. Codepipelineͷ࢖͍উख • ϦϦʔε౰ॳ͸ʮ୭͕࢖͏Μͩ…ʯͱ͍͏ҹ৅ͩͬͨ • CodeBuildʗLambda࿈ܞ͕ग़ͨ͜ͱʹΑΓɺ
 PipelineαʔϏεͱͯ͠࢖͑ΔΑ͏ʹͳ͖ͬͯͨ • Ұ൪ͷࠔΓ͝ͱͩͬͨCodeBuildʹҰ͔ͭ͠
 ΠϯϓοτΛ౉ͤͳ͍ͱ͍͏੍໿͕͕͋ͬͨɺ
 ࠷ۙվળ͞Εͨ

    • CodeBuild Multi Input Source
  20. CodepipelineΛબ୒͢Δ͔Ͳ͏͔ • Circle CI΍Gitlab CIͱਅਖ਼໘͔ΒԥΓ߹ͬͨΒ
 ෛ͚Δͱࢥ͍·͕͢ɺ࠷௿ݶ͸໰୊ͳ͍
 • AWSͷαʔϏε্Ͱ࢖͑Δͷ͸ɺ΍͸Γڧ͍ • Ϣʔβʔ؅ཧ΍ίετ؅ཧΛAWSӡ༻ͷԆ௕ͰͰ͖Δ

    • AWSͰӡ༻͍ͯͯ͠ଞͷαʔϏε࢖ͬͯͳ͍ͳΒ
 ࠷ॳͷબ୒ࢶʹͳΔ
  21. ൃද͸Ҏ্Ͱ͢

  22. Ұॹʹಇ͍ͯ͘ΕΔํืूͯ͠ΔͷͰ ڵຯ͋Ε͹ੋඇ͓ئ͍͠·͢ • AWSΨϯΨϯ࢖͍͍ͨ • SRE΍Γ͍ͨ • ιχʔ੡඼ʹؔΘΓ͍ͨ • ςϨϏ͕޷͖ɹɹɹɹɹɹͳͲ

    https://www.gpcareers.sony.co.jp/000/u/job.phtml? job_code=149&company_code=8