project_job
Gets or lists a project_job resource.
Overview​
| Name | project_job |
| Type | Resource |
| Id | gitlab.ci.project_job |
Fields​
The following fields are returned by SELECT queries:
- get
GraphQL response envelope
| Name | Datatype | Description |
|---|---|---|
id | string | ID of the job. |
name | string | Name of the job. |
ref_name | string | Ref name of the job. |
active | boolean | Indicates the job is active. |
allow_failure | boolean | Whether the job is allowed to fail. |
browse_artifacts_path | string | URL for browsing the artifact's archive. |
can_play_job | boolean | Indicates whether the current user can play the job. |
cancelable | boolean | Indicates the job can be canceled. |
commit_path | string | Path to the commit that triggered the job. |
coverage | number | Coverage level of the job. |
created_at | string | When the job was created. |
created_by_tag | boolean | Whether the job was created by a tag. |
duration | integer | Duration of the job in seconds. |
erased_at | string | When the job was erased. |
exit_code | integer | Exit code of the job. Available for jobs that started after upgrading to GitLab 16.10 and failed with an exit code. |
failure_message | string | Message on why the job failed. |
finished_at | string | When a job has finished running. |
kind | string | Indicates the type of job. (BUILD, BRIDGE) |
manual_job | boolean | Whether the job has a manual action. |
play_path | string | Play path of the job. |
playable | boolean | Indicates the job can be played. |
project | object | Project identity (id, full_path, name) |
queued_at | string | When the job was enqueued and marked as pending. |
queued_duration | string | How long the job was enqueued before starting. |
ref_path | string | Path to the ref. |
retried | boolean | Indicates that the job has been retried. |
retry_path | string | Retry path of the job. |
retryable | boolean | Indicates the job can be retried. |
scheduled | boolean | Indicates the job is scheduled. |
scheduled_at | string | Schedule for the build. |
scheduling_type | string | Type of job scheduling. Value is dag if the job uses the needs keyword, and stage otherwise. |
short_sha | string | Short SHA1 ID of the commit. |
source | string | Policy or action that initiated the job. If not set, the value is inherited from the pipeline. |
started_at | string | When the job was started. |
status | string | Status of the job. (CREATED, WAITING_FOR_RESOURCE, PREPARING, WAITING_FOR_CALLBACK, PENDING, RUNNING, SUCCESS, FAILED, CANCELING, CANCELED, SKIPPED, MANUAL, SCHEDULED) |
stuck | boolean | Indicates the job is stuck. |
tags | array | |
triggered | boolean | Whether the job was triggered. |
web_path | string | Web path of the job. |
Methods​
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | full_path, id, host | One job belonging to the project, selected by ID. Generated from the GitLab GraphQL schema field Project.job (CiJob). |
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.
| Name | Datatype | Description |
|---|---|---|
full_path | string | Full path of the project, for example gitlab-org/gitlab |
host | string | GitLab 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) |
id | string | ID of the job. |
SELECT examples​
- get
One job belonging to the project, selected by ID. Generated from the GitLab GraphQL schema field Project.job (CiJob).
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_job
WHERE full_path = '{{ full_path }}' -- required
AND id = '{{ id }}' -- required
AND host = '{{ host }}' -- required (defaults to gitlab.com; or set GITLAB_HOST)
;