Recently, I’ve been looking into a new CI/CD solution for work. We want to move everything back in house, and the tools we’re currently using are feeling (and acting) a bit dated. One of the CI servers I’ve been hacking about on has been drone ci.
To make the experiment a little more interesting, I’ve started using drone as the CI/CD for my personal website. This should allow me to experiment with conditional flows as well as kick the tires on some of the various plugins.
I’m not going to cover installation here, as it’s fairly straightforward. However, I will be releasing an ansible playbook that will load up something you can easily experiment with.
Building the Site
Drone works in the same way a number of other repository based CI/CD systems work. You place a small
file in the root of the repository (default: .drone.yml
), and the drone server watches for
changes. It uses this file to define the pipeline.
- uses the hugo plugin
- should be pretty simple to see what’s what
kind: pipeline
name: default
steps:
- name: build-prod
image: plugins/hugo
settings:
hugo_version: 0.55
pull: always
url: https://trevoroke.com
validate: true
...
Deployment to AWS S3
- pulls from secrets
- uses the s3-sync plugin
kind: pipeline
name: default
steps:
...
- name: deploy-prod
image: plugins/s3-sync:1
settings:
bucket: trevoroke.com
target: /
source: public/**/*
region: us-east-1
cloudfront_distribution: <some id>
access_key:
from_secret: aws_access_key_id
secret_key:
from_secret: aws_secret_access_key
when:
branch:
- master
Photo Credits
Photo by Samuel Sianipar on Unsplash