Getting Started with Bitbucket Pipelines for Pull Request Automation (for CI/CD purposes)

Hi CelSius, — that’s how i call my pal 😆
Today, i’m going to make an automatic process of Pull Request.
Currently whenever we have finished a feature, we would like to create a Pull Request. And most of the time, we always passed some un-noticed bug to them.
That’s why we need to run the script in our project to run some of the checkers like :
- Lint
This is used for checking the source code from programmatic errors/bugs, stylistic errors, or even suspicious constructs. - Test
In this case, my project are having some Unit Tests or/and End-to-End Test.
So, if your project also having these tests, we might do the similar steps.
But if you don’t, it’s also fine. No rush.
Those script “usually” should be run before we do the Pull Request and make sure our source code has been perfectly done.
But sadly, most of the time, we don’t. ☹
Because the checkers are really important, we need to make sure that we run all of the checker every time we do the Pull Request.
That’s why we need to automate our Pull Request action by creating an automation, so it would do the job automatically for running all the checkers whenever there’s a Pull Request.
And by doing this, we can have a breath about having our Main Branch clean from any possible errors.
Since my source code were hosted in Bitbucket when i’m writing this, so i will share about Bitbucket Pipelines.
If you have some other platform, then you also can utilize it.
Here is some of other platform :
- Jenkins
You could refer to Jenkins CI/CD documentation. - Gitlab
You could refer to Gitlab CI/CD documentation. - etc…
Configuring our First Pipeline
If you have been getting used to Bitbucket Pipelines, you can jump-in directly to the Bitbucket Pipeline’s script bitbucket-pipelines.yml
file.
But since it’s my first time, i would like to use the user interface feature from Bitbucket.

You need to go to your repository or your project. Then you can see the Pipeline menu.
Finishing the Two-step Verification
In this case, it’s asking me to verify the Two-step verification.
P.S : I’m not sure if this happened because of my email was linked to the Microsoft Email account. Let’s just verify it.

Once you proceed with the verification, it will asking for the verification code.
I’m using the Microsoft Authenticator from Google Playstore.

Click the Add Account feature, and choose Personal Account.
It will asking you to sign-in with Microsoft Account manually, or you can scan the QR code.
Then the code for Bitbucket will be shown-up on your list.
Take the 6-digit code to Bitbucket verification code.

After that, it will asking you to check your email and verify it by clicking Enable two-step verification button.

Continue the First Pipeline Configuration
After the verification has been done, and we go back to our project/repository’s Pipeline again, it will showing us the Bitbucket Pipeline page.

After this, we choose the Create your first pipeline link.
And then it will scroll you down to the template options.

You need to choose one of the available template.
I’m choosing the recommended Starter pipeline because I’m creating the pipeline for a Nuxt project.

For now, we need to leave the content of the bitbucket-pipelines.yml
file because we need to make sure it is working well.
Click on Commit file button and then it will create a new commit for the newly added bitbucket-pipelines.yml
and then run it for the first time.

After all the steps has been run successfully, it will show us the green status.
And it means, we are good to go!
Now, we can continue to create our own Pipeline.
Notes
For the default bitbucket-pipelines.yml
file, it will always automatically run the job in Pipeline whenever someone push the code to the repository.

Configure Pipeline
You can create your Pipeline based on your needs.
So for me, I’m going to configure the Bitbucket Pipeline for the Nuxt Pull Request Automation (for CI/CD purposes).
Summary
If you don’t like the long explanation, here is the checklist you have to do :
- Simply go to the Bitbucket Pipeline feature
- Finishing the Two-step verification (if you’re asked)
- Start create the Bitbucket Pipeline, and choose one of the available template
- Configure your Pipeline based on your needs
Now, you are good to go. Cheers!
Resources
Git Branching — Branches in a Nutshell
Getting started with Bitbucket Pipelines
Pipeline as a code with Jenkins
Configure the Bitbucket Pipelines
Configure the Bitbucket Pipeline for the Nuxt (Vuejs) Pull Request Automation (for CI/CD purposes)
Automatic Deployment using Bitbucket Deployment for Nuxt (Vuejs) for CI/CD purposes