Fix base branch in as-if-foss pipeline targeting stable branches
Concise description
Fix base branch in as-if-foss pipeline targeting stable branches.
Example scenario
Create a merge request targeting 10-8-stable-ee.
Expectation
The as-if-foss pipeline is based on 10-8-stable.
Current result
The as-if-foss pipeline is based on master.
Solutions
Extend scripts/setup/find-jh-branch.rb or add a similar script that it can look at the target branch 10-8-stable-ee and determine that the corresponding FOSS branch should be 10-8-stable.
Use it in .gitlab/ci/as-if-foss.gitlab-ci.yml to checkout the correct base branch.
Detailed description
It's reported on Slack (internal) that the as-if-foss pipeline is using the default branch master as the base to test against the stable branches:
master is hard coded there. However, it should use the target stable branch when the merge request is targeting a stable branch, rather than the default branch.
For example, if the merge request is targeting 10-8-stable-ee, then the FOSS base branch should be 10-8-stable, rather than master. Note that this is not the same branch as EE, because it does not contain the -ee suffix.
We need to use a script for this, and we can reuse:
This is used for a similar purpose, to find the corresponding JH branch. We should either generalize this so it can also be applied to FOSS, or create a new script which we can use for FOSS and use it to detect the correct base FOSS branch.