aboutsummaryrefslogtreecommitdiffhomepage
path: root/infra/cifuzz/continuous_integration.py
diff options
context:
space:
mode:
authorGravatar Oliver Chang <oliverchang@users.noreply.github.com>2021-10-30 00:23:33 +1100
committerGravatar GitHub <noreply@github.com>2021-10-29 09:23:33 -0400
commit3c564bca6ca3d3d07e3d79e18cab009dfd36eb11 (patch)
treec7f168f46d8f56345bd42583784be6935d6a40f7 /infra/cifuzz/continuous_integration.py
parent11310a70d51c71fa60bb73f382ae043a6ff726dc (diff)
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.
Diffstat (limited to 'infra/cifuzz/continuous_integration.py')
-rw-r--r--infra/cifuzz/continuous_integration.py8
1 files changed, 5 insertions, 3 deletions
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 <commit>... is equivalent to
+ # git diff $(git merge-base <commit> 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.')