Integrate Balena with Jenkins CI

Hi all,

I’d like to integrate the Balena infrastructure with Jenkins CI to cover the CD part in my CICD sandbox project, that I’ve been working on.

For the CI part I chose to use Jenkins that does the following: takes my code from git repository, creates and builds Docker image based on Dockerfile(s) (couple of base custom base images and a runtime one), runs the tests. Upon successful competition of all these tasks, the output is the newly created docker image label, that I push to local Docker registry in case of master branch, or simply remove the image in case of development git branch. The idea in this Jenkins pipeline is to ensure that the changes done in the dev branch are ‘valid’ to be merged with the master one.

So, with all this relatively covered (there is quite a few cool cosmetics that I’m working on, but mostly the pipeline will remain as explained), I’d like to level up my small world with the deployment process based on Balena. I’ve successfully managed to create my first ship in the fleet (kudos for naming strategy!), push the changes and deploy them to my freshly created device. And, at this point I’m pretty much stuck, because I’m not sure how to integrate these changes to already existing Jenkins pipeline.

On one hand I can move all the code that I’ve been working on into the Dockerfile (compile, build, run tests etc.) and just keep short one-liner in the Jenkins. But I really don’t like this approach, since there is a reason behind the Jenkins approach (with all awareness to Jenkins lacking of some features)

On the other hand, I’m looking through the documentation, and completely failing to connect the dots…

So, any advise would be more than welcomed!
Meanwhile I’ll continue to dive into Balena documentation.

Thanks in advance)

Moved here Integrate Balena into Jenkins CI