1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Fix change detection on retried Shippable jobs.

This commit is contained in:
Matt Clay 2018-08-27 19:02:35 -07:00
parent 6b40906bdb
commit c0aaf0fff7
2 changed files with 4 additions and 3 deletions

View file

@ -57,6 +57,7 @@ class ShippableChanges(object):
self.is_tag = os.environ['IS_GIT_TAG'] == 'true' self.is_tag = os.environ['IS_GIT_TAG'] == 'true'
self.commit = os.environ['COMMIT'] self.commit = os.environ['COMMIT']
self.project_id = os.environ['PROJECT_ID'] self.project_id = os.environ['PROJECT_ID']
self.commit_range = os.environ['SHIPPABLE_COMMIT_RANGE']
except KeyError as ex: except KeyError as ex:
raise MissingEnvironmentVariable(name=ex.args[0]) raise MissingEnvironmentVariable(name=ex.args[0])
@ -64,8 +65,8 @@ class ShippableChanges(object):
raise ChangeDetectionNotSupported('Change detection is not supported for tags.') raise ChangeDetectionNotSupported('Change detection is not supported for tags.')
if self.is_pr: if self.is_pr:
self.paths = sorted(git.get_diff_names(['origin/%s' % self.branch, '--'])) self.paths = sorted(git.get_diff_names([self.commit_range]))
self.diff = git.get_diff(['origin/%s' % self.branch, '--']) self.diff = git.get_diff([self.commit_range])
else: else:
merge_runs = self.get_merge_runs(self.project_id, self.branch) merge_runs = self.get_merge_runs(self.project_id, self.branch)
last_successful_commit = self.get_last_successful_commit(git, merge_runs) last_successful_commit = self.get_last_successful_commit(git, merge_runs)

View file

@ -21,7 +21,7 @@ class Git(object):
def get_diff(self, args, git_options=None): def get_diff(self, args, git_options=None):
""" """
:type args: list[str] :type args: list[str]
:type options: list[str] :type git_options: list[str] | None
:rtype: list[str] :rtype: list[str]
""" """
cmd = ['diff'] + args cmd = ['diff'] + args