Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Drone CI

534 views

Published on

A talk about Drone CI I gave at the local Golang Meetup in Nuremberg, Germany. Just a simple intro how Drone CI works and how to get started.

Published in: Internet
  • Be the first to comment

Drone CI

  1. 1. DRONE CI THOMAS BOERGER Slides are partially taken from @bradrydzewski
  2. 2. WHO IS THOMAS BOERGER? ▸ Software Engineer ▸ Working for SUSE LINUX GmbH ▸ Proud to be a WEBHIPPIE! ▸ Plugin Maintainer of DroneCI ▸ Passionate Ruby developer… ▸ …also passionate about Go!
  3. 3. WHAT DO I WANT TO DO? ▸ I want to run test suites ▸ I want to test code against multiple languages ▸ I want to test code against multiple language versions ▸ I want to test code against multiple databases ▸ I want to test code against multiple database versions ▸ I want to deploy automatically to my hosting provider
  4. 4. DRONE CI FTW!
  5. 5. WHAT DO I WANT TO DO? ▸ I want to customize Drone ▸ I want to publish to [insert service name here] ▸ I want to deploy to [insert service name here] ▸ I want to blame my co-worker every time he breaks a build ▸ I want small Docker images, no giant monolithic images ▸ I need Drone to do something that it doesn’t currently do
  6. 6. EXTERNAL PLUGINS!
  7. 7. BUT THERE ARE PROBLEMS… ▸ Plugins run untrusted code ▸ Plugins are not sandboxed ▸ Plugins need to be installed (by an admin) ▸ Plugins need to be updated (by an admin) ▸ Plugins need to be written in Java (at least for Jenkins) ▸ Plugins should be safer, easier to create and publish!
  8. 8. DOCKER PLUGINS!
  9. 9. PLUGINS build:
 image: golang:1.5
 commands:
 - go test
 
 notify:
 slack:
 webhook: https://slack.com/hooks/…
 channel: dev docker pull plugins/slack
  10. 10. PLUGINS docker run -i plugins/slack << EOF { “repo”: { … }, “build”: { “number”: 1, “status: “success”, … } “args”: { “webhook”: “https://slack.com…”, “channel”: “dev” } } EOF plugins receive structured build details over stdin
  11. 11. PLUGINS ▸ Every plugin is a single Docker container ▸ Mostly written in Go ▸ Other languages are also welcome ▸ Currently ~63 plugins available ▸ Single responsibility ▸ Automatic updates
  12. 12. BUILDS?!
  13. 13. BUILDS ▸ Configuration grouped as… ▸ Build ▸ Compose ▸ Publish ▸ Deploy ▸ Notify
  14. 14. BUILDS Agent Git Clone Container Env Prep Container Go Container Redis Container Slack Container
  15. 15. EXAMPLE 1 build:
 image: golang:1.5
 commands:
 - go test notify:
 slack:
 webhook: https://slack.com/hooks/…
 channel: dev deploy:
 anynines:
 username: octocat@github.com
 password: password
 organization: octocat_github_com
 space: production
 when:
 branch: master publish:
 s3:
 acl: public-read
 region: us-east-1
 bucket: my-bucket-name
 access_key: 970d28f4dd477bc184fbd10b376de753
 secret_key: 9c5785d3ece6a9cdefa42eb99b58986f9095ff1c
 source: files/to/archive
 target: /target/location
  16. 16. EXAMPLE 2 compose:
 database:
 image: postgres
 environment:
 - POSTGRES_USER=postgres
 - POSTGRES_PASSWORD=mysecretpassword build:
 my_tests:
 image: golang:1.5
 commands:
 - sleep 15
 - go test
 my_builds:
 image: golang:1.5
 commands:
 - go build
  17. 17. EXAMPLE 3 build:
 image: golang:$$GO_VERSION
 commands:
 - go get
 - go build
 - go test
 
 compose:
 redis:
 image: redis:$$REDIS_VERSION matrix:
 GO_VERSION:
 - 1.5
 - 1.4
 REDIS_VERSION:
 - 2.6
 - 2.8
 - 3.0
  18. 18. TOOLS!
  19. 19. TOOLS ▸ Libraries and tools, a growing ecosystem ▸ drone-cli for local testing ▸ drone-go for Go based plugins ▸ drone-node fo JS based plugins ▸ drone-python for Python based plugins ▸ drone-ruby for Ruby based plugins (soon)
  20. 20. RESULT?
  21. 21. WHY DRONE CI? ▸ Single binary, written in Go ▸ Lightweight, low memory footprint ▸ Builds run in Docker containers ▸ Build images are downloaded automatically ▸ Pretty flexible plugin system ▸ Simple YAML configuration ▸ Supports any language that can run in Docker ▸ Supports GitHub, Bitbucket, Gitlab and Gogs, more will follow…
  22. 22. QUESTIONS? THANK YOU!

×