Skip to content

Fork and/or merge request info in CI jobs

Description

We use CI jobs to create some additional diffs between the base and the feature branch. In this particular case we use a tool called octocatalog-diff, which creates a diff between two Puppet catalogs.

Right now we expect the base branch in the same repository with a fixed name. This works fine if you have one central repository and push all feature branches into this one. It does not really work if the repository the feature branch is pushed into is a fork, because the base branch needs to be updated by hand in advance.

Proposal

Fork

Add a new variable CI_FORK_REPOSITORY_URL with the URL for the base repository, similar to the way CI_REPOSITORY_URL works.

Merge request

GitLab already knows if a job belongs to a merge request. If the merge request already exists, it should be possible to provide variables with the base repository and base branch of the merge request to the job.

I'm not yet sure if there would be a way to trigger a particular job only after a merge request was created.

Links / references

https://github.com/github/octocatalog-diff https://salsa.debian.org/zobel/dsa-puppet/-/jobs/7102