Triggers and Git Payload Information

Hello All!

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:

  1. Setup the required integrations in Harness to leverage the data from GitHub
  2. Setup a Workflow that is requiring that information and will use it where needed
  3. 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 > pull_request.head.sha)

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!

2 Likes