Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Commit

Permalink
When choosing the public branch, make sure it exists on -priv as well
Browse files Browse the repository at this point in the history
  • Loading branch information
locriandev committed Apr 26, 2022
1 parent 52a7aef commit dfdfe46
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions doozerlib/cli/images_streams.py
Expand Up @@ -718,10 +718,15 @@ def check_if_upstream_image_exists(upstream_image):
# For the latter style, always open directly against named branch
if public_branch.startswith('release-') and prs_in_master:
public_branches, _ = exectools.cmd_assert(f'git ls-remote --heads {public_repo_url}', strip=True)
lines = public_branches.splitlines()
if [bl for bl in lines if bl.endswith('/main')]:
public_branches = public_branches.splitlines()
priv_branches, _ = exectools.cmd_assert(f'git ls-remote --heads {source_repo_url}', strip=True)
priv_branches = priv_branches.splitlines()

if [bl for bl in public_branches if bl.endswith('/main')] and \
[bl for bl in priv_branches if bl.endswith('/main')]:
public_branch = 'main'
elif [bl for bl in lines if bl.endswith('/master')]:
elif [bl for bl in public_branches if bl.endswith('/master')] and \
[bl for bl in priv_branches if bl.endswith('/master')]:
public_branch = 'master'
else:
# There are ways of determining default branch without using naming conventions, but as of today, we don't need it.
Expand Down

0 comments on commit dfdfe46

Please sign in to comment.