Using Bitbucket Pipelines

In my last post (I know it’s been a while) I described my use of Buddy.Works for the deployment process. Well since Bitbucket uses its own deployment pipelines and because for work it was better to use the same tool for everything, I started to read up on pipelines.

The result is a bitbucket-pipelines.yml file for my Bitbucket Repository which handles the build and deployment process.

image: node:10.15.3

    - step:
        name: Build CSS
          - node
          - npm install -g gulp
          - npm install
          - gulp sass
          - style.css
    - step:
        name: Deploy Theme
        deployment: production
          - pipe: atlassian/rsync-deploy:0.3.2
              USER: '$REMOTE_USER'
              SERVER: '$REMOTE_SERVER'
              REMOTE_PATH: '$REMOTE_PATH'
              LOCAL_PATH: '/opt/atlassian/pipelines/agent/build/'
              EXTRA_ARGS: '--exclude-from=deployment-exclude-list.txt'

I’m only working with a master branch but of course, you could expand that to a staging site with a development branch as well.

The first step builds the CSS out of the SCSS file and the second step uses rsync to copy the changed files from the repository to the remote server. There’s also a deployment-exclude-list.txt with a few files which don’t need to be copied.

Deployment now takes around 30-40 seconds and it’s all neatly integrated into Bitbucket, which is kinda nice.

For now, I won’t use Buddy.Works for a while, even though they have some very nice features and keep on adding new ones, like Lighthouse testing. But maybe Bitbucket will add new features as well or I will find out how to include Lighthouse testing into my pipelines as well.