Orbs開発の流れ ~はじめの一歩から、組織的にメンテしていくための環境構築まで / Flow of Orbs Development

Orbs開発の流れ ~はじめの一歩から、組織的にメンテしていくための環境構築まで / Flow of Orbs Development

CircleCI ユーザーコミュニティミートアップ #4
https://circleci.connpass.com/event/125622/

3e77f9dbec6a87756d1dbdddab283aee?s=128

Nulab Inc.

May 28, 2019
Tweet

Transcript

  1. $JSDMF$*ϢʔβʔίϛϡχςΟϛʔτΞοϓ /VMBC*OD5PNPOBSJ/",".63" !JLJLLP  0SCT։ൃͷྲྀΕd͸͡ΊͷҰา͔Β ૊৫తʹϝϯς͍ͯͨ͘͠Ίͷ؀ڥߏங·Ͱd

  2. ࣗݾ঺հ w໊લɿதଜ஌੒ !JLJLLP  wॴଐɿψʔϥϘ wਪ͠ϝϯɿͬ͞͠ʔ

  3. None
  4. ࡞ͬͨ0SC w5ZQFUBML0SC https://www.typetalk.com/ja/blog/how-to-integrate-circleci-with-typetalk-to-automatically-notify-of-build-results/

  5. ࡞͖͔͚ͬͨͬ wʮ$IBUXPSLʹ௨஌Λߦ͏$JSDMF$*0SC Λ࡞ͬͨʯΛݟͨ w͋ɺ͜Εಉ͡Α͏ʹνϟοτʹ௨஌͢Δ ΍ͭ࡞Εͦ͏ w(8Ͱ࡞ͬͪΌ͑  ࣮૷ɿ ೔ 

    ݖݶपΓؚΉϦϦʔε ͷௐ੔ɿ ೔
  6. ΞδΣϯμ wεςοϓɿ·ͣ͸ࣗ෼͚ͩͰಈ࡞֬ೝ wεςοϓɿQVCMJTIͯ͠ɺଞͷਓʹ΋ ࢖ͬͯ΋Β͓͏ wεςοϓɿΈΜͳͰϝϯς͍͚ͯ͠Δ Α͏ʹ

  7. ·ͣ͸ಈ࡞֬ೝ wΠϯϥΠϯ0SC͕͓खܰ w version: 2.1 orbs: example: commands: my_command: parameters:

    my_name: type: string steps: - run: echo "hello <<parameters.my_name>>" jobs: build: docker: - image: circleci/node:4.8.2 steps: - example/my_command: my_name: ikikko ΠϯϥΠϯͰల։ ͍ͯ͠Δ෦෼
  8. ·ͣ͸ಈ࡞֬ೝ wखݩͰ࣮ߦ # OrbΛల։ʢ2019/05࣌఺ɺOrbΛϩʔΧϧͰ௚઀࣮ߦͰ͖ͳ͍ͨΊʣ $ circleci config process .circleci/config.yml >

    .circleci/processed.config.yml # ల։͞ΕͨϑΝΠϧΛϩʔΧϧͰ࣮ߦ $ circleci local execute -c .circleci/processed.config.yml ͜͜·Ͱɺ$JSDMF$*Λ௨ ৗͲ͓Γར༻͢Δ஌ࣝͩ ͚Ͱʢ΄΅ʣରԠՄೳ
  9. ΞδΣϯμ wεςοϓɿ·ͣ͸ࣗ෼͚ͩͰಈ࡞֬ೝ wεςοϓɿQVCMJTIͯ͠ɺଞͷਓʹ΋ ࢖ͬͯ΋Β͓͏ wεςοϓɿΈΜͳͰϝϯς͍͚ͯ͠Δ Α͏ʹ

  10. QVCMJTIͯ͠ΈΑ͏ wηοτΞοϓ

  11. QVCMJTIͯ͠ΈΑ͏ wηοτΞοϓ # namespaceͷ࡞੒ $ circleci namespace create <name> <vcs-type>

    <org-name> $ circleci namespace create nulab github nulab # orbͷ࡞੒ $ circleci orb create <namespace>/<orb> $ circleci orb create nulab/typetalk-orb
  12. QVCMJTIͯ͠ΈΑ͏ w1VCMJTI w # खݩͰorbͷಈ࡞֬ೝ͕औΕͨΒɺorb.ymlʹ੾Γग़͓ͯ͘͠ # ։ൃ༻όʔδϣϯͷpublish $ circleci orb

    publish <path> <namespace>/<orb>@<version> $ circleci orb publish orb.yml nulab/typetalk-orb@dev:alpha # ຊՔಇ༻όʔδϣϯͷpublish $ circleci orb publish promote <namespace>/<orb>@<version> <segment> $ circleci orb publish promote nulab/typetalk-orb@dev:alpha major 4FN7FSʹͷͬͱ͍ͬͯΔ NBKPSNJOPSQBUDI
  13. ΞδΣϯμ wεςοϓɿ·ͣ͸ࣗ෼͚ͩͰಈ࡞֬ೝ wεςοϓɿQVCMJTIͯ͠ɺଞͷਓʹ΋ ࢖ͬͯ΋Β͓͏ wεςοϓɿΈΜͳͰϝϯς͍͚ͯ͠ ΔΑ͏ʹ

  14. ΈΜͳͰϝϯςͰ͖ΔΑ͏ʹ wओʹɺେ࿮ͷྲྀΕΛ࿩͠·͢ wࡉ͔͍ઃఆ಺༰͸ɺιʔείʔυͱݟൺ ΂ͳ͕Βฉ͍͍ͯͩ͘͞ w IUUQTHJUIVCDPNOVMBCUZQFUBMLPSC

  15. ΈΜͳͰϝϯςͰ͖ΔΑ͏ʹ wσϑΝΫτͳύοέʔδߏ੒ w src ├── @orb.yml ├── commands │ ├──

    notify.yml │ └── status.yml ├── examples │ ├── notify.yml │ └── status.yml ├── executors │ └── ... └── jobs └── ... # 1ϑΝΠϧ΁ύοέʔδԽʢޙड़ͷCI/CDϫʔΫϑϩʔதͰࣗಈͰద༻͞ΕΔʣ $ circleci config pack src > orb.yml
  16. ΈΜͳͰϝϯςͰ͖ΔΑ͏ʹ wσϑΝΫτ ͳ$*$%ͷϫʔΫϑϩʔ w ެࣜ0SCͷ൒෼Ҏ্͕͜ͷϫʔΫϑϩʔʹԊ͍ͬͯΔ

  17. ΈΜͳͰϝϯςͰ͖ΔΑ͏ʹ wσϑΝΫτ ͳ$*$%ͷϫʔΫϑϩʔ w ެࣜ0SCͷ൒෼Ҏ্͕͜ͷϫʔΫϑϩʔʹԊ͍ͬͯΔ

  18. ϫʔΫϑϩʔ

  19. ϫʔΫϑϩʔ

  20. ϫʔΫϑϩʔ

  21. ϫʔΫϑϩʔ

  22. ࢀߟυΩϡϝϯτ w $JSDMF$*0SCT։ൃ׬શΨΠυ೥౓൛ʛ UJNBLJOʛOPUF w ༗ྉOPUF͚ͩͲɺ͘͢͝Α͘·ͱ·͍ͬͯΔɻ ίʔυ௥͏ͷ͕େมͳΒɺ໎Θͣ՝ۚ͠Α͏ w :`trigger-integration-workflow`ͷ`cleanup- tags:

    true`ΦϓγϣϯͰɺUBHΛஞ࣍੔ཧͰ͖Δ w :`test-in-builds`Λ࢖Θͣͱ΋ɺDPOpHZNM಺Ͱ΂ͨ ॻ͖ͯ͠΋Αͦ͞͏
  23. ࢀߟυΩϡϝϯτ w $SFBUJOHBVUPNBUFECVJME UFTU BOEEFQMPZ XPSLqPXTGPSPSCT QBSU$JSDMF$*#MPH w ͜ͷϫʔΫϑϩʔΛ͸͡Ίɺ0SC࡞੒Λิॿ͢Δ 0SC

    PSCUPPMTPSC Λ࡞ͬͨਓ͕ॻ͍ͨϒϩά w ӳޠ͕ۤ͡Όͳ͚Ε͹ɺͪ͜ΒͰ΋
  24. ΞδΣϯμ wεςοϓɿ·ͣ͸ࣗ෼͚ͩͰಈ࡞֬ೝ wεςοϓɿQVCMJTIͯ͠ɺଞͷਓʹ΋ ࢖ͬͯ΋Β͓͏ wεςοϓɿΈΜͳͰϝϯς͍͚ͯ͠Δ Α͏ʹ

  25. ॴײ wɿࣗ෼Ҏ֎ͷਓ΋৮ΔՄೳੑ͕͋Δϓ ϩδΣΫτʹɺಛʹ༗ޮ w ݸਓϓϩδΣΫτͰ͸ͳ͍ɺձࣾ૊৫ͷ0SCͳͲ w ܰඍͳमਖ਼ʹ͍ͭͯ͸ɺ(JU)VC্Ͱ13ग़ͯ͠ Ϛʔδ͢Δ͚ͩͰे෼ରԠՄೳ w ʢ஍ຯʹ೴಺ϝϞϦ࢖͏ʣϦϦʔε൪߸ͷ෇༩΋

    Φʔτ࠾൪
  26. ॴײ wɿࣗ෼Ҏ֎ͷਓ΋৮ΔՄೳੑ͕͋Δϓ ϩδΣΫτʹɺಛʹ༗ޮ w ௨ৗͳΒɺ(JU)VCͷPXOFSͰͳ͍ͱຊՔಇ༻όʔ δϣϯ͸QVCMJTIͰ͖ͳ͍͕ w PXOFSݖݶͷUPLFOΛ$JSDMF$*্ʹຒΊࠐΜͰ͓͚ ΔͷͰ w13ΛϚʔδͰ͖Δਓ͸୭Ͱ΋QVCMJTIՄೳʹ

  27. ॴײ wར༻ऀͷ੠ʢ$JSDMF$*ॳΊͯͷਓʣ

  28. ॴײ wɿϫʔΫϑϩʔ͕ͪΐͬͱෳࡶʜ w ϫʔΫϑϩʔ͕ͭʹ෼͔ΕͯͯɺͦΕΛͭͳ͙ͷ ʹ(JUͷUBHΛ࢖͍ͬͯͯɺ௚ײతʹ෼͔ΓͮΒ͍ w ಉ͡Α͏ͳهड़͕ෳ਺͋ͬͯɺ৑௕

  29. ॴײ wɿ(JUͷϦϦʔεͱ0SCͷόʔδϣϯͷ ඥ͚͕ͮ෼͔ΓͮΒ͍ w ҰԠɺ(JUͷλά෇͚͸͞ΕΔͷͰɺϦϦʔεϖʔ δ͔Β௥͏͜ͱ͸Ͱ͖Δ

  30.  0SCࣗ਎ͷ$*$%Λ੔͑ͯ ΈΜͳͰ0SCΛ৮͍ͬͯ͜͏