How to install and update one stage independently from more than one CI jobs with Helmfile?

1/14/2020

Say, we have two git repo frontend and backend. And the task is to make staging system where on pr CI makes a stage with this branch. And say we have the helm charts for both of them and couple with database and some caches.

The idea how to do this is: Make a repo with all the charts and put there a helmfile that connected them as a stage. Then packed it as a container with configured helm, helmfile and so on. Next, in a CI job use this container after all the builds is done (inside that job) to call helmfile with a variable that contain the tag of a build. And if there is no such stage it create it, and if there is so just update the tag.

But there is a problem with that. When two builds of, say, frontend and backend are running at the same time I wonder could happens this case: async will be called on the first job it create a stage with tag for this build and set default to other tag and when the second build called it'll update the branch of this build and set as default the branch from the first build. Even if we will check is there a stage it could be called at the same time and both got an answer that there isn't.

Honestly, I haven't try it yet. I'm on the stage of making the main idea how to do this.

If someone know hot to do it correctly, even if it would be completely different idea I would appreciate it a lot.

Thank you)

-- Kealman
continuous-integration
devops
helmfile
kubernetes
kubernetes-helm

0 Answers