DevOps Blog

Using Trello as a DevOps : a Gitops introduction

Written by Samuel Maftoul | 29-Mar-2021 22:00:00

Some context

We started to experiment and found that traditional git platforms (github, gitlab, bitbuckets ...) are tools to discuss content. Pull/Merge requests and issues are just what we need to improve the content. Also, we would get other benefits of git.
For example, we will be able to easily show with git blame when any piece of content was last modified. Moreover, we would know when, why, and discover other changes that come in at the same time.

Description of the solution

At first, we searched a terraform provider for Trello. It seemed the most straightforward solution, given that we are essentially an Ops shop, and that terraform is one of the most used tools in our company. We found one on Github, but it is not complete and doesn’t have all the features we need. We wanted something else.

The solution we implemented is quite simple: We want to write a simple YAML file in a git repository and have it imported on Trello with a script. The script would parse the YAML file and do API calls to the Trello API.To create a YAML structure, we exported a board and selected the fields we are interested in. Then we came up with a YAML structure. The structure currently includes lists, cards and checklists. This structure is far from supporting all Trello's features, but it allows us to work with most of our boards and should be enough for most use-cases.

Living with it

We started using it and so far we have had great success. Also, we noticed another benefit: We can create a board from a template with a single command. This allows us to automatically create boards wherever we can run commands without any manual actions. Actually, we even did a continuous integration pipeline that, on a pattern of branch name, would create a board and would share that boards to a user in that branch name

Cons

This workflow has some drawbacks. First, it's not the best experience for non-technical people. Although we've already seen non-technical people comment on issues or pull/merge requests or even using the platform's web UIto propose file changes, most non-tech people would be afraid of doing so. Second, the current feature set is very small, whenever you need more, the script won't fit your needs (namely, it doesn't support labels nor images). Finally, trello API has some rates, and for big boards, you might reach those rates. Currently, we have tested with rather large boards and didn't hit the rate limit.

A note about Gitops

Weaveworks, creators of the concept of GitOps, states that it is "A path towards a developer-centric experience for managing applications."
As the name implies, the developer-centric experience is generally the use of git with its workflows. Here we achieved Trello automation with git and added automation around the repository. GitOps has multiple definitions, it can also mean "using Git for tasks other than source-code management".

Pros

Through the practices of GitOps, we get some interesting advantages. We increased productivity by being able to improve our templates with fewer meetings. As usual, with GitOps, the developer experience is improved, we can create new copies of a board just by pushing to a new branch thanks to the CI/CD pipeline with set up. Also, it allows us to add consistency and standardization of our internal processes as we are already practicing GitOps.

Show me the code

We set up a repository with a live board available so you can see how it looks like.
It contains an export script, trello2yaml, an import script, yaml2trello.

There's also an example of a template board, board.yaml (an export of the live board), and finally a usage.md that shows how to use the scripts.

It requires an API key, and a token that you can create by clicking on "token" in the developer API keys section of that page.

We also made a pip package so you can install it easily with:

pip install \

git+https://gitlab.com/padok-team/products/experiments/yaml2trello

What's next

There are plenty of areas for improvement.
Logging and error reporting are currently suboptimal. Also, there are very few Trello features supported. Scripts could also be configured with environment variables.Maybe we could also improve the structure, like add names and sharing settings of boards within the board itself. We currently have some CI process but it's specific to our use cases so it's not in the example. Your contributions are more than welcome!

We have set up automation around Trello, thanks to git. We are experimenting with more and more aspects of GitOps, and so far we are quite happy with it. We improved our processes quality and velocity with more automation. You can access the complete code in a repository.