Create UI to allow repositories to trigger pipelines when upstream changes

Problem to solve

Currently the only way to trigger a upstream/downstream pipeline is changing the upstream repository and include a special job that uses the CI_JOB_TOKEN as described here.

This is a limiting factor for two reasons:

  • it assumes that the owner of the downstream repository has access to the upstream repository to make the necessary changes;
  • it becomes cumbersome to keep adding more jobs to the upstream repository whenever a new downstream is created.

Proposal

Allow projects to subscribe one or more parent or upstream repos. Whenever a upstream repository finishes a pipeline successfully, all subscribed down streams would get triggered.

The configuration for this would be something like "CI/CD > Schedules". For each rule added to a new section "Upstream triggers", we would configure:

  • the upstream repository;
  • which downstream branch to build. We should be able to pick a generic option "matching branch if it exists" that would only build the downstream project if there was a branch with the same name there as the upstream branch that was built. This option would be the default, thus limiting downstream builds only for branches that match;
  • (optional) which branch or regex that matches branches would we trigger on: this allows us to trigger a downstream build only on specific upstream branches. If empty, the downstream build would be triggered for all upstream branches;
  • (optional) a list of environment variables to set on the build.

Links / references

A similar feature exists on Docker Hub, with Repository Links. A repository can add triggers to the build, and one of them is a trigger on a upstream repository.

Edited by Brendan O'Leary