Skip to content

Returning reason for failed job in API response

Release Notes

When you have setup your .gitlab-ci.yml to retry failed jobs and they exceed that number it can be hard to gather data about why those jobs are failing from the API.

Now you can see the failure_reason of a job in the Jobs API to more easily gather data about jobs that are failing.

Problem to solve

Currently you can specify in .gitlab-ci.yml when a job needs to be retried based on the condition of why the job failed, by specifying values for when.

When you look at a failed job via the API, it doesn't state why it failed, e.g. script_failure.

Thank you @albert.vacacintora for this contribution!

Further details

In the response from an API call to retrieve details from a failed job, it would be beneficial if the response includes the reason for failure, such as:

  • unknown_failure
  • script_failure
  • api_failure
  • stuck_or_timeout_failure
  • runner_system_failure
  • missing_dependency_failure
  • runner_unsupported

Links / references

ZD#134393(GitLab internal)

Edited by James Heimbuck