build_manifest: Never use users 'master' branch for repos we are not explicitely building

People very often do not update them leading to random and weird failures
This commit is contained in:
Thibault Saunier 2018-11-14 10:16:39 -03:00
parent d8ebbea1f0
commit 10ae6d0326

View File

@ -190,6 +190,7 @@ def find_repository_sha(module: Tuple[str, int], branchname: str) -> Tuple[str,
if module[0] == os.environ['CI_PROJECT_NAME']: if module[0] == os.environ['CI_PROJECT_NAME']:
return 'user', os.environ['CI_COMMIT_SHA'] return 'user', os.environ['CI_COMMIT_SHA']
if branchname != "master":
project = search_user_namespace(namespace, module[0]) project = search_user_namespace(namespace, module[0])
# Find a fork in the User's namespace # Find a fork in the User's namespace
if project: if project:
@ -199,11 +200,11 @@ def find_repository_sha(module: Tuple[str, int], branchname: str) -> Tuple[str,
branch = get_project_branch(id, branchname) branch = get_project_branch(id, branchname)
if branch is not None: if branch is not None:
path = project['namespace']['path'] path = project['namespace']['path']
print("Found mathcing branch in user's namespace") print("Found matching branch in user's namespace")
print(f"{path}/{branchname}") print(f"{path}/{branchname}")
return 'user', branch['commit']['id'] return 'user', branch['commit']['id']
print(f"Did not found user branch named {branchname}") print(f"Did not find user branch named {branchname}")
# Check upstream project for a branch # Check upstream project for a branch
branch = get_project_branch(module[1], branchname) branch = get_project_branch(module[1], branchname)