Skip to content

Cross-project `trigger` ability

Problem

We currently support triggers via the API, but to use it in a .gitlab-ci.yml requires ugly CURLing and passing secure tokens.

Further information

As a developer, I want to be able to trigger CI build for one component after completing another component. e.g. make a change to the API, then trigger a pipeline for a downstream dependency to pick up the changes.

Solution

We simplify that process by providing a higher-level construct and replace/supplement https://docs.gitlab.com/ee/ci/triggers/#ci-job-token (EE feature)

Note: We do not replace/supplement https://docs.gitlab.com/ce/ci/triggers/README.html#trigger-token (CE and EE feature)

job:
  trigger: my/project
  • The variables included in the vars: section are passed automatically to the triggered pipeline.
  • The job which represents the trigger will not be clickable (similar to a deploy job to GitLab pages) and thus will have no job detail page
  • Jobs that are not clickable will have their cursor change to not-allowed (trigger jobs + GitLab pages jobs)
  • A trigger job cannot have a script of its own
  • A trigger job should not represent a downstream project pipeline as we already have dedicated nodes for that inside of the pipeline graph + this would have made things complicated for https://gitlab.com/gitlab-org/gitlab-ce/issues/39640.
  • https://gitlab.com/gitlab-org/gitlab-ce/issues/39640 will essentially be an iteration on trigger jobs and adds wait/depend to the mix so the status waits/depends on the downstream pipeline as well.
  • For this issue the trigger job will just succeed after triggering the downstream pipeline.
  • Trigger jobs will have the tag/badge trigger

Links / references

  • Originally from https://gitlab.com/gitlab-org/gitlab-ee/issues/933 (Multi-project pipeline).
  • Proposal came from gitlab-ce#3743 (GitLab Pipeline).
  • First-class triggers: gitlab-ce#16556.
  • Link between project pipeline views: gitlab-ce#22550
  • Consolidated view of entire pipeline across projects: gitlab-ce#22558
  • Cross-project build artifacts dependencies: gitlab-ce#14728

Documentation

The page on how to trigger pipelines (https://docs.gitlab.com/ee/ci/triggers/) should be refactored to describe that there is now an additional way to trigger pipelines using the .gitlab-ci.yml, in addition to using the API.

Edited by Dimitrie Hoekstra