Skip to main content

project_jobs

Gets or lists a project_jobs resource.

Overview​

Nameproject_jobs
TypeResource
Idgitlab.ci.project_jobs

Fields​

The following fields are returned by SELECT queries:

GraphQL response envelope

NameDatatypeDescription
idstringID of the job.
namestringName of the job.
ref_namestringRef name of the job.
activebooleanIndicates the job is active.
allow_failurebooleanWhether the job is allowed to fail.
browse_artifacts_pathstringURL for browsing the artifact's archive.
can_play_jobbooleanIndicates whether the current user can play the job.
cancelablebooleanIndicates the job can be canceled.
commit_pathstringPath to the commit that triggered the job.
coveragenumberCoverage level of the job.
created_atstringWhen the job was created.
created_by_tagbooleanWhether the job was created by a tag.
durationintegerDuration of the job in seconds.
erased_atstringWhen the job was erased.
exit_codeintegerExit code of the job. Available for jobs that started after upgrading to GitLab 16.10 and failed with an exit code.
failure_messagestringMessage on why the job failed.
finished_atstringWhen a job has finished running.
kindstringIndicates the type of job. (BUILD, BRIDGE)
manual_jobbooleanWhether the job has a manual action.
play_pathstringPlay path of the job.
playablebooleanIndicates the job can be played.
projectobjectProject identity (id, full_path, name)
queued_atstringWhen the job was enqueued and marked as pending.
queued_durationstringHow long the job was enqueued before starting.
ref_pathstringPath to the ref.
retriedbooleanIndicates that the job has been retried.
retry_pathstringRetry path of the job.
retryablebooleanIndicates the job can be retried.
scheduledbooleanIndicates the job is scheduled.
scheduled_atstringSchedule for the build.
scheduling_typestringType of job scheduling. Value is dag if the job uses the needs keyword, and stage otherwise.
short_shastringShort SHA1 ID of the commit.
sourcestringPolicy or action that initiated the job. If not set, the value is inherited from the pipeline.
started_atstringWhen the job was started.
statusstringStatus of the job. (CREATED, WAITING_FOR_RESOURCE, PREPARING, WAITING_FOR_CALLBACK, PENDING, RUNNING, SUCCESS, FAILED, CANCELING, CANCELED, SKIPPED, MANUAL, SCHEDULED)
stuckbooleanIndicates the job is stuck.
tagsarray
triggeredbooleanWhether the job was triggered.
web_pathstringWeb path of the job.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
listselectfull_path, hostkind, pipeline_iid, with_artifactsJobs of a project. This field can only be resolved for one project in any single request. Generated from the GitLab GraphQL schema field Project.jobs (connection of CiJob nodes).

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
full_pathstringFull path of the project, for example gitlab-org/gitlab
hoststringGitLab host, with an optional port (default gitlab.com). Resolved from the GITLAB_HOST environment variable when it is set (x-stackQL-envVar); a WHERE host value always takes precedence. Self-managed instances: the provider is generated from the gitlab.com schema, so older instances may reject fields they do not serve. (default: gitlab.com, x-stackQL-envVar: GITLAB_HOST)
kindstringFilter jobs by kind.
pipeline_iidstringFilter jobs by the internal pipeline ID (iid).
with_artifactsbooleanFilter by artifacts presence.

SELECT examples​

Jobs of a project. This field can only be resolved for one project in any single request. Generated from the GitLab GraphQL schema field Project.jobs (connection of CiJob nodes).

SELECT
id,
name,
ref_name,
active,
allow_failure,
browse_artifacts_path,
can_play_job,
cancelable,
commit_path,
coverage,
created_at,
created_by_tag,
duration,
erased_at,
exit_code,
failure_message,
finished_at,
kind,
manual_job,
play_path,
playable,
project,
queued_at,
queued_duration,
ref_path,
retried,
retry_path,
retryable,
scheduled,
scheduled_at,
scheduling_type,
short_sha,
source,
started_at,
status,
stuck,
tags,
triggered,
web_path
FROM gitlab.ci.project_jobs
WHERE full_path = '{{ full_path }}' -- required
AND host = '{{ host }}' -- required (defaults to gitlab.com; or set GITLAB_HOST)
AND kind = '{{ kind }}'
AND pipeline_iid = '{{ pipeline_iid }}'
AND with_artifacts = '{{ with_artifacts }}'
;