Improve handling of first CI run for new branch. (#29070)
(cherry picked from commit a1453a7917
)
This commit is contained in:
parent
5ce6066e4c
commit
294560e91e
2 changed files with 9 additions and 3 deletions
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue