External commit statuses
- Tier: Free, Premium, Ultimate
- Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated
External commit statuses allow external CI/CD systems like Jenkins, CircleCI, or custom deployment tools to integrate with GitLab pipelines. External systems post commit statuses back to GitLab, and the status results appear alongside CI/CD jobs in merge requests and commit views.
When external systems post commit statuses using the Commits API, GitLab handles these statuses by either adding them to existing pipelines or creating new pipelines to contain them.
Pipeline selection
When you post a commit status from an external system, a find-or-create approach is used:
- GitLab searches for the most recent
non-archivedCI pipeline for the given commit SHA and ref. You can also search directly for a pipeline by including thepipeline_idparameter. - If GitLab finds a suitable pipeline, it appends the new job status to that pipeline. For jobs appended to existing pipelines,
CI_PIPELINE_SOURCEmatches the pipeline source (for example,pushormerge_request_event). - If no suitable pipeline exists, GitLab creates a new pipeline to contain the job. For new pipelines,
CI_PIPELINE_SOURCEisexternal.
External job statuses appear in an external stage in the pipeline, separate from other GitLab CI/CD stages.
When duplicate pipelines exist for the same commit, external status placement becomes ambiguous. GitLab selects the latest pipeline using newest_first, but with concurrent pipeline creation, this can lead to external statuses appearing in unexpected pipelines or becoming invisible in merge request views.
Configure workflow rules to avoid duplicate pipelines or target a pipeline directly with pipeline_id.
Job updates and retries
When you post commit statuses from external systems:
- If a
runningorpendingjob with the samenameuserandshaalready exists in the target pipeline, GitLab updates its status.- If a different user updates a job with the same
namethe job is retried. This creates a new job and hides the old job from the current pipeline.
- If a different user updates a job with the same
- You can retry a job that is not
runningorpendingwith the samenamebut differentstatus(for example, sendsuccessfor a job markedfailed). This creates a new job and hides the old job from the current pipeline. - Different external services can add jobs to the same SHA and pipeline by using a unique job
name.
If an update is already in progress for a SHA/ref combination, a 409 error is returned.
Retry the request to handle this error.
Troubleshooting
External statuses not visible in merge requests
If external CI statuses don’t appear in merge request pipelines:
- Check if you have both merge request and branch pipelines running for the same commit.
- Verify your workflow rules prevent duplicate pipelines.
- Confirm the external system is posting to the correct ref.
- If the commit is associated with a merge request, ensure the API call targets the commit in the merge request’s source branch.
For more information, see avoid duplicate pipelines.