Drone

  • https://drone.io
  • Lightweight
  • Local builds via drone CLI (runs containers on the local host)

Integrations:

  • Gogs
  • GitLab
  • Github
  • Bitbucket
  • Gitea

Gogs container

# start gogs
$ docker run --name=gogs -p 10022:22 -p 10080:3000 -v /var/gogs:/data gogs/gogs

Drone server and agent

# docker-compose.yml
version: '2'

services:
  drone-server:
    image: drone/drone:0.7
    ports:
      - 80:8000
    volumes:
      - /var/lib/drone:/var/lib/drone/
    restart: always
    environment:
      - DRONE_OPEN=true
      - DRONE_HOST=${DRONE_HOST}
      #- DRONE_GITHUB=true
      #- DRONE_GITHUB_CLIENT=${DRONE_GITHUB_CLIENT}
      #- DRONE_GITHUB_SECRET=${DRONE_GITHUB_SECRET}
      - DRONE_GOGS=true
      - DRONE_GOGS_URL=http://gogs.mycompany.com

  drone-agent:
    image: drone/drone:0.7
    command: agent
    restart: always
    depends_on:
      - drone-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_SERVER=ws://drone-server:8000/ws/broker
      - DRONE_SECRET=${DRONE_SECRET}

Pipeline

# .drone.yml
pipeline:
  rocket:
    image: rocker/rstudio
    commands:
      - install2.r magrittr
      - Rscript -e "library(magrittr); iris %>% head() %>% print(); write.csv(iris, 'that.csv')"
  science:
    image: rocker/rstudio
    commands:
      - cat that.csv
  deploy:
    image: alpine
    commands:
      - echo This is rocket science
      - cp that.csv /inside
      - rm that.csv
    volumes:
      - /tmp:/inside
    when:
      status: success

Run a local build

# Install drone CLI
$ curl -L https://github.com/drone/drone-cli/releases/download/v0.8.0/drone_linux_amd64.tar.gz | tar zx
$ install -t /usr/local/bin drone

# Run task
$ drone exec .drone.yml