Join us

Argo CD Git Webhook Configuration

0_iM6qa7YpwqnQOIQ1 (1).png

We have seen about ArgoCD sync configuration and part of that we have understand Argo CD polls the Git repositories every 3minutes to detect the changes done on the repo. In case if you wish to change the delay to quicker, you can configure the webhook events to send the poll to API server. Argo CD supports Git webhook notifications from all major providers in the market like GitHub, GitLab, Bitbucket, Bitbucket Server and Gogs. The following explains how to configure a Git webhook for GitHub and Gitlab, same process can be applicable to other providers.

Create The Webhook in GitHub

Login to GITHUB repository and navigate to the settings page where webhooks can be configured. The payload URL configured in the Git provider should use the /api/webhook endpoint of your Argo CD instance ex:https://argocd.example.com/api/webhook. If you wish to use a shared secret, input an arbitrary value in the secret. This value will be used when configuring the webhook in the next step.

Please be noted:

  • When creating the webhook in GitHub, the “Content type” needs to be set to “application/json“. The default value “application/x-www-form-urlencoded” is not supported by the library used to handle the hooks
  • The webhook handler does not differentiate between branch events and tag events where the branch and tag names are the same. A hook event for a push to branch x will trigger a refresh for an app pointing at the same repo with targetRevision: refs/tags/x.
  • If Argo CD is publicly accessible, then configuring a webhook secret is recommended to prevent a DDoS attack.

Configure Argo CD with The WebHook Secret

In the argocd-secret kubernetes secret, configure one of the following keys with the Git provider’s webhook secret configured in step 1.

ProviderK8s Secret KeyGitHubwebhook.github.secretGitLabwebhook.gitlab.secretBitBucketwebhook.bitbucket.uuidBitBucketServerwebhook.bitbucketserver.secretGogswebhook.gogs.secret

Edit the Argo CD kubernetes secret:

TIP: for ease of entering secrets, kubernetes supports inputting secrets in the stringData field, which saves you the trouble of base64 encoding the values and copying it to the data field. Simply copy the shared webhook secret created in step 1, to the corresponding GitHub/GitLab/BitBucket key under the stringData field:

Continue reading on: https://foxutech.com/argo-cd-git-webhook-configuration/

You can follow us on social media, to get some short knowledges regularly.


Only registered users can post comments. Please, login or signup.

Start blogging about your favorite technologies, reach more readers and earn rewards!

Join other developers and claim your FAUN account now!

Avatar

We are Foxutech

@foxutech
#devops #docker #github #rundeck #nagios #linux #containers #kubernetes #terraform #ansible #saltstack #security #automation #microservices #gitops #argocd #crossplane #prometheus
User Popularity
192

Influence

19k

Total Hits

11

Posts