Skip to content

Fix Build/Deploy stages running on forked master branches

This fixes an issue with the CI where build/deploy stages would run on forks.

An overview of why:

For maintainers and frequent contributors, we'd add them to the GitLab project as a contributor with R/W permissions so that they can make new branches on the project itself e.g. yutotakano/fix-wrong-ci (case 1). The benefit of this is that they can also review other MRs and merge in MRs once they have approval, and others can take over stagnant feature branches.

For one-off contributors who just want to send in a single MR, it's easier and quicker if they fork the project into their namespace. Ideally here they'd still make a new branch in their fork (case 2), but we should also expect that users may send a MR from their fork's master branch into our master branch (case 3).

The last described case was currently not anticipated by the CI. It tries to run the build/deploy stages on any fork if the branch is named 'master', but obviously this causes the MR pipeline to fail for case 3 (since the fork doesn't have access to the container registry or deployment keys). The MR fixes this by disabling the build/deploy stage for all three cases of contribution.

Edited by Yuto Takano

Merge request reports