Skip to content

REST API: add pipeline source value

Proposal

The REST API for Gitlab pipelines: https://docs.gitlab.com/ee/api/pipelines.html doesn't currently expose information about pipeline source (e.g. whether it was caused by a trigger/push/MR/schedule).

This information is available to running a job as CI_PIPELINE_SOURCE (see https://docs.gitlab.com/ee/ci/variables/predefined_variables.html) however I can't find a way to find it retrospectively.

I believe it would be useful to expose that information via REST. My rationale:

  • feature parity with UI: when browsing Jobs, you can now see which of them were "Scheduled". You currently can't filter them out with REST API though
  • for statistical purposes (external project analytics)
  • for job artifacts retention purposes (which is specifically the reason I started looking for this information): quite often the "scheduled" jobs are re-testing a project or executing some scheduled task which doesn't need record.

To put it in a form user story:

As a Gitlab project administrator, I'd like to be able to archive and delete all job traces coming from scheduled builds. To achieve that, I need access to information about the cause (source) of a particular job (or its parent pipeline).

Edited by Waldek Maleska