GitLab Event Triggers allows you to automatically trigger Tekton pipelines through GitLab's Webhook events. It supports multiple event types, including code pushes, merge requests, comments, etc., enabling you to build a complete CI/CD automation workflow.
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 |
---|---|---|
project-id | GitLab Project ID | 1234 |
project-name | Project Name | my-project |
project-path | Project Full Path | group/my-project |
project-web-url | Project Web URL | https://gitlab.com/group/my-project |
git-repo-url | Git HTTP URL | https://gitlab.com/group/my-project.git |
git-repo-ssh-url | Git SSH URL | git@gitlab.com:group/my-project.git |
git-repo-name | Repository Name | my-project |
user-name | User Full Name | John Doe |
user-username | Username | johndoe |
user-email | User Email | john@example.com |
Triggered when a developer pushes code to a GitLab repository. Suitable for:
Variable Name | Description | Example Value |
---|---|---|
git-revision | Git revision | refs/heads/main |
git-commit-sha | Committed SHA | 8a1b3c4d5e6f... |
git-commit-message | Commit Message | Update README.md |
git-commit-timestamp | Commit Timestamp | 2025-01-26T10:30:00Z |
Triggered when a merge request is created, updated, or closed. Suitable for:
Variable Name | Description | Example Value |
---|---|---|
mergereq-sha | Last Commit SHA | 8a1b3c4d5e6f... |
mergereq-action | Merge Request Action | open , reopen , update , close , merge |
mergereq-state | Merge Request State | opened , closed , merged |
mergereq-number | Merge Request Number | 42 |
mergereq-url | Merge Request URL | https://gitlab.com/group/project/-/merge_requests/42 |
mergereq-title | Merge Request Title | Add new feature |
mergereq-description | Merge Request Description | This PR adds... |
mergereq-merge-status | Merge Status | can_be_merged |
mergereq-source-branch | Source Branch | feature/new-feature |
mergereq-target-branch | Target Branch | main |
mergereq-source-path | Source Repository Path | group/my-project |
mergereq-target-path | Target Repository Path | group/my-project |
Refer to your GitLab instance's webhook documentation or GitLab's official merge request event documentation
Supports the following types of comments:
Suitable for:
Variable Name | Description | Example Value |
---|---|---|
comment | Comment Content | LGTM 👍 |
comment-url | Comment URL | https://gitlab.com/group/project/-/merge_requests/42#note_123 |
Variable Name | Description | Example Value |
---|---|---|
mergereq-sha | Last Commit SHA | 8a1b3c4d5e6f... |
mergereq-action | Merge Request Action | open , reopen , update , close , merge |
mergereq-state | Merge Request State | opened , closed , merged |
mergereq-number | Merge Request Number | 42 |
mergereq-url | Merge Request URL | https://gitlab.com/group/project/-/merge_requests/42 |
mergereq-title | Merge Request Title | Add new feature |
mergereq-description | Merge Request Description | This PR adds... |
mergereq-merge-status | Merge Status | can_be_merged |
mergereq-source-branch | Source Branch | feature/new-feature |
mergereq-target-branch | Target Branch | main |
mergereq-source-path | Source Repository Path | group/my-project |
mergereq-target-path | Target Repository Path | group/my-project |
Variable Name | Description | Example Value |
---|---|---|
git-commit-sha | Commit SHA | 8a1b3c4d5e6f... |
git-commit-message | Commit Message | Update README.md |
git-commit-timestamp | Commit Timestamp | 2025-01-26T10:30:00Z |
git-commit-url | Commit URL | https://gitlab.com/group/project/-/commit/8a1b3c4d |
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.EventListener
, for example, using the https
mode:
If the goal is to implement continuous integration through the trigger with the following requirements:
To simplify this documentation, we assume the pipeline is ready with the following parameters provided:
Parameter Name | Description | Example Value |
---|---|---|
git-revision | Git revision for executing the target pipeline | refs/heads/main |
git-repo-url | Git Repository URL | https://gitlab.com/group/project.git |
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 gitlab-push-trigger.yaml
:
Create the resource in the environment:
Save the following YAML as gitlab-merge-request-trigger.yaml
:
Please adjust the Interceptor configuration as needed.
Create the resource in the environment:
Validate by submitting code and creating a Merge Request.
CLI:
You can obtain the pipeline execution status using kubectl -n <namespace> get pipelinerun
.
Console:
Access Pipelines
> PipelineRuns
to view the triggered pipelines.