ci/common: use gitlab CI target branch in get_upstream_branch (MR 5082)
This prefers gitlab CI's target branch from the env, and falls back to the old target branch detection mechanism (using pmaports.cfg, etc) if it's not set. This fixes CI in gitlab where the target branch is something different than expected, e.g. if using stacked branches. [ci:skip-build]: already built successfully in CI
This commit is contained in:
parent
5db3273820
commit
c63e05246f
1 changed files with 5 additions and 0 deletions
|
@ -59,6 +59,11 @@ def get_upstream_branch():
|
|||
channels.cfg from master to retrieve the upstream branch.
|
||||
|
||||
:returns: branch name, e.g. "v20.05" """
|
||||
|
||||
# Prefer gitlab CI target branch name if it's set (i.e. running in gitlab CI)
|
||||
if target_branch := os.environ.get("CI_MERGE_REQUEST_TARGET_BRANCH_NAME"):
|
||||
return target_branch
|
||||
|
||||
global cache
|
||||
if "upstream_branch" in cache:
|
||||
return cache["upstream_branch"]
|
||||
|
|
Loading…
Reference in a new issue