Webhooks
In the Artifact Registry in Harness, Triggers automate actions based on events related to your artifacts, and allow you to streamline workflows by responding dynamically to changes in your artifact repositories.
Types of triggers
- Artifact Creation
- Executes when a new artifact is pushed to the registry.
- Useful for automating deployments or notifying downstream systems.
- Artifact Deletion
- Triggers when an artifact version is deleted.
A webhook sends a notification to your app when a new artifact is pushed to the registry, and the trigger in your CD build pipeline automatically starts a deployment or build process in response to that notification. To configure and use a webhook, you need to:
- Create a webhook in the Artifact Registry.
- Create a trigger in the CD build pipeline.
- Configure the trigger to run against the webhook.
- Add a webhook
- Artifact source
- Create trigger
Test your webhook
Test your webhook by pushing an artifact to the registry.
- Select your artifact registry.
- Select Set up client.
- Follow the on-screen instructions to test your webhook.
Once logged in to your registry type, the steps should look like this (using Docker as an example):
docker tag <IMAGE_NAME>:<TAG> pkg.app.harness.io/<ACCOUNT_ID>/<REGISTRY_NAME>/<IMAGE_NAME>:<TAG>
# e.g. docker tag my-image:latest pkg.app.harness.io/123456/my-registry/demoimg:v1
docker push pkg.app.harness.io/<ACCOUNT_ID>/<REGISTRY_NAME>/<IMAGE_NAME>:<TAG>
# e.g. docker push pkg.app.harness.io/123456/my-registry/demoimg:v1
Once you have pushed an artifact to the registry, you can review the trigger and executions in the Artifact Registry.
As this webhook was created by the trigger, while reviewing it, you cannot edit its configuration.
Use cases for triggers
- CI/CD Automation: Start a pipeline when a new artifact is ingested.
- Version Control: Notify teams when a new version of an artifact is available.
- Security & Compliance: Scan artifacts when they are pushed or updated.
- Cleanup & Retention Policies: Automatically remove outdated artifacts.
Webhooks and artifact registry triggers
Webhooks allow external systems to interact with Artifact Registry events in real time. Depending on your configuration, webhooks can either notify external systems about artifact-related events or enable external systems to trigger specific actions in Harness.
Example Use Case:
- Outgoing Webhooks: Notify a monitoring system when a new artifact is ingested or updated, enabling real-time tracking and validation.
- Incoming Webhooks: A third-party build system triggers an artifact ingestion event in Harness, automating downstream workflows.
Go to platform triggers to find out more about the types of triggers that are at your disposal including webhooks, artifacts, manifests and schedules triggers.