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

Drone CI

Drone CI

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

Daisuke Fujita

October 20, 2015
Tweet

More Decks by Daisuke Fujita

Other Decks in Technology

Transcript

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

    • Drone • OSS • @dtan4 ͕ಋೖ͠Α͏ͱฃಆ͍ͯ͠Δ΍ͭ
  2. Drone.io • CI as a Service ͱͯ͠ͷ Drone • OSS

    ͸ແྉɺPrivate Repository ͸༗ྉ • GitHub, Bitbucket, Google Code ରԠ • ޷͖ͳΑ͏ʹςετεΫϦϓτΛ͔͚Δ • ϦϙδτϦϧʔτͷ .yml ͡Όͳ͍… • S3, Heroku, Dotcloud, … ʹσϓϩΠՄೳ https://drone.io/
  3. Drone.io … • ʢͨͿΜʣDocker ૸Βͳ͍ & ૸ͬͯͳ͍ • ͍·Ͳ͖ .yml

    ͰεΫϦϓτॻ͚ͳ͍ͷ͸… • ଞΑΓ͍҆ͱ͍͏Θ͚Ͱ΋ͳ͍ • m1.small + Jenkins ΑΓ͍҆ͱ͍͏͚ͩ • ςετΛฒྻʹ͢Δͷ͸ CircleCI ΑΓߴ͍ • Jenkins ͷ࢖͍উखΛΫϥ΢υαʔϏεͰɺ
 ͱ͍͏ਓ޲͚ʁ
  4. Drone • OSS ͷ Docker-based CI • Ϗϧυ͝ͱʹಠཱͨ͠ Docker Container

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

    ʹ
 ςετεΫϦϓτΛॻ͘ • OSS CI ͩͱ Drone ͱ GitLab CI ͘Β͍͔͠
 ରԠͯ͠ͳ͍ • Heroku, S3, … ΁ͷσϓϩΠରԠ • Email, HipChat, Slack, … ΁ͷ௨஌ʹରԠ drone/drone
  6. Version of Drone • Version 0.3 (master) • ݱࡏͷ stable

    • 1ϲ݄͘Β͍์ஔ͞ΕͯΔ • Version 0.4 (0.4.0) • Ӷҙ։ൃத • .drone.yml ͷޓ׵ੑ͸ͳ͍ drone/drone
  7. .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
 ެ։͞Ε͍ͯΔΠϝʔδ ͜͜΋޷͖ͳΠϝʔδ࢖͑Δ
  8. .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
  9. Secret Variables • 0.3, 0.4 ͱ΋ʹ Web UI ্ͰઃఆՄೳ •

    wercker Έ͍ͨʹӅͯ͠͸͘Εͳ͍ • 0.4 ͩͱ .drone.sec ͱ͍͏ϑΝΠϧʹ҉߸Խͯ͠
 ϦϙδτϦʹஔ͚Δ • travis encrypt ͱ
 ࣅͨײ͡
  10. 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/
  11. ॴײ • ࣗલͰ CI ࣋ͭͳΒ͜ΕҰ୒ • Docker ίϯςφͱͯ͠ಈ͔͢ͷ΋༰қ • ΠϚυΩͷ

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