Woodpecker is a community fork of the Drone CI system.
Find a file
Laszlo Fogas 2ad7e08a28
Merge pull request #51 from laszlocph/reinstate-gated
Reinstate simplified gating logic
2019-07-20 21:12:41 +02:00
.github Update issue_template.md [ci skip] 2017-09-06 15:21:15 -07:00
cli Pull in drone-go 2019-07-09 10:46:15 +02:00
cmd Exposing waiting job count as metric 2019-07-10 10:00:38 +02:00
cncd Differentiating between waiting on dependencies and workers 2019-07-09 16:23:56 +02:00
docs Readme 2019-07-08 15:13:18 +02:00
drone-go Differentiating between waiting on dependencies and workers 2019-07-09 16:23:56 +02:00
model Fallback to default config. Allows incremental rollout of custom-path 2019-06-25 13:45:43 +02:00
plugins Renamed package 2019-04-04 20:51:20 +02:00
remote Fixing infinite loop :o 2019-07-17 13:58:47 +02:00
router Grouping queue endpoints 2019-07-09 13:54:22 +02:00
server Reinstate simplified gating logic 2019-07-18 14:21:05 +02:00
shared Just fixed format with go fmt ./... 2018-03-21 14:02:17 +01:00
store Fixing nil value in newly added column 2019-07-15 14:26:00 +02:00
vendor Latest UI 2019-07-16 15:11:16 +02:00
version bump static version 2018-11-15 13:02:09 -08:00
.cli.sh CLI is pulled in for simpler(?) workflow 2019-04-06 21:32:14 +02:00
.dockerignore Building OSS 2019-04-05 10:17:27 +02:00
.drone.sh Readme 2019-07-08 15:13:18 +02:00
.drone.yml Drone tag 2019-07-02 15:21:55 +02:00
.gitignore 1:n relationship for build-config 2019-06-07 10:40:16 +02:00
BUILDING How to generate sql files 2019-06-07 10:43:42 +02:00
docker-compose.yml Refactor 2019-06-05 15:58:27 +02:00
Dockerfile update base image to drone/ca-certs 2017-09-11 16:03:11 -07:00
Dockerfile.agent add alpine images 2017-09-27 19:01:52 -07:00
Dockerfile.agent.alpine upgrade alpine base images to latest version 2018-02-01 22:15:50 +01:00
Dockerfile.agent.linux.arm add alpine images 2017-09-27 19:01:52 -07:00
Dockerfile.agent.linux.arm64 add alpine images 2017-09-27 19:01:52 -07:00
Dockerfile.alpine upgrade alpine base images to latest version 2018-02-01 22:15:50 +01:00
LICENSE Readme 2019-07-08 15:13:18 +02:00
README.md Readme 2019-07-08 15:13:18 +02:00

Drone-OSS-08

An opinionated fork of the Drone CI system.

  • Based on the v0.8 code tree
  • Focused on developer experience.

Build Status Go Report Card License

Drone-OSS-08

Table of contents

About this fork

Motivation

Why fork? See my motivation

The focus of this fork

This fork is not meant to compete with Drone or reimplement its enterprise features in the open.

Instead, I'm taking a proven CI system - that Drone 0.8 is - and applying a distinct set of product ideas focusing on:

  • UI experience
  • the developer feedback loop
  • documentation and best practices
  • tighter Github integration
  • Kubernetes backend

with less focus on:

  • niche git systems like gitea, gogs
  • computing architectures like arm64
  • new pipeline formats like jsonnet

Who uses this fork

Currently I know of one organization using this fork. With 50+ users, 130+ repos and more than 300 builds a week.

Pipelines

Getting started

Place this snippet into a file called .drone.yml

pipeline:
  build:
    image: debian:stable-slim
    commands:
      - echo "This is the build step"
  a-test-step:
    image: debian:stable-slim
    commands:
      - echo "Testing.."

The pipeline runs on the Drone CI server and typically triggered by webhooks. One benefit of the container architecture is that it runs on your laptop too:

$ drone exec --local
stable-slim: Pulling from library/debian
a94641239323: Pull complete
Digest: sha256:d846d80f98c8aca7d3db0fadd14a0a4c51a2ce1eb2e9e14a550b3bd0c45ba941
Status: Downloaded newer image for debian:stable-slim
[build:L0:0s] + echo "This is the build step"
[build:L1:0s] This is the build step
[a-test-step:L0:0s] + echo "Testing.."
[a-test-step:L1:0s] Testing..

Pipeline steps are commands running in container images. These containers are wired together and they share a volume with the source code on it.

Pipeline documentation

See all pipeline features.

Plugins

Plugins are Docker containers that perform pre-defined tasks and are configured as steps in your pipeline. Plugins can be used to deploy code, publish artifacts, send notification, and more.

Example pipeline using the Docker and Slack plugins:

pipeline:
  backend:
    image: golang
    commands:
      - go get
      - go build
      - go test

  docker:
    image: plugins/docker
    username: kevinbacon
    password: pa55word
    repo: foo/bar
    tags: latest

  notify:
    image: plugins/slack
    channel: developers
    username: drone

Custom plugins

Plugins are Docker containers with their entrypoint set to a predefined script.

See how an example plugin can be implemented in a bash script.

Server setup

Quickstart

The below docker-compose configuration can be used to start the Drone server with a single agent. It relies on a number of environment variables that you must set before running docker-compose up. The variables are described below.

Each agent is able to process one build by default. If you have 4 agents installed and connected to the Drone server, your system will process 4 builds in parallel. You can add more agents to increase the number of parallel builds or set the agent's DRONE_MAX_PROCS=1 environment variable to increase the number of parallel builds for that agent.

version: '2'

services:
  drone-server:
    image: drone/drone:{{% version %}}
    ports:
      - 80:8000
      - 9000
    volumes:
      - drone-server-data:/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_SECRET=${DRONE_SECRET}

  drone-agent:
    image: drone/agent:{{% version %}}
    command: agent
    restart: always
    depends_on:
      - drone-server
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      - DRONE_SERVER=drone-server:9000
      - DRONE_SECRET=${DRONE_SECRET}

volumes:
  drone-server-data:

Drone needs to know its own address. You must therefore provide the address in <scheme>://<hostname> format. Please omit trailing slashes.

services:
  drone-server:
    image: drone/drone:{{% version %}}
    environment:
      - DRONE_OPEN=true
+     - DRONE_HOST=${DRONE_HOST}
      - DRONE_GITHUB=true
      - DRONE_GITHUB_CLIENT=${DRONE_GITHUB_CLIENT}
      - DRONE_GITHUB_SECRET=${DRONE_GITHUB_SECRET}
      - DRONE_SECRET=${DRONE_SECRET}

Drone agents require access to the host machine Docker daemon.

services:
  drone-agent:
    image: drone/agent:{{% version %}}
    command: agent
    restart: always
    depends_on: [ drone-server ]
+   volumes:
+     - /var/run/docker.sock:/var/run/docker.sock

Drone agents require the server address for agent-to-server communication.

services:
  drone-agent:
    image: drone/agent:{{% version %}}
    command: agent
    restart: always
    depends_on: [ drone-server ]
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
+     - DRONE_SERVER=drone-server:9000
      - DRONE_SECRET=${DRONE_SECRET}

Drone server and agents use a shared secret to authenticate communication. This should be a random string of your choosing and should be kept private. You can generate such string with openssl rand -hex 32.

services:
  drone-server:
    image: drone/drone:{{% version %}}
    environment:
      - DRONE_OPEN=true
      - DRONE_HOST=${DRONE_HOST}
      - DRONE_GITHUB=true
      - DRONE_GITHUB_CLIENT=${DRONE_GITHUB_CLIENT}
      - DRONE_GITHUB_SECRET=${DRONE_GITHUB_SECRET}
+     - DRONE_SECRET=${DRONE_SECRET}
  drone-agent:
    image: drone/agent:{{% version %}}
    environment:
      - DRONE_SERVER=drone-server:9000
      - DRONE_DEBUG=true
+     - DRONE_SECRET=${DRONE_SECRET}

Drone registration is closed by default. This example enables open registration for users that are members of approved GitHub organizations.

services:
  drone-server:
    image: drone/drone:{{% version %}}
    environment:
+     - DRONE_OPEN=true
+     - DRONE_ORGS=dolores,dogpatch
      - DRONE_HOST=${DRONE_HOST}
      - DRONE_GITHUB=true
      - DRONE_GITHUB_CLIENT=${DRONE_GITHUB_CLIENT}
      - DRONE_GITHUB_SECRET=${DRONE_GITHUB_SECRET}
      - DRONE_SECRET=${DRONE_SECRET}

Drone administrators should also be enumerated in your configuration.

services:
  drone-server:
    image: drone/drone:{{% version %}}
    environment:
      - DRONE_OPEN=true
      - DRONE_ORGS=dolores,dogpatch
+     - DRONE_ADMIN=johnsmith,janedoe
      - DRONE_HOST=${DRONE_HOST}
      - DRONE_GITHUB=true
      - DRONE_GITHUB_CLIENT=${DRONE_GITHUB_CLIENT}
      - DRONE_GITHUB_SECRET=${DRONE_GITHUB_SECRET}
      - DRONE_SECRET=${DRONE_SECRET}

Authentication

Authentication is done using OAuth and is delegated to one of multiple version control providers, configured using environment variables. The example above demonstrates basic GitHub integration.

See the complete reference for Github, Bitbucket Cloud, Bitbucket Server and Gitlab.

Database

Drone mounts a data volume to persist the sqlite database.

See the database settings page to configure Postgresql or MySQL as database.

services:
  drone-server:
    image: drone/drone:{{% version %}}
    ports:
      - 80:8000
      - 9000
+   volumes:
+     - drone-server-data:/var/lib/drone/
    restart: always

SSL

Drone supports ssl configuration by mounting certificates into your container.

See the SSL guide.

Automated Lets Encrypt is also supported.

Metrics

A Prometheus endpoint is exposed.

Behind a proxy

See the proxy guide if you want to see a setup behind Apache, Nginx, Caddy or ngrok.

Contributing

Drone-OSS-08 is Apache 2.0 licensed and accepts contributions via GitHub pull requests.

How to build the project

License

Drone-OSS-08 is Apache 2.0 licensed with the source files in this repository having a header indicating which license they are under and what copyrights apply.

Files under the docs/ folder is licensed under Creative Commons Attribution-ShareAlike 4.0 International Public License. It is a derivative work of the https://github.com/drone/docs git repository.