Let's take a quick look at some examples to see GitOps in action.
Code Commit in Feature Branch - will lead to deployment in Dev Environment.
Let’s consider that a code commit is done by a developer in Feature Branch-FB1 of Service 1.
- The commit in feature branch raises a commit event.
- The commit event triggers an already configured webhook URL. As soon as a webhook is triggered, a message to the specified URL is sent.
- Listener receives the webhook message, as a result, it will invoke an action.
- In this case, the configured action is a Pipeline. This Pipeline triggers a build and deployment for the Dev environment of Service 1.
Event: Code Commit
How to release a feature developed in a feature branch to Prod via GitOps?
Let’s consider a developer writes the code for a specific feature in a feature branch FB1 of Service 1. How will he release this feature to production? Doing so manually can be a time-consuming and error-prone task to handle. Here is how GitOps comes into the picture and can help!
So, here is how GitOps actually works!
- Developer writes the code for a feature in the feature branch FB1 of Service1.
- The developer submits a pull request to the master branch.
- Git raises a pull request event to the event listener.
- The event listener triggers a detailed Continuous Integration pipeline.
- After the execution of the CI pipeline, the result is published in the pull request.
- The Git approver/repository maintainer reviews the developer’s completed work in the pull request.
- Once the pull request is fully reviewed and approved by the approver, Git raises a merge event to the merge event listener.
- The merge event Listener triggers the CD pipeline leading to deployment in production.
GitOps enables software development teams to focus on application development, as opposed to manually handling deployment and dealing with excessive runtimes.
Event: Pull Request
In order to implement GitOps for simplifying and accelerating the application deployment process, your team needs to,
- Configure Webhooks in the Git Repo
- Create EventListeners and Define actions with BuildPiper