From 294560e91e3aefabf570dd1b0551e4434a7cffb5 Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Wed, 6 Sep 2017 16:40:04 -0700 Subject: [PATCH] Improve handling of first CI run for new branch. (#29070) (cherry picked from commit a1453a79173d48d04487c1f56a0f6dd35f963f15) --- test/runner/lib/changes.py | 7 +++++-- test/runner/lib/executor.py | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/test/runner/lib/changes.py b/test/runner/lib/changes.py index 890dd223a3a..7a798f19457 100644 --- a/test/runner/lib/changes.py +++ b/test/runner/lib/changes.py @@ -74,8 +74,8 @@ class ShippableChanges(object): self.paths = sorted(git.get_diff_names([last_successful_commit, self.commit])) self.diff = git.get_diff([last_successful_commit, self.commit]) else: - # tracked files (including unchanged) - self.paths = sorted(git.get_file_names(['--cached'])) + # first run for branch + self.paths = None # act as though change detection not enabled, do not filter targets self.diff = [] def get_merge_runs(self, project_id, branch): @@ -117,6 +117,9 @@ class ShippableChanges(object): if git.is_valid_ref(commit_sha): last_successful_commit = commit_sha + if last_successful_commit is None: + display.warning('No successful commit found. All tests will be executed.') + return last_successful_commit diff --git a/test/runner/lib/executor.py b/test/runner/lib/executor.py index d378e0a1c83..8c77edba602 100644 --- a/test/runner/lib/executor.py +++ b/test/runner/lib/executor.py @@ -1120,6 +1120,9 @@ def detect_changes(args): else: return None # change detection not enabled + if paths is None: + return None # act as though change detection not enabled, do not filter targets + display.info('Detected changes in %d file(s).' % len(paths)) for path in paths: @@ -1131,7 +1134,7 @@ def detect_changes(args): def detect_changes_shippable(args): """Initialize change detection on Shippable. :type args: TestConfig - :rtype: list[str] + :rtype: list[str] | None """ git = Git(args) result = ShippableChanges(args, git)