The process of adding a joke to a build log is pretty simple. We just need to obtain a joke text and print it to the log. Of course, we can’t forget about proper error handling.
Let’s start with installing Bitrise CLI and invoking bitrise :step create. You can find more info about step creation in my previous blogpost: How to Create Bitrise Step in Go – Flutter Example.
Bitrise officially supports two bulgaria phone number toolkits for writing integrations (so-called steps): bash (shell scripts) and go. At a glance, this integration looks trivial so it may be a good candidate for a shell script. However, since we need some basic logic like validations or error handling and Bitrise provides libraries which can help us, we will use golang toolkit.
➡ The source of the jokes
Jenkins plugin uses hardcoded joke texts. It is the simplest source to implement. However, it also has a major drawback. Adding a new joke would require releasing a new version of the Bitrise step each time. Each of those versions would need to be approved and users would need to update step version in their workflows (unless they selected “always latest” version). Usually, it is a good idea to separate data from the logic.
We can get jokes from external, free-of-charge API. For example chucknorris.io. This one contains many different jokes, it is open source and supports plain text responses so it fits perfectly our needs. However, there are also other alternatives.
Implementing Chuck Norris jokes integration
-
- Posts: 15
- Joined: Mon Dec 23, 2024 3:52 am