drone

module
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 7, 2014 License: Apache-2.0

README

Drone is a Continuous Integration platform built on Docker

Build Status GoDoc

Getting Started

Contributing

Interested in contributing? Great! Please read our contributor guidelines.


System

Drone is tested on the following versions of Ubuntu:

  • Ubuntu Precise 12.04 (LTS) (64-bit)
  • Ubuntu Raring 13.04 (64 bit)

Drone's only external dependency is the latest version of Docker (0.8)

Setup

Drone is packaged and distributed as a debian file. You can download an install using the following commands:

$ wget http://downloads.drone.io/latest/drone.deb
$ sudo dpkg -i drone.deb
$ sudo start drone

Once Drone is running (by default on :80) navigate to http://localhost:80/install and follow the steps in the setup wizard.

IMPORTANT You will also need a GitHub Client ID and Secret:

I'm working on a getting started video. Having issues with volume, but hopefully you can still get a feel for the steps:

https://docs.google.com/file/d/0By8deR1ROz8memUxV0lTSGZPQUk

Using MySQL

By default, Drone use sqlite as its database storage. To use MySQL/MariaDB instead, use -driver flag and set it to mysql. You will need to set your DSN (-datasource) in this form:

    user:password@tcp(hostname:port)/dbname?parseTime=true

Change it according to your database settings. The parseTime above is required since drone using time.Time to represents TIMESTAMP data. Please refer to [1] for more options on mysql driver.

You may also need to tweak some innodb options, especially if you're using utf8mb4 collation type.

    innodb_file_format = Barracuda
    innodb_file_per_table = On
    innodb_large_prefix = On

Please consult to the MySQL/MariaDB documentation for further information regarding large prefix for index column and dynamic row format (which is used in Drone).

[1] https://github.com/go-sql-driver/mysql

Builds

Drone use a .drone.yml configuration file in the root of your repository to run your build:

image: mischief/docker-golang
env:
  - GOPATH=/var/cache/drone
script:
  - go build
  - go test -v
services:
  - redis
notify:
  email:
    recipients:
      - brad@drone.io
      - burke@drone.io

Images

In the above example we used a custom Docker image from index.docker.io mischief/docker-golang

Drone also provides official build images. These images are configured specifically for CI and have many common software packages pre-installed (git, xvfb, firefox, libsqlite, etc).

Official Drone images are referenced in the .drone.yml by an alias:

image: go1.2   # same as bradrydzewski/go:1.2

Here is a list of our official images:

# these two are base images. all Drone images are built on top of these
# these are BIG (~3GB) so make sure you have a FAST internet connection
docker pull bradrydzewski/ubuntu
docker pull bradrydzewski/base

# clojure images
docker pull bradrydzewski/lein             # image: lein

# dart images
docker pull bradrydzewski/dart:stable      # image: dart

# erlang images
docker pull bradrydzewski/erlang:R16B      # image: erlangR16B
docker pull bradrydzewski/erlang:R16B02    # image: erlangR16B02
docker pull bradrydzewski/erlang:R16B01    # image: erlangR16B01

# gcc images (c/c++)
docker pull bradrydzewski/gcc:4.6          # image: gcc4.6
docker pull bradrydzewski/gcc:4.8          # image: gcc4.8

# go images
docker pull bradrydzewski/go:1.0           # image: go1
docker pull bradrydzewski/go:1.1           # image: go1.1
docker pull bradrydzewski/go:1.2           # image: go1.2
docker pull bradrydzewski/go:1.3           # image: go1.3

# haskell images
docker pull bradrydzewski/haskell:7.4      # image: haskell

# java and jdk images
docker pull bradrydzewski/java:openjdk6    # image: openjdk6
docker pull bradrydzewski/java:openjdk7    # image: openjdk7
docker pull bradrydzewski/java:oraclejdk7  # image: oraclejdk7
docker pull bradrydzewski/java:oraclejdk8  # image: oraclejdk8

# node images
docker pull bradrydzewski/node:0.10        # image node0.10
docker pull bradrydzewski/node:0.8         # image node0.8

# php images
docker pull bradrydzewski/php:5.5          # image: php5.5
docker pull bradrydzewski/php:5.4          # image: php5.4

# python images
docker pull bradrydzewski/python:2.7       # image: python2.7
docker pull bradrydzewski/python:3.2       # image: python3.2
docker pull bradrydzewski/python:3.3       # image: python3.3
docker pull bradrydzewski/python:pypy      # image: pypy

# ruby images
docker pull bradrydzewski/ruby:2.0.0       # image: ruby2.0.0
docker pull bradrydzewski/ruby:1.9.3       # image: ruby1.9.3

# scala images
docker pull bradrydzewski/scala:2.10.3     # image: scala2.10.3
docker pull bradrydzewski/scala:2.9.3      # image: scala2.9.3

Environment

Drone clones your repository into a Docker container at the following location:

/var/cache/drone/src/github.com/$owner/$name

Please take this into consideration when setting up your build commands, or if you are using a custom Docker image.

Git Command Options

You can specify the --depth option of the git clone command (default value is 50):

git:
  depth: 1

Deployments

Drone can trigger a deployment at the successful completion of your build:

deploy:
  heroku:
    app: safe-island-6261

publish:
  s3:
    acl: public-read
    region: us-east-1
    bucket: downloads.drone.io
    access_key: C24526974F365C3B
    secret_key: 2263c9751ed084a68df28fd2f658b127
    source: /tmp/drone.deb
    target: latest/

  swift:
    username: someuser
    password: 030e39a1278a18828389b194b93211aa
    auth_url: https://identity.api.rackspacecloud.com/v2.0
    region: DFW
    container: drone
    source: /tmp/drone.deb
    target: latest/drone.deb
    branch: master

Drone currently has these deploy and publish plugins implemented (more to come!):

deploy

publish

Publish plugins can be limited to a specific branch using the branch configuration as seen above in the swift example. If you do not specify a branch all branches will be published, with the exception of Pull Requests.

Notifications

Drone can trigger email, hipchat and web hook notification at the beginning and completion of your build:

notify:
  email:
    recipients:
      - brad@drone.io
      - burke@drone.io

  webhook:
    on_success: true
    on_failure: true
    urls:
      - http://my-deploy-hook.com

  hipchat:
    room: support
    token: 3028700e5466d375
    on_started: true
    on_success: true
    on_failure: true

Databases

Drone can launch database containers for your build:

services:
  - cassandra
  - couchdb
  - couchdb:1.0
  - couchdb:1.4
  - couchdb:1.5
  - elasticsearch
  - elasticsearch:0.20
  - elasticsearch:0.90
  - neo4j
  - neo4j:1.9
  - mongodb
  - mongodb:2.2
  - mongodb:2.4
  - mysql
  - mysql:5.5
  - postgres
  - postgres:9.1
  - rabbitmq
  - rabbitmq:3.2
  - redis
  - riak
  - zookeeper

If you omit the version, Drone will launch the latest version of the database. (For example, if you set mongodb, Drone will launch MongoDB 2.4.)

You can also launch custom Docker containers using standard docker notation:

services:
  - dockerfile/rethinkdb # same as dockerfile/rethinkdb:latest
  - barnybug/elasticsearch:1.0.1

NOTE 1: database and service containers are exposed over TCP connections and have their own local IP address. If the socat utility is installed inside your Docker image, Drone will automatically proxy localhost connections to the correct IP address.

NOTE 2: avoid running services that use the same ports. For example, don't specify multiple versions of Elastic Search since the port will already be in use.

Caching

Drone can persist directories between builds. This should be used for caching dependencies to decrease overall build time. Examples include your .npm, .m2, bundler, etc.

cache:
  - /usr/local/bin/go/pkg

This will cache the directory relative to the root directory of your repository:

cache:
  - .npm

NOTE: this is an alpha quality feature and still has some quirks. See https://github.com/drone/drone/issues/147

Params Injection

You can inject params into .drone.yml.

notify:
  hipchat:
    room: {{hipchatRoom}}
    token: {{hipchatToken}}
    on_started: true
    on_success: true
    on_failure: true

params-injection

Wall display

A wall display for Drone is available as a separate service. See Drone Wall for details.

Local development

Local Drone setup for development is pretty straightforward.

You will need to clone the repo, install Vagrant and run vagrant up. This command will download base Ubuntu image, setup the virtual machine and build Drone.

Afterwards, you may vagrant ssh into the vagrant instance, where docker is already installed and ready to go.

Once in the vagrant instance, run make run, the visit http://localhost:8080/install in your browser.

The Makefile has other targets so check that out for more build, test, run configurations.

Docs

Directories

Path Synopsis
Godeps
_workspace/src/bitbucket.org/kardianos/osext
Extensions to the standard "os" package.
Extensions to the standard "os" package.
_workspace/src/code.google.com/p/go.crypto/bcrypt
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
Package bcrypt implements Provos and Mazières's bcrypt adaptive hashing algorithm.
_workspace/src/code.google.com/p/go.crypto/blowfish
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.
Package blowfish implements Bruce Schneier's Blowfish encryption algorithm.
_workspace/src/code.google.com/p/go.crypto/ssh
Package ssh implements an SSH client and server.
Package ssh implements an SSH client and server.
_workspace/src/code.google.com/p/go.crypto/ssh/terminal
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems.
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems.
_workspace/src/code.google.com/p/go.crypto/ssh/test
This package contains integration tests for the code.google.com/p/go.crypto/ssh package.
This package contains integration tests for the code.google.com/p/go.crypto/ssh package.
_workspace/src/code.google.com/p/go.net/websocket
Package websocket implements a client and server for the WebSocket protocol as specified in RFC 6455.
Package websocket implements a client and server for the WebSocket protocol as specified in RFC 6455.
_workspace/src/code.google.com/p/go.text/transform
Package transform provides reader and writer wrappers that transform the bytes passing through as well as various transformations.
Package transform provides reader and writer wrappers that transform the bytes passing through as well as various transformations.
_workspace/src/code.google.com/p/go.text/unicode/norm
Package norm contains types and functions for normalizing Unicode strings.
Package norm contains types and functions for normalizing Unicode strings.
_workspace/src/code.google.com/p/gomock/gomock
GoMock - a mock framework for Go.
GoMock - a mock framework for Go.
_workspace/src/github.com/GeertJohan/go.rice/embedded
Package embedded defines embedded data types that are shared between the go.rice package and generated code.
Package embedded defines embedded data types that are shared between the go.rice package and generated code.
_workspace/src/github.com/andybons/hipchat
Package hipchat provides a client library for the Hipchat REST API.
Package hipchat provides a client library for the Hipchat REST API.
_workspace/src/github.com/bmizerany/pat
Package pat implements a simple URL pattern muxer
Package pat implements a simple URL pattern muxer
_workspace/src/github.com/daaku/go.zipexe
Package zipexe attempts to open an executable binary file as a zip file.
Package zipexe attempts to open an executable binary file as a zip file.
_workspace/src/github.com/dchest/authcookie
Package authcookie implements creation and verification of signed authentication cookies.
Package authcookie implements creation and verification of signed authentication cookies.
_workspace/src/github.com/dchest/passwordreset
Package passwordreset implements creation and verification of secure tokens useful for implementation of "reset forgotten password" feature in web applications.
Package passwordreset implements creation and verification of secure tokens useful for implementation of "reset forgotten password" feature in web applications.
_workspace/src/github.com/dchest/uniuri
Package uniuri generates random strings good for use in URIs to identify unique objects.
Package uniuri generates random strings good for use in URIs to identify unique objects.
_workspace/src/github.com/docker/docker/pkg/pools
Package pools provides a collection of pools which provide various data types with buffers.
Package pools provides a collection of pools which provide various data types with buffers.
_workspace/src/github.com/go-sql-driver/mysql
Go MySQL Driver - A MySQL-Driver for Go's database/sql package The driver should be used via the database/sql package: import "database/sql" import _ "github.com/go-sql-driver/mysql" db, err := sql.Open("mysql", "user:password@/dbname") See https://github.com/go-sql-driver/mysql#usage for details
Go MySQL Driver - A MySQL-Driver for Go's database/sql package The driver should be used via the database/sql package: import "database/sql" import _ "github.com/go-sql-driver/mysql" db, err := sql.Open("mysql", "user:password@/dbname") See https://github.com/go-sql-driver/mysql#usage for details
_workspace/src/github.com/plouc/go-gitlab-client
Package github implements a simple client to consume gitlab API.
Package github implements a simple client to consume gitlab API.
_workspace/src/github.com/russross/meddler
Meddler is a small toolkit to take some of the tedium out of moving data back and forth between sql queries and structs.
Meddler is a small toolkit to take some of the tedium out of moving data back and forth between sql queries and structs.
_workspace/src/github.com/smartystreets/goconvey/convey
Oh the stack trace scanning! The density of comments in this file is evidence that the code doesn't exactly explain itself.
Oh the stack trace scanning! The density of comments in this file is evidence that the code doesn't exactly explain itself.
_workspace/src/github.com/smartystreets/goconvey/convey/assertions
Package assertions contains the implementations for all assertions which are referenced in the convey package for use with the So(...) method.
Package assertions contains the implementations for all assertions which are referenced in the convey package for use with the So(...) method.
_workspace/src/github.com/smartystreets/goconvey/convey/assertions/oglematchers
Package oglematchers provides a set of matchers useful in a testing or mocking framework.
Package oglematchers provides a set of matchers useful in a testing or mocking framework.
_workspace/src/github.com/smartystreets/goconvey/convey/assertions/oglemock/createmock
createmock is used to generate source code for mock versions of interfaces from installed packages.
createmock is used to generate source code for mock versions of interfaces from installed packages.
_workspace/src/github.com/smartystreets/goconvey/convey/assertions/oglemock/generate
Package generate implements code generation for mock classes.
Package generate implements code generation for mock classes.
_workspace/src/github.com/smartystreets/goconvey/convey/assertions/oglemock/generate/test_cases/complicated_pkg
Package complicated_pkg contains an interface with lots of interesting cases, for use in integration testing.
Package complicated_pkg contains an interface with lots of interesting cases, for use in integration testing.
_workspace/src/github.com/smartystreets/goconvey/convey/assertions/oglemock/generate/test_cases/renamed_pkg
A package that calls itself something different than its package path would have you believe.
A package that calls itself something different than its package path would have you believe.
_workspace/src/github.com/smartystreets/goconvey/convey/assertions/ogletest
Package ogletest provides a framework for writing expressive unit tests.
Package ogletest provides a framework for writing expressive unit tests.
_workspace/src/github.com/smartystreets/goconvey/convey/gotest
Package gotest contains internal functionality.
Package gotest contains internal functionality.
_workspace/src/github.com/smartystreets/goconvey/convey/reporting
Package reporting contains internal functionality related to console reporting and output.
Package reporting contains internal functionality related to console reporting and output.
_workspace/src/gopkg.in/v1/yaml
Package yaml implements YAML support for the Go language.
Package yaml implements YAML support for the Go language.
_workspace/src/launchpad.net/goyaml
Package goyaml implements YAML support for the Go language.
Package goyaml implements YAML support for the Go language.
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL