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

PIpeline template for CloudFoundry

Ryoma Kai
November 14, 2017

PIpeline template for CloudFoundry

Ryoma Kai

November 14, 2017
Tweet

More Decks by Ryoma Kai

Other Decks in Programming

Transcript

  1. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ ࣗݾ঺հ  d Ϡϑʔγϣοϐϯά'&#&։ൃɾӡ༻ dݱࡏ $MPVE'PVOESZࣾ಺ӡ༻ˠϢʔβʔαϙʔτ $3&

     $PODPVSTFࣾ಺ӡ༻ˠϢʔβʔαϙʔτ $3& :BIPP+BQBOϓϥοτϑΥʔϜΤϯδχΞ 5XJUUFSIUUQTUXJUUFSDPNMFHOPI (JU)VCIUUQTHJUIVCDPNMFHOPI ߕ൹ྒྷഅ 3ZPNB,BJ
  2. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ  Ϡϑʔʹ͍ͭͯ • ઃཱ • ैۀһ਺ ਓ

    ݱࡏ  ࣄۀ಺༰ • Πϯλʔωοτ޿ࠂ • FίϚʔε ϠϑΦΫ γϣοϐϯά  • ձһαʔϏε Χʔυ ϓϨϛΞϜ  • ϝσΟΞࣄۀ χϡʔε ϙʔλϧ
  3. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ  Ϡϑʔͷ$PODPVSTFʹ͍ͭͯ • શࣾ޲͚ϓϥοτϑΥʔϜͱͯ͠ӡ༻த • $MPVE'PVOESZ΍ϥΠϒϥϦͷ$*$%༻్Ͱ׆༻ •

    ݄࣍ɾෆఆظϋϯζΦϯηϛφʔ࣮ࢪ • ࣾ಺༻3FTPVSDF 5BTL %PDLFS*NBHFఏڙͳͲ • $'"QQͷ$*$%༻QJQFMJOFZNMςϯϓϨͷఏڙ ࠓ೔͸͜͜ͷ࿩
  4. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ  ར༻্ͷ՝୊ • ΩϟονΞοϓ͢Δ·Ͱ͕௕͍ʜ • ٯʹ෼͔ͬͯ͠·͏ͱγϯϓϧ •

    ࣗ෼Ͱॻ͘ͳΒ%PDLFSͷΩϟονΞοϓ΋ඞཁ • αϯϓϧ΍׆༻ࣄྫ͕ͳ͍ͱΠϝʔδ͕఻ΘΒͳ͍ • QJQFMJOFZNMΛҰ͔Βॻ͘ͷ͸େมʜ • ϚΠΫϩαʔϏεԽ͍͚ͯ͠͹ɺ͓͓Αͦ΍Δ͜ͱ͸ ࣅ௨ͬͯ͘Δ͕ɺͦ͜·Ͱͷϋʔυϧ͕ߴ͍
  5. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ  %PDLFS*NBHFͷཚཱ  • %PDLFS*NBHFΛࣾ಺ͷ1SJWBUF3FQPTJUPSZͰ؅ཧ • $PODPVSTFͰͭͷ+PCʹ࢖ΘΕΔ%PDLFS*NBHF͸


    ͍͍ͩͨࣅͨΑ͏ͳ΋ͷ͕ଟ͍ • VOJUUFTU!QIQͳΒɺQIQ DPNQPTFS QMVHJO  • ηϯτϥϥΠζ͍ͯͨ͠ํ͕ޮ཰͕ྑͦ͞͏ • 0GGJDJBM͕ͳ͍ͱօ͕%PDLFS*NBHFΛ࡞ͬͯ͠·͏ • %PDLFS)VCͷ0GGJDJBMSFQP͕େྔʹDMPOF͞ΕΔݒ೦ ‣ ϦεΫ؅ཧ͕ࠔ೉ʹͳΔ
  6. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ  %PDLFS*NBHFͷཚཱ  • #VJMEQBDL TUBDL DGMJOVYGT

    Ͱ
 ৗʹϏϧυ͕Ͱ͖ΔΑ͏ʹ഑ྀ͍ͨ͠ • BMQJOFϕʔεͷ*NBHFͩͱMJC TP ͕ͳ͍ͷͰɺ
 MJCʹґଘ͢ΔςετίʔυΛॻ͘ͱࣦഊ͢Δ • ͦΜͳϢχοτςετΛॻ͘ͳͱ͍͏࿩΋͋Δ͕ɺ
 ਺ઍਓͷΤϯδχΞ͕͍ΔاۀͰ͋Ε͹
 ଟ༷ͳ࢖ΘΕํΛ͞ΕΔͷ͸༰қʹਪଌ͞ΕΔ
  7. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ  %PDLFS*NBHF W • #VJMEQBDLຊମͱɺCJODPNQJMFΛؚΉTIΛ %PDLFS*NBHF಺ʹ഑ஔ •

    ͦΕΛ5BTL͔Β࣮ߦ͢ΔܗͰར༻͢Δ %PDLFSGJMF FROM cloudfoundry/linuxfs2 ADD ./buildpack /tmp/buildpack ADD exec-compile.sh 
 /bin/exec-compile.sh VOJUUFTUZNM image_resource: type: docker-image source: {repository: php-image} run: path:/bin/exec-compile.sh args: - repo - ci/unit-test.sh ':*IUUQTTQFBLFSEFDLDPNGNZ DPODPVSTFJOZBIPPKBQBO
  8. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ  %PDLFS*NBHF಺ͷ TIͩͱෆ໌ྎ • FYFDDPNQJMFTIͷத͕ύοͱ ݟͩͱԿΛ΍ͬͯΔͷ͔ෆ໌ྎ •

    ࣮͸ґଘੑղܾ΋΍ͬͯΔ  • %PDLFSGJMFʹ΋UBTLʹ΋ DPNQPTFSJOTUBMM͕ͳ͍ͷʹ
 ͳͥಈ͘ͷ ײ͕ग़΍͍͢ • QMVHJOͳͲͷಋೖ͕ࠔ೉ QSFTUJTTJNP QBDLHJTUKQ VOJUUFTUZNM image_resource: type: docker-image source: {repository: php-image} run: path: /bin/exec-compile.sh args: - repo - ci/unit-test.sh VOJUUFTUTI #!/bin/sh composer test
  9. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ  ‛͜͏ॻ͖͍ͨΑͶ • %PDLFS*NBHFͷCVJME࣌ʹ
 CJODPNQJMFΛ࣮ߦࡁʹ • QBUIͰVOJUUFTUTIΛ௚ࢦఆ

    • ґଘੑղܾΛ5BTLͷ໾໨ʹ • $BDIFT΋࢖͑Δʂ VOJUUFTUZNM image_resource: type: docker-image source: {repository: php-image} run: path: repo/ci/unit-test.sh #!/bin/sh composer install composer test VOJUUFTUTI %PDLFSGJMF FROM cloudfoundry/linuxfs2 ADD ./buildpack /tmp/buildpack RUN /tmp/buildpack/bin/compile
  10. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ  Ϣʔβଆ͕ཧղͮ͠Β͍ঢ়گʹͳ͍ͬͯ͘ w lࣾ಺Ͱ΋Θ͔ͬͯΔਓ͚͕ͩ13Ͱ͖Δঢ়گʹͳΔ w ͦ΋ͦ΋ςϯϓϨͱ͍͏ೝ஌͕ബ͍ٙ࿭ w

    ຊ൪ύΠϓϥΠϯͷ࣮ӡ༻஌ݟ͸ɺզʑΑΓ΋
 ѹ౗తʹαʔϏεଆͷΤϯδχΞͷํ͕ߴ͍ w 1VMM3FRVFTUͷϋʔυϧ΋ՄೳͳݶΓ௿ͯ͘͠ɺ
 ΋ͬͱϑΟʔυόοΫΛूΊΒΕΔΑ͏ʹ͍ͨ͠
  11. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ  $'"QQʹ͓͚ΔWFSTJPO੒Ռ෺ͷఆٛ • ࠓͷQSPEVDUJPOͷWFSTJPOΛͲ͜ͰݟΔ΂͖͔ • NBTUFSϒϥϯνΛ௚઀QVTI͢ΔαʔϏε͸
 ൺֱతগ਺೿

    • ଞͷύοέʔδػߏͰґଘϥΠϒϥϦ͝ͱ • ύοέʔδ͍ͯͨ͜͠ͱ͕ଟ͔ͬͨ • ୅ସͰ͖Δ࢓૊ΈΛԿʹ࣋ͨͤΔ΂͖͔ • ͦ΋ͦ΋ɺ੒Ռ෺ΛͲ͜·Ͱͱ͢Δ΂͖͔
  12. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ  ‛੒Ռ෺ఆٛΛ࠶ఆٛ • ίϯύΠϧࡁόΠφϦ΍ґଘϥΠϒϥϦͳͲ΋
 ؚΊͨ΋ͷΛ੒Ռ෺ͱͯ͠࠶ఆٛ • ͦΕΛछྨͷ3FTPVSDFͱͯ͠ѻ͑ΔΑ͏ͳ


    ࣾ಺ઐ༻ͷ3FTPVSDFͱͯ͠։ൃ͠ɺ
 PVUͰEJTUSJCVUFͰ͖Δ࢓૊Έʹͨ͜͠ͱͰɺ
 Ϣʔβʹͱͬͯೝࣝ͠΍͍͢୯Ґʹͳͬͨ • WFSTJPO൪߸͸()&্ͷ3FMFBTFͱͯ͠ఆٛ • ()&ͰMBUFTU3FMFBTFΛൃߦ͢ΔͱDGQVTI
  13. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ  %PDLFS*NBHF W • #VJMEQBDLͷCJODPNQJMF GJOBMJ[F ͷ݁ՌΛ


    ؚΉ%PDLFS*NBHFΛCVJMEQBDLߋ৽ͷλΠϛϯά Ͱ౎౓CVJME͢ΔΑ͏ʹͨ͠ • 5BTL͔Βγϯϓϧʹ࣮ߦͰ͖ΔΑ͏ʹͳͬͨ %PDLFSGJMF FROM cloudfoundry/linuxfs2 ADD ./buildpack /tmp/buildpack RUN /tmp/buildpack/bin/compile VOJUUFTUZNM image_resource: type: docker-image source: {repository: php-image} run: path: repo/ci/unit-test.sh
  14. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ  ݁ՌతʹͲ͏ͳ͔ͬͨʁ • QJQFMJOFZNMΛ͋·Γ৮͍ͬͯͳ͔ͬͨਓͰ΋ɺ
 ਺࣌ؒͰطଘͷSFQP͔Βຊ൪"QQΛQVTIͰ͖Δ • ׆༻ࣄྫ͕࣍ʑ૿͑ͭͭ͋Δ݁Ռɺ


    ৽͍͠ςϯϓϨʔτʹରͯ͠ɺαʔϏεଆͰ
 ଍Γͳ͍ػೳΛ૿΍ͦ͏ͱ͍͏ಈ͖΋ݟ͖͑ͯͨ • ࣗ෼ͨͪࣗ਎ͷQJQFMJOFZNMߋ৽਺΋֨ஈʹ૿͑ͨ • େม͍͍ײ͡
  15. $PQZSJHIU $ :BIPP+BQBO$PSQPSBUJPO"MM3JHIUT3FTFSWFEແஅҾ༻ɾసࡌېࢭ  ࠓޙࣾ಺޲͚ʹ΍Γ͍ͨ͜ͱ • पล1'ʹର͢ΔઃఆࣗಈԽ • 8FC)PPL "DDFTT5PLFO

    %FQMPZ,FZ FUD • 7BVMU$SFE)VCͰͷDSFEFOUJBM؅ཧ • $7&ରԠʹର͢Δ$'"QQͷSFTUBHFࣗಈԽ EFW  • DGͷCVJMEQBDLߋ৽Λݕ஌͢Δ3FTPVSDFΛ࡞Γ͍ͨ • &&ςετ؀ڥ੔උ • $IBU0QTCZ$PODPVSTF