roomservice: Try major-only revision if default doesn't exist
Change-Id: I91c18a1711e0d01b25e33b30bf0be9bbd443904e
This commit is contained in:
committed by
Michael Bestas
parent
a4cbd27142
commit
39392c99e1
@@ -249,6 +249,9 @@ def fetch_dependencies(repo_path):
|
||||
def has_branch(branches, revision):
|
||||
return revision in [branch['name'] for branch in branches]
|
||||
|
||||
def get_default_revision_no_minor():
|
||||
return get_default_revision().rsplit('.', 1)[0]
|
||||
|
||||
def get_default_or_fallback_revision(repo_name):
|
||||
default_revision = get_default_revision()
|
||||
print("Default revision: %s" % default_revision)
|
||||
@@ -260,12 +263,14 @@ def get_default_or_fallback_revision(repo_name):
|
||||
if has_branch(result, default_revision):
|
||||
return default_revision
|
||||
|
||||
fallbacks = [ get_default_revision_no_minor() ]
|
||||
if os.getenv('ROOMSERVICE_BRANCHES'):
|
||||
fallbacks = list(filter(bool, os.getenv('ROOMSERVICE_BRANCHES').split(' ')))
|
||||
for fallback in fallbacks:
|
||||
if has_branch(result, fallback):
|
||||
print("Using fallback branch: %s" % fallback)
|
||||
return fallback
|
||||
fallbacks += list(filter(bool, os.getenv('ROOMSERVICE_BRANCHES').split(' ')))
|
||||
|
||||
for fallback in fallbacks:
|
||||
if has_branch(result, fallback):
|
||||
print("Using fallback branch: %s" % fallback)
|
||||
return fallback
|
||||
|
||||
print("Default revision %s not found in %s. Bailing." % (default_revision, repo_name))
|
||||
print("Branches found:")
|
||||
|
Reference in New Issue
Block a user