Skip to main content

Moving from Wercker to BitBucket Pipelines

·2 mins

For the last year I’ve been using Wercker to deploy this site each time I make a change (normally a new post) and push it to BitBucket.

That’s been working perfectly well. Wercker is now owned by Oracle, but I haven’t seen any changes because of that.

In the meantime, BitBucket has released it’s own continuous deployment feature, called Pipelines. I thought I would give it a go, partly just curious, but also it’s a bit nicer having the deployment managed in the same place as the code.

Pipelines runs your steps in a Docker image of your choosing. The only problem I had was that all these steps need to be in the same Docker image, and my site has grown complex enough that I now need Hugo, Grunt, and s3cmd available to deploy it. This looks like something that will be improved soon, but for now I created my own Docker image with these dependencies and pushed it to the public repository.

My bitbucket-pipelines.yml looks like this:

image: andrewrjones/docker-grunt-hugo-s3cmd:node-8.4-hugo-0.26-s3cmd-2.0.0

pipelines:
  branches:
    master:
      - step:
          script:
            - hugo
            - npm install
            - grunt dist
            - s3cmd sync --no-progress --acl-public --recursive --no-delete-removed --no-mime-magic --guess-mime-type --cf-invalidate public/ s3://andrew-jones.com

Pretty straightforward. Pipelines is free for the first 50 minutes of building each month, which should be plenty for me (unless I start blogging a lot more frequently!), and I now have one less dependency to worry about.