
GitLab Pipelines Trigger
CertifiedTrigger a flow when a GitLab pipeline finishes
GitLab Pipelines Trigger
Trigger a flow when a GitLab pipeline finishes
Polls the most recently updated pipelines of a project and starts one execution with every pipeline that reached one of the watched statuses since the last poll. Pipelines already seen are kept in the trigger state, so each one fires once.
The first poll, when the state is empty, only records the pipelines that already finished and starts no execution, so the trigger does not fire on pipelines that ended before it was created.
Every later poll asks GitLab only for the pipelines updated since the latest one recorded in the state (minus a one-minute overlap) and pages through them up to maxPipelines; set maxPipelines above the number of pipelines updated during one interval on busy projects so none is missed.
type: io.kestra.plugin.gitlab.pipelines.TriggerExamples
Log every pipeline of main that succeeded, failed or was canceled.
id: gitlab_pipeline_finished
namespace: company.team
triggers:
- id: on_pipeline_finished
type: io.kestra.plugin.gitlab.pipelines.Trigger
token: "{{ secret('GITLAB_TOKEN') }}"
projectId: "12345"
ref: main
interval: PT1M
tasks:
- id: handle_event
type: io.kestra.plugin.core.log.Log
message: "Pipeline {{ trigger.pipeline.id }} ended with {{ trigger.pipeline.status }}: {{ trigger.pipeline.webUrl }}"
Alert on failed pipelines only, inspecting up to 50 updated pipelines per poll.
id: gitlab_pipeline_failed
namespace: company.team
triggers:
- id: on_pipeline_failed
type: io.kestra.plugin.gitlab.pipelines.Trigger
token: "{{ secret('GITLAB_TOKEN') }}"
projectId: "12345"
statuses:
- FAILED
maxPipelines: 50
interval: PT2M
tasks:
- id: log_failures
type: io.kestra.plugin.core.log.Log
message: "{{ trigger.total }} pipeline(s) failed, latest: {{ trigger.pipeline.webUrl }}"
Properties
projectId *string
Project ID or path
Numeric project ID or URL-encoded project path.
token *string
Access token used for API calls
GitLab Personal/Project/Group Access Token with the read_api scope, sent as the PRIVATE-TOKEN header.
allowConcurrent boolean
falseSpecifies whether a trigger is allowed to start a new execution even if a previous run is still in progress.
apiPath string
/api/v4/projectsProjects API path
Projects API prefix appended before the project ID; defaults to /api/v4/projects.
interval string
PT1MdurationInterval between polling.
The interval between 2 different polls of schedule, this can avoid to overload the remote system with too many calls. For most of the triggers that depend on external systems, a minimal interval must be at least PT30S. See ISO_8601 Durations for more information of available interval values.
maxPipelines integerstring
20Maximum pipelines per poll
Maximum number of updated pipelines inspected on each poll, most recently updated first. Defaults to 20; must be between 1 and 100.
on string
CREATECREATEUPDATECREATE_OR_UPDATEState change mode
CREATE fires once per pipeline, UPDATE also fires again when a watched pipeline changes status, for example after a retry.
ref string
Ref filter
Only watch pipelines of this branch or tag.
stateKey string
State key
Custom key used to store the pipelines already seen.
stateTtl string
PT168HState TTL
How long the pipelines already seen are remembered. Defaults to P7D and must be at least twice the polling interval, otherwise the state expires between two polls and new pipelines are never reported. The updated_after watermark already keeps older pipelines from being listed again, so the state only needs to cover recent ones. If the trigger is paused for longer than stateTtl, the state expires and the next poll starts over as a first poll: it records the pipelines that finished meanwhile without starting an execution.
statuses array
["SUCCESS","FAILED","CANCELED"]CREATEDWAITING_FOR_RESOURCEPREPARINGPENDINGRUNNINGCANCELINGSUCCESSFAILEDCANCELEDSKIPPEDMANUALSCHEDULEDWatched statuses
Pipeline statuses that start an execution. Defaults to SUCCESS, FAILED and CANCELED.
stopAfter array
CREATEDSUBMITTEDRUNNINGPAUSEDRESTARTEDKILLINGSUCCESSWARNINGFAILEDKILLEDCANCELLEDQUEUEDRETRYINGRETRIEDSKIPPEDBREAKPOINTRESUBMITTEDList of execution states after which a trigger should be stopped (a.k.a. disabled).
url string
https://gitlab.comGitLab API base URL
Base URL of the GitLab instance; defaults to https://gitlab.com. Override for self-hosted installations.
when string
trueA condition that determines whether the trigger should run.
A Pebble expression evaluated at trigger time. The trigger fires only when the expression evaluates to a truthy value (true, a non-empty string, a non-zero number). Use this to gate trigger execution on dynamic runtime values such as execution labels, flow variables, or environment conditions.
Outputs
pipeline
First pipeline
The most recently updated pipeline that reached a watched status.
io.kestra.plugin.gitlab.pipelines.Pipeline
date-timeCreation time
Duration in seconds
Time the pipeline spent running; empty while it is still running.
date-timeFinish time
Empty while the pipeline is still running.
Pipeline ID
Global ID of the pipeline, used in the pipeline API endpoints.
Pipeline IID
ID of the pipeline within its project, as shown in the GitLab UI (#12).
Project ID
Numeric ID of the project the pipeline belongs to.
Git ref
Branch or tag the pipeline runs for.
Commit SHA
SHA of the commit the pipeline runs for.
Pipeline source
What started the pipeline, for example push, web, api, schedule or merge_request_event.
date-timeStart time
Empty while the pipeline has not started.
Pipeline status
One of created, waiting_for_resource, preparing, pending, running, canceling, success, failed, canceled, skipped, manual or scheduled.
date-timeLast update time
Pipeline URL
Link to the pipeline in the GitLab UI.
pipelines array
Pipelines
Every pipeline that reached a watched status since the last poll, most recently updated first.
io.kestra.plugin.gitlab.pipelines.Pipeline
date-timeCreation time
Duration in seconds
Time the pipeline spent running; empty while it is still running.
date-timeFinish time
Empty while the pipeline is still running.
Pipeline ID
Global ID of the pipeline, used in the pipeline API endpoints.
Pipeline IID
ID of the pipeline within its project, as shown in the GitLab UI (#12).
Project ID
Numeric ID of the project the pipeline belongs to.
Git ref
Branch or tag the pipeline runs for.
Commit SHA
SHA of the commit the pipeline runs for.
Pipeline source
What started the pipeline, for example push, web, api, schedule or merge_request_event.
date-timeStart time
Empty while the pipeline has not started.
Pipeline status
One of created, waiting_for_resource, preparing, pending, running, canceling, success, failed, canceled, skipped, manual or scheduled.
date-timeLast update time
Pipeline URL
Link to the pipeline in the GitLab UI.
total integer
Number of pipelines