Yeah, another CI tool. That’s named Drone.
We’ve been heard of Jenkins, travis-ci and even circle-ci (I have to mention this because there’re too much ads on youtube for it), so why would we need another one?
I’ve used Jenkins and travis-ci, but they are not perfect, at least there are some slight drawbacks.
My experience on Jenkins
Jenkins is stable for production, it has long history and is used widely. But sometimes I find Jenkins is too slow, and configuration is not straightforward. And it’s a pain to upgrade to a new pipeline, you have to copy and paste jobs from UI (while accessing is pretty slow). You might able to config jobs with XML config files, but it’s still a bit of complicated.
If you don’t use containers in Jenkins, workspaces will take too much storage when there are too many jenkins jobs. This will make you have to expand the storage disk one day.
Some teams may use old version of Jenkins with some bugs, but they are not willing to upgrade it because of the risks of workload and technical problems.
My Experience Travis-CI
- Faster than Jenkins
- Lighter UI
- Configuration as Code
- Need to learn the configuration grammer
- …
What about Drone?
- Lighter and elegant UI
- Configuration is straightforward, syntax just like docker-compose
- Ship Code Fast
- Container Native
- …
So it’s just like the upgrading path: Jenkins -> travis-ci -> drone-ci. The latter one seems absorb the advantages and make it better.
But drone is not totally free to use: https://discourse.drone.io/t/licensing-and-subscription-faq/3839
Though it’s licensed under apache 2.0 license for oss use, you may never use the oss version because it’s lack of agent support and its functions are limited.
But it’s free to use for open source projects. See license. While Jenkins and travis are under MIT license.
Drone Cloud
In 2018/11/27 Drone Cloud was announced, and it’s free for open source. see https://blog.drone.io/drone-cloud/.
Setting up with github (public repo)
Preparement
- GitHub token [repo]
- A created public project
Sample configuration for golang project: goserve
workspace:
base: /go
path: src/github.com/artificerpi/goserve
steps:
- name: test
image: golang
pull: always
commands:
- go test -v ./...
- name: build
image: golang
pull: always
commands:
- go get github.com/mitchellh/gox
- go get -t -v ./...
- gox -output="./dist/{{.Dir}}_{{.OS}}_{{.Arch}}" -os="linux darwin windows" -arch="amd64" -verbose ./...
when:
event:
- push
- tag
- name: publish
image: plugins/github-release
settings:
api_key:
from_secret: github_token
files: dist/*
checksum:
- sha256
when:
event: tag
# ...
Here we declare the workspace and set gopath, and we use gox to do cross-platform buliding, and finally publish the release with plugin github-release to relase artifacts.
Release artifacts
share artifacts with another step Note that we can directly use the artifacts by the build step, no need to do volume mount (for security, mouting is not availbe on public drone cloud)
api key Here we read the secret from an environment var
github_token, which is configured in the UI of drone in project settings.
One more java project sample from here: java-sample