As more and more companies use Harness on a regular basis for their companies, we find that there are a million and one ways to do Continuous Delivery. One of the most common practices is using information from a git repo (like GitHub) to both trigger processes, but also to pass information from the GitHub payload into either the Delivery Process, use it for compliance information, or both.
To leverage anything from a GitHub payload, you’ll need to work through three main pieces:
- Setup the required integrations in Harness to leverage the data from GitHub
- Setup a Workflow that is requiring that information and will use it where needed
- Build a trigger that leverages payload information from the GitHub PR or Push as needed.
The first piece will obviously require you to integrate with a git repo. Interestingly enough, you don’t actually need to setup a Git integration in Harness to do this. What you would do is set the Trigger to be a Webhook trigger, point it at GitHub, and after you save the Trigger, you’ll get a Webhook to add to the required repository (Full GitOps and more!)
For the second piece, this doc will walk you through how to setup a Canary Workflow in Kubernetes.
And for the third piece, use this GitHub Developers doc and leverage dot-notation to get the information you need (Example: You want to get the SHA from the PR Head >
See the example in the below picture
If you are using BitBucket instead of GitHub, their Developer Doc will help you out.
If you are using GitLab, this Developer Doc will walk you through what you can pull out of the Webhook Payload
Hope this helps!
Don’t forget to Like/Comment/Share!