Sync icon
Status icon
SlackIncomingWebhook icon
Webhook icon

Event-Driven Argo CD Sync on CI Completion

Trigger an Argo CD sync the moment CI finishes. Kestra prunes drift, verifies application health, and reports the result to Slack, all event-driven.

Categories
Infrastructure

Close the gap between continuous integration and GitOps delivery with event-driven Argo CD syncing on Kestra. The moment your CI pipeline finishes a build, a webhook fires this flow, which triggers an Argo CD application sync with prune, confirms the application reports healthy, and posts the outcome to Slack. Instead of polling Git on a fixed interval or syncing manually, deployments follow successful builds in seconds, and your team learns about every promotion in the channel they already watch.

How it works

  1. The on_ci_complete trigger (io.kestra.plugin.core.trigger.Webhook) exposes a webhook guarded by a secret key. Your CI system POSTs to it when a build completes.
  2. The sync task (io.kestra.plugin.argocd.apps.Sync) triggers an Argo CD sync for the application input, with prune: true to remove resources no longer defined in Git and revision: HEAD.
  3. The status task (io.kestra.plugin.argocd.apps.Status) confirms the application is healthy after the sync settles.
  4. The notify task (io.kestra.plugin.slack.notifications.SlackIncomingWebhook) posts the result to Slack via an incoming webhook URL.
  5. pluginDefaults injects the shared server and token values into both Argo CD tasks so credentials stay in one place.

What you get

  • Hands-off deployments that fire the instant CI passes, not on a polling delay.
  • Automatic pruning of drifted resources so the cluster matches Git.
  • A post-sync health check that catches bad rollouts immediately.
  • A Slack notification on every sync for full team visibility.

Who it's for

  • Platform and DevOps engineers running GitOps with Argo CD.
  • SRE teams that want CI and CD wired into one auditable pipeline.
  • Release managers who need a notification trail for every promotion.

Why orchestrate this with Kestra

Argo CD's own controller reconciles on a schedule or on Git webhooks, but it has no native way to gate a sync on a CI build outcome, chain a downstream health check, retry transient API failures, or fan results out to Slack as one tracked unit of work. Kestra adds the event trigger that ties the sync to CI completion, captures full execution lineage and logs, supports retries and error handling, and keeps everything in declarative, version-controlled YAML.

Prerequisites

  • An existing Argo CD application and a reachable Argo CD API server.
  • A CI system able to POST to a webhook on build success.

Secrets

  • ARGOCD_SERVER: Argo CD API server endpoint.
  • ARGOCD_TOKEN: Argo CD API token used to authenticate the sync and status calls.
  • ARGOCD_SYNC_WEBHOOK_KEY: secret key that guards the webhook trigger.
  • SLACK_WEBHOOK_URL: Slack incoming webhook URL for notifications.

Quick start

  1. Set the four secrets above in your Kestra namespace.
  2. Set the application input to the Argo CD application you want to sync.
  3. Configure your CI pipeline to POST to the Kestra webhook URL on a successful build, including the webhook key.
  4. Run a build and watch the sync, health check, and Slack notification execute end to end.

How to extend

  • Add a revision input to sync a specific Git SHA or tag instead of HEAD.
  • Disable prune for additive-only syncs where deletions should be manual.
  • Insert an approval gate before sync when production promotions need a human sign-off.
  • Add retries on the Argo CD tasks to ride out transient API or controller hiccups.
  • Branch the Slack payload on the status result to alert louder when an application reports unhealthy.

Links

See How

New to Kestra?

Use blueprints to kickstart your first workflows.