Trunk based branching and deploying into multiple environments

120 views Asked by At

currently we are having development, staging and production branches and using various helm chart versions we are moving the changes from one branch to another branch and deploying accordingly into multiple environments using FLUX GitOps tool.

Now, we want to follow trunk based approach i.e., in our repo we will have only one branch called main and for each helm change we will generate a sematic version and tag it the github repo. using that semantic tag we will be updating the version in flux repo.

to give more clarity, helm changes are in one repo and flux is in another repo. in helm repo we will have semantic version tagging based on minor, major and patch. in flux repo we have a folder for each environment and in that we have a below yaml file contains semantic version.

apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: GitRepository
metadata:
 name: test-helm
 namespace: test
spec:
 interval: 1m0s
 ref:
  semver: 1.38.1
 secretRef:
  name: flux-token
 url: https://github.com/ZAGENO/test-helm.git

once we have a new semantic version in helm repo we will go to flux repo and update the semantic version value under development folder manually and merge so that changes will be deployed into development env but staging changes will remain in previous version state until we change the semantic version value manually and merge it.

what i want to avoid is once we generate a new semantic version without manually updating semantic version in flux repo, is there a way to automate it?

like we generated a new semantic version V1.38.2 and we just want to deploy it in staging env so the value 1.38.2 should be updated under staging folder in flux repo using automation

apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: GitRepository
metadata:
 name: test-helm
 namespace: test
spec:
 interval: 1m0s
 ref:
  semver: 1.38.2
 secretRef:
  name: flux-token
 url: https://github.com/ZAGENO/test-helm.git

is there a way to do it or will there be any better approach to do it?

Thank you

0

There are 0 answers