CI and CD for Debian and Ubuntu

2 minute read

Developing some new features for edi is the fun part. Releasing it for two Debian and three Ubuntu releases is the boring part and it took me around two hours to do it properly for each new release. As I do not like repetitive tedious tasks that might even have a negative impact on quality if some steps are not properly executed I decided to automate the last mile and implement continuous delivery (CD) for edi.

With the setup below generating a new release for Ubuntu Xenial, Bionic and Eoan and Debian stretch and buster is now a matter of 5 minutes:

pipeline

Here are the important building blocks:

GitHub

GitHub was already my source code repository hosting of choice. However, my branching setup was too simple for the continuous delivery pipeline and therefore I decided to introduce git-flow. The master branch now has a special position: Each time I do a merge to it a new release will get generated. Webhooks will trigger the update of the documentation on Read the Docs and the package builds for several Debian and Ubuntu releases on Travis CI.

Travis CI

On Travis CI I make use of Docker containers to build my packages in the proper Debian and Ubuntu environments. This also involves pytest unit testing that currently covers about 70% of the code. The Travis CI file looks pretty simple but some additional work gets done within a bash script. Finally the resulting artifacts get pushed to launchpad and packagecloud when a build was successful on the master branch.

launchpad and packagecloud

Since 2016 I was pushing Ubuntu packages to my launchpad ppa repository. To avoid any breaking changes for the edi users I decided to stick to launchpad for the Ubuntu packages. Travis CI would support deployments to launchpad with a tailored plugin. As I was used to dput I chose another path. From within the bash script I directly do the upload to launchpad using dput (after a while I figured out that the default ftp upload probably failed due to this and that I should better use sftp instead).

For the packages targeting Debian I was using a custom apt repository hosted on GitHub. This was not really suitable for CD and therefore I decided to switch the Debian apt repository hosting to packagecloud. The package deployment to packagecloud is straight forward using a tailored Travis CI plugin.

Conclusion

For the edi users it is now very simple and convenient to install the latest version from the ppa (Ubuntu) or packagecloud (Debian). The obtained packages should have a consistent and predictable quality because their build is now fully automated.

Of course I also enjoy the improved setup because releasing a new edi version now takes me five minutes instead of two hours!

Updated:

Leave a Comment