Drone CI

Drone CI

社内勉強会で Drone について話した資料です

92ce4587cc8465736433e698b1e50aaa?s=128

Daisuke Fujita

October 20, 2015
Tweet

Transcript

  1. Drone CI 2015-10-20 @dtan4 http://www.humanitarianstudies.no/wp-content/uploads/2014/06/drone-sunset.jpg

  2. 2छྨͷ Drone CI • Drone.io • CI as a Service

    • Drone • OSS • @dtan4 ͕ಋೖ͠Α͏ͱฃಆ͍ͯ͠Δ΍ͭ
  3. Drone.io https://drone.io

  4. None
  5. Drone.io • CI as a Service ͱͯ͠ͷ Drone • OSS

    ͸ແྉɺPrivate Repository ͸༗ྉ • GitHub, Bitbucket, Google Code ରԠ • ޷͖ͳΑ͏ʹςετεΫϦϓτΛ͔͚Δ • ϦϙδτϦϧʔτͷ .yml ͡Όͳ͍… • S3, Heroku, Dotcloud, … ʹσϓϩΠՄೳ https://drone.io/
  6. Drone.io

  7. Drone.io

  8. Drone.io … • ʢͨͿΜʣDocker ૸Βͳ͍ & ૸ͬͯͳ͍ • ͍·Ͳ͖ .yml

    ͰεΫϦϓτॻ͚ͳ͍ͷ͸… • ଞΑΓ͍҆ͱ͍͏Θ͚Ͱ΋ͳ͍ • m1.small + Jenkins ΑΓ͍҆ͱ͍͏͚ͩ • ςετΛฒྻʹ͢Δͷ͸ CircleCI ΑΓߴ͍ • Jenkins ͷ࢖͍উखΛΫϥ΢υαʔϏεͰɺ
 ͱ͍͏ਓ޲͚ʁ
  9. Drone drone/drone

  10. Drone • OSS ͷ Docker-based CI • Ϗϧυ͝ͱʹಠཱͨ͠ Docker Container

    ཱ͕ͭ • DB ͱ͔΋Ϗϧυ͝ͱʹཱͭ • Drone.io ͷ @bradrydzewski ͕Φʔφʔ • Golang ੡ drone/drone
  11. Drone • GitHub, GH:E, Bitbucket, GitLab ʹରԠ • ϦϙδτϦϧʔτͷ .drone.yml

    ʹ
 ςετεΫϦϓτΛॻ͘ • OSS CI ͩͱ Drone ͱ GitLab CI ͘Β͍͔͠
 ରԠͯ͠ͳ͍ • Heroku, S3, … ΁ͷσϓϩΠରԠ • Email, HipChat, Slack, … ΁ͷ௨஌ʹରԠ drone/drone
  12. Jenkins #1 #2 #3 #4

  13. Drone #1 #2 #3 #4

  14. Version of Drone • Version 0.3 (master) • ݱࡏͷ stable

    • 1ϲ݄͘Β͍์ஔ͞ΕͯΔ • Version 0.4 (0.4.0) • Ӷҙ։ൃத • .drone.yml ͷޓ׵ੑ͸ͳ͍ drone/drone
  15. .drone.yml image: ruby:2.2.3 cache: - vendor/bundle env: - RAILS_ENV=test services:

    - postgres script: - bundle install -j4 --path=vendor/bundle - bundle exec rake db:test:prepare - bundle exec rspec 0.3 Α͋͘Δ Rails Drone ެࣜΠϝʔδ or
 ެ։͞Ε͍ͯΔΠϝʔδ ͜͜΋޷͖ͳΠϝʔδ࢖͑Δ
  16. .drone.yml cache: mount: - vendor/bundle compose: database: image: postgres:9.4 build:

    image: ruby:2.2.3 environment: - DATABASE_USER=postgres - RAILS_ENV=test commands: - bundle install -j4 --path=vendor/bundle - bundle exec rake db:test:prepare - bundle exec rspec 0.4 Α͋͘Δ Rails
  17. ςετը໘ 0.3 Ϗϧυ్தͰ ΩϟϯηϧͰ͖ͳ͍…

  18. ςετը໘ 0.4

  19. Secret Variables • 0.3, 0.4 ͱ΋ʹ Web UI ্ͰઃఆՄೳ •

    wercker Έ͍ͨʹӅͯ͠͸͘Εͳ͍ • 0.4 ͩͱ .drone.sec ͱ͍͏ϑΝΠϧʹ҉߸Խͯ͠
 ϦϙδτϦʹஔ͚Δ • travis encrypt ͱ
 ࣅͨײ͡
  20. Docker on Drone • جຊతʹͰ͖ͳ͍ • ςετίϯςφ͕ /var/run/docker.sock
 Ϛ΢ϯτͯ͠ͳ͍ͨΊ •

    ଞͷςετίϯςφΛফͤͯ͠·͏໰୊ • Docker in Docker ͳΒͰ͖Δ…ʁ (#380) • ߟ͑ͳ͓ͤͱ͍͏هࣄ΋͋Δ • DOCKER_HOST Λผϗετʹ޲͚ͯ
 docker build ΍ docker-compose ͢Δͱ͔…ʁ http://jpetazzo.github.io/2015/09/03/do-not-use-docker-in-docker-for-ci/
  21. ॴײ • ࣗલͰ CI ࣋ͭͳΒ͜ΕҰ୒ • Docker ίϯςφͱͯ͠ಈ͔͢ͷ΋༰қ • ΠϚυΩͷ

    CI as a service ͷػೳΛͪΌΜͱ
 ࢖͑Δ • ·ͩ·ͩ։ൃ్্ • Drone 0.4 ͱ PostgreSQL ͷ૬ੑ͕ѱ͍ • ͍͟ͱͳͬͨΒιʔεಡΜͰ௚ͤΔ • OSS! OSS!