From 3c564bca6ca3d3d07e3d79e18cab009dfd36eb11 Mon Sep 17 00:00:00 2001 From: Oliver Chang Date: Sat, 30 Oct 2021 00:23:33 +1100 Subject: Fix download_latest_build for pull requests. (#6688) Getting the LATEST_BUILD_WINDOW latest commits from HEAD^ is wrong. We should use the diff base instead. Also modify the Ci.get_diff_base methods to not include "..." in the return value. This will be appended in get_changed_code_under_test instead. This also potentially fixes a behaviour mismatch with GitHub PRs and diffing against the latest base branch rather than git merge-base base-branch HEAD. --- infra/cifuzz/continuous_integration.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'infra/cifuzz/continuous_integration.py') diff --git a/infra/cifuzz/continuous_integration.py b/infra/cifuzz/continuous_integration.py index 1c17fd9a..8836023f 100644 --- a/infra/cifuzz/continuous_integration.py +++ b/infra/cifuzz/continuous_integration.py @@ -76,7 +76,9 @@ class BaseCi: base = self.get_diff_base() fix_git_repo_for_diff(repo_manager_obj) logging.info('Diffing against %s.', base) - return repo_manager_obj.get_git_diff(base) + # git diff ... is equivalent to + # git diff $(git merge-base HEAD) + return repo_manager_obj.get_git_diff(base + '...') def get_build_command(self, host_repo_path, image_repo_path): """Returns the command for building the project that is run inside the @@ -265,7 +267,7 @@ class InternalGeneric(BaseCi): repo_manager=manager) def get_diff_base(self): - return 'origin...' + return 'origin' def get_build_command(self, host_repo_path, image_repo_path): # pylint: disable=no-self-use """Returns the command for building the project that is run inside the @@ -299,7 +301,7 @@ class ExternalGeneric(BaseCi): return self._repo_dir def get_diff_base(self): - return 'origin...' + return 'origin' def prepare_for_fuzzer_build(self): logging.info('ExternalGeneric: preparing for fuzzer build.') -- cgit v1.2.3