Back to Gitlabhq

Jobs

doc/user/glql/data_sources/jobs.md

19.0.06.8 KB
Original Source

{{< details >}}

  • Tier: Free, Premium, Ultimate
  • Offering: GitLab.com, GitLab Self-Managed, GitLab Dedicated

{{< /details >}}

{{< history >}}

  • Introduced in GitLab 18.11.
  • Fields browseArtifactsPath, canPlayJob, commitPath, createdByTag, exitCode, pipeline, playPath, queuedDuration, refPath, retryPath, and scheduledAt added in GitLab 18.11.

{{< /history >}}

[!note] Jobs do not support sorting.

Allowed scopes

ScopeDescription
projectQuery jobs in a specific project.

For more information, see scopes.

Query fields

FieldNameOperators
Kindkind=
Pipelinepipeline=
Statusstatus=
With artifactswithArtifacts=, !=

Kind {#job-kind}

Description: Filter jobs by their kind.

Allowed value types:

  • Enum, one of bridge or build

Notes:

  • bridge jobs are trigger jobs that start downstream pipelines.
  • build jobs are regular CI/CD jobs.

Pipeline {#job-pipeline}

Description: Filter jobs by the pipeline they belong to, using the pipeline IID.

Allowed value types: Number (pipeline IID)

Status {#job-status}

Description: Filter jobs by their CI/CD status.

Allowed value types:

  • Enum, one of canceled, canceling, created, failed, manual, pending, preparing, running, scheduled, skipped, success, waiting_for_callback, or waiting_for_resource

With artifacts {#job-with-artifacts}

Description: Filter jobs by whether they have artifacts.

Allowed value types: Boolean (either true or false)

Display fields

FieldName (and alias)Description
ActiveactiveDisplay whether the job is active
Allow failureallowFailureDisplay whether the job is allowed to fail
Browse artifacts pathbrowseArtifactsPathDisplay the URL for browsing the job's artifact archive
Can play jobcanPlayJobDisplay whether the current user can play the job
CancelablecancelableDisplay whether the job can be canceled
Commit pathcommitPathDisplay the path to the commit that triggered the job
CoveragecoverageDisplay code coverage percentage
Created atcreated, createdAtDisplay when the job was created
Created by tagcreatedByTagDisplay whether the job was created by a tag
DurationdurationDisplay the job duration
Erased aterased, erasedAtDisplay when job artifacts were erased
Exit codeexitCodeDisplay the exit code of the job
Failure messagefailureMessageDisplay the failure message
Finished atfinished, finishedAtDisplay when the job finished
IDidDisplay the job ID
KindkindDisplay the job kind (bridge or build)
Manual jobmanualJobDisplay whether this is a manual job
NamenameDisplay the job name
PipelinepipelineDisplay the pipeline the job belongs to
Play pathplayPathDisplay the path to play the job
PlayableplayableDisplay whether the job can be played
Queued atqueued, queuedAtDisplay when the job was queued
Queued durationqueuedDurationDisplay how long the job was queued before starting
Ref namerefNameDisplay the Git ref name
Ref pathrefPathDisplay the path to the ref that triggered the job
RetriedretriedDisplay whether the job was retried
Retry pathretryPathDisplay the path to retry the job
RetryableretryableDisplay whether the job can be retried
ScheduledscheduledDisplay whether the job is scheduled
Scheduled atscheduledAtDisplay when the job was scheduled to run
Scheduling typeschedulingTypeDisplay the scheduling type
Short SHAshortShaDisplay the short commit SHA
SourcesourceDisplay the job source
StagestageDisplay the pipeline stage the job belongs to
Started atstarted, startedAtDisplay when the job started
StatusstatusDisplay the job status
StuckstuckDisplay whether the job is stuck
TagstagsDisplay the runner tags
TriggeredtriggeredDisplay whether the job was triggered
Web pathwebPathDisplay the web path to the job

Examples

  • List all failed jobs in the gitlab-org/gitlab project:

    yaml
    ```glql
    display: table
    fields: name, status, stage, startedAt
    query: type = Job and project = "gitlab-org/gitlab" and status = failed
    ```
    
  • List all jobs with artifacts in the gitlab-org/gitlab project:

    yaml
    ```glql
    display: table
    fields: name, status, stage
    query: type = Job and project = "gitlab-org/gitlab" and withArtifacts = true
    ```