Harbor Event Triggers allows you to automatically trigger Tekton pipelines through Harbor's Webhook events. It supports multiple event types, including artifact push, pull, delete, and scanning completion, enabling you to build a complete CI/CD automation workflow for container images and OCI charts.
All output variables can be used for pipeline parameter mapping. You can access parameter values using $(tt.params.<param name>).
| Variable Name | Description | Example Value |
|---|---|---|
| event-type | Event Type | PUSH_ARTIFACT, PULL_ARTIFACT, DELETE_ARTIFACT, SCANNING_COMPLETED |
| occur-at | Event Occurrence Time | 1763369448 |
| operator | Who triggered the event | admin |
| repository-name | Repository Name | alpine |
| repository-namespace | Repository Namespace | library |
| repository-full-name | Repository Full Name | library/alpine |
| repository-type | Repository Type | public, private, chart |
| artifact-digest | Artifact Digest | sha256:c4975008127577bfc34169439e890db7cfb1cedccabe49c059c88f913cb27edd |
| artifact-tag | Artifact Tag | latest, v1.0.0 (optional, may be empty if artifact is referenced by digest only) |
| artifact-resource-url | Artifact Resource URL | 192.168.0.117/library/alpine:latest |
Handling Optional Fields: The artifact-tag field is optional and may be missing in the payload if the artifact is referenced by digest only. The repository-date-created field is available for push and pull events, but not for delete and scanning events.
Important: If a field referenced in the TriggerBinding may be missing from the payload, you must set a default value for that parameter in the TriggerTemplate. Otherwise, the trigger will fail when the field is missing. For example, if artifact-tag might be missing, add default: "" to the parameter definition in your TriggerTemplate.
Triggered when an artifact (container image or OCI chart) is pushed to a Harbor repository. Suitable for:
| Variable Name | Description | Example Value |
|---|---|---|
| repository-date-created | Repository Creation Time | 1763369448 |
All basic variables listed above are also available.
Triggered when an artifact is pulled from a Harbor repository. Suitable for:
| Variable Name | Description | Example Value |
|---|---|---|
| repository-date-created | Repository Creation Time | 1763369448 |
All basic variables listed above are also available.
Triggered when an artifact is deleted from a Harbor repository. Suitable for:
All basic variables listed above are available. Note that repository-date-created is not available for delete events.
Triggered when a vulnerability scan of an artifact is completed. Suitable for:
All basic variables listed above are available. Note that repository-date-created is not available for scanning events.
The scan_overview field structure varies depending on the scan type (SBOM, vulnerability check). The structure uses dynamic MIME type keys (e.g., application/vnd.security.vulnerability.report; version=1.1), which cannot be directly parsed using JSONPath in TriggerBindings. If you need to extract detailed scan results (such as vulnerability counts, scan status), consider using CEL interceptors or creating separate bindings for different scan types.
Refer to Harbor's official webhook documentation for more details about event structures.
Some fields in Harbor events may be optional or missing depending on the event type or how the artifact is referenced. For example:
artifact-tag: May be missing if the artifact is referenced by digest onlyrepository-date-created: Available in push and pull events, but not in delete and scanning eventsImportant: When using ClusterTriggerBindings that reference optional fields, you must provide default values in your TriggerTemplate for those parameters. If a field is missing from the payload and no default is provided, the trigger will fail with a JSONPath parsing error.
Example: To handle an optional artifact-tag field, configure your TriggerTemplate like this:
This ensures that if the tag field is missing from the Harbor event payload, the trigger will use an empty string instead of failing.
EventListener has been created in the environment and is capable of processing Trigger in the target namespace. Please contact your platform administrator for more information.EventListener mentioned above.Pipeline, as well as the necessary running configurations, have been created.tekton-webhook)If the goal is to implement continuous integration through the trigger with the following requirements:
Event Type Filtering: If your Harbor webhook is configured to send multiple event types (e.g., both Push Artifact and Pull Artifact), you must configure CEL interceptors in your Triggers to filter events by type. Without interceptors, all configured event types will trigger the same pipeline, which may cause unintended executions.
For example, if your webhook sends both PUSH_ARTIFACT and PULL_ARTIFACT events to the same EventListener, and you have a Trigger without an interceptor, both events will trigger the pipeline. Use interceptors to route different event types to different Triggers or pipelines.
To simplify this documentation, we assume the pipeline is ready with the following parameters provided:
| Parameter Name | Description | Example Value |
|---|---|---|
| repository-full-name | Repository full name for the target pipeline | library/alpine |
| artifact-tag | Artifact tag | latest |
| artifact-digest | Artifact digest | sha256:c4975008127577bfc34169439e890db7cfb1cedccabe49c059c88f913cb27edd |
Please replace with your actual pipeline information.
| Information | Description |
|---|---|
my-namespace | Namespace Name |
my-pipeline | Pipeline Name |
workspaces | Workspace configuration, modify based on actual pipeline workspace configuration and requirements |
Next, we only need to configure the two triggers below:
Save the following YAML as harbor-push-trigger.yaml:
Create the resource in the environment:
Event Type Filtering Example: If your Harbor webhook is configured to send both Push and Pull events, and you want to handle them differently, you can create separate Triggers with CEL interceptors to filter by event type:
Push Event Trigger (shown above):
Pull Event Trigger (if needed):
This ensures that push events only trigger the push pipeline, and pull events only trigger the pull pipeline, even if both event types are sent to the same EventListener.
Save the following YAML as harbor-scanning-trigger.yaml:
Please adjust the Interceptor configuration as needed. You can filter based on scan status, vulnerability severity, etc. Note that the scan_overview structure uses dynamic MIME type keys, so you may need to adjust the JSONPath expression based on your scan type.
Create the resource in the environment:
Validate by pushing an image to Harbor and triggering a vulnerability scan.
CLI:
You can obtain the pipeline execution status using kubectl -n <namespace> get pipelinerun.
Console:
Access Pipelines > PipelineRuns to view the triggered pipelines.
Scenario: Automatically deploy container images to staging or production environments when they are pushed to Harbor.
Configuration:
harbor-push-artifact bindingartifact-resource-url and deploy it to the target environmentExample Use Cases:
production to production environmentScenario: Enforce security policies by blocking deployments of images with critical vulnerabilities.
Configuration:
harbor-scanning-completed bindingExample Use Cases:
Scenario: Automatically manage artifact lifecycle based on usage patterns and retention policies.
Configuration:
harbor-pull-artifact and harbor-delete-artifact eventsExample Use Cases:
Scenario: Build a complete CI/CD pipeline that triggers on image push, runs tests, performs security scans, and deploys based on scan results.
Configuration:
harbor-push-artifact trigger: Start build and test pipelineharbor-scanning-completed trigger: Continue to deployment if scan passesExample Use Cases: