Bitbucket Pipelines

As I said on my previous post, I changed jobs and I’m learning a lot of new things. I spent most of the time on theory and there are very few things to show. But as I’m using BitBucket at work, and I wanted to learn more about it, so I signed in for the free tier.

The interface is very intuitive and easy to use if you are already familiar with other ones like GitHub or GitLab.

Creating a project

Once signed in, the big blue button labeled “Create repository” was a clear clue about where I should begin. bitbucket landing screen

There were some fields to fullfil, as in other repository managers: bitbucket create repo

After confirming the creation of the repository, I was taken to the main repository view, where the README.md and the .gitignore files were created as selected on the previous screen. repo created The pity here was the .gitignore file created, wasn’t tailored to Python as it was the selected language on the repository creation screen. But what caught my attention was the (again) blue button “Set up build” which took me to a wizard which helped me to create my first pipeline.

create pipeline wizard I choosed “Build and test Python” which took me to a template editor to edit the pipeline.

pipeline template editor I left everything as it was and commited the file.

pipeline failed As I had no code to test nor build at that point, it failed as expected. So it was time to clone my repo and add some code. Remember the “Setup build button”?, it has a “Clone” button next to it, and it offered the usual clone command ready for copy to the clipboard.

Sample code

I added a variant on the Marvin Kastner’s echo server, but as I didn’t write any test for it, I removed the testing step from the pipeline’s template.

My original code had some formatting issues which made flake8 complain, after fixing them, the pipeline ran successfully. pipeline succeed

Conclusions

This exercise was an introduction to BitBucket to prepare the ground for a more elaborated pipeline, including deployment settings and custom runners.

References