Published on 11 May 2023 by Andrew Owen (2 minutes)
I’m a big fan of GitHub Actions. But if you’re working for an enterprise software company, there’s a fair chance you’re using Atlassian’s Bitbucket Cloud (along with Confluence and Jira). If so, then you can use Pipelines to build continuous integration and deployment workflows. If you’re new to DevOps and CI/CD, I have a TL:DR for you.
bitbucket-pipelines.yml
.Previously, I wrote a GitHub Action to unpack a zip archive. So let’s recreate that:
image: atlassian/default-image:3
pipelines:
default:
- step:
name: 'extract a zip file'
condition:
changesets:
includePaths:
- "*.zip"
script:
- rm -r uploads/extracted
- filename=$(basename -s .zip *.zip)
- unzip *.zip
- rm *.zip
- mv $filename temp
- mv temp/out/* .
- rm -r temp
- git add .
- git commit -m "unzip"
- git push origin main
When you’re done, click Commit File.
Bitbucket Pipelines runs your builds in Docker containers. So first you need to choose an image. The default is atlassian/default-image:latest. Atlassian recommends using this until you get your pipeline working and then finding a specific image. So in this instance, we’re using Ubuntu 20.04 LTS.
The script is virtually identical to the GitHub Action I wrote, so for a more detailed explanation, you can read that.
Image: original by Sigmund.