Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions infra/cifuzz/continuous_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,12 @@ def _clone_repo_and_checkout(self, repo_url, repo_name):
repo_name=repo_name,
username=self.config.actor,
password=self.config.token)
self._checkout_specified_commit(manager)
if not self._checkout_specified_commit(manager):
return None
return manager

def _checkout_specified_commit(self, manager):
checkout_specified_commit(manager, self.config.pr_ref, self.config.git_sha)
return checkout_specified_commit(manager, self.config.pr_ref, self.config.git_sha)

def _detect_main_repo(self):
"""Helper for child classes that detects the main repo and returns a tuple
Expand Down Expand Up @@ -198,10 +199,12 @@ def checkout_specified_commit(repo_manager_obj, pr_ref, git_sha):
repo_manager_obj.checkout_pr(pr_ref)
else:
repo_manager_obj.checkout_commit(git_sha)
return True
except (RuntimeError, ValueError):
logging.error(
'Can not check out requested state %s. '
'Using current repo state.', pr_ref or git_sha)
return False


class GithubCiMixin:
Expand Down Expand Up @@ -264,7 +267,8 @@ def prepare_for_fuzzer_build(self):

# Use the same name used in the docker image so we can overwrite it.
manager = self._copy_repo_from_image(image_repo_path)
self._checkout_specified_commit(manager)
if not self._checkout_specified_commit(manager):
return get_build_preparation_failure()
return BuildPreparationResult(success=True,
image_repo_path=image_repo_path,
repo_manager=manager)
Expand Down Expand Up @@ -370,6 +374,8 @@ def prepare_for_fuzzer_build(self):
# TODO(metzman): Figure out if we want second copy at all.
manager = self._clone_repo_and_checkout(self.config.git_url,
self.config.project_repo_name)
if not manager:
return get_build_preparation_failure()
return self._build_external_project_docker_image(manager)

def get_build_command(self, host_repo_path, image_repo_path): # pylint: disable=no-self-use
Expand Down