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.
There were some fields to fullfil, as in other repository managers:
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.
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.
I choosed “Build and test Python” which took me to a template editor to edit the pipeline.
I left everything as it was and commited the file.
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.
Conclusions
This exercise was an introduction to BitBucket to prepare the ground for a more elaborated pipeline, including deployment settings and custom runners.
References
- BitBucket: https://bitbucket.org
- Marvin’s echo server: https://gist.github.com/1kastner/e083f9e813c0464e6a2ec8910553e632
- This post’s files on BitBucket: https://bitbucket.org/juanjo-vlc/pipelines/src/pipelines-i/