diff options
author | Josh Smith <joshsmith@codethink.co.uk> | 2018-07-25 12:48:10 +0100 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-07-27 14:30:32 +0900 |
commit | e7caa860034b025dc85d11035e9328758c82830b (patch) | |
tree | 313969f34f32ffdfbe17c69f2081c4ca7d412161 | |
parent | 2668424b70b87c5f5e7039c82e56c262dd8b805f (diff) | |
download | buildstream-e7caa860034b025dc85d11035e9328758c82830b.tar.gz |
git.py: Update git plugin to fail temporarily on clone failures
The git plugin will now make use of the fail_temporarily parameter
to Plugin.call(), allowing failures to trigger a retry.
-rw-r--r-- | buildstream/plugin.py | 2 | ||||
-rw-r--r-- | buildstream/plugins/sources/git.py | 10 |
2 files changed, 8 insertions, 4 deletions
diff --git a/buildstream/plugin.py b/buildstream/plugin.py index 3eec9b23f..155a9500e 100644 --- a/buildstream/plugin.py +++ b/buildstream/plugin.py @@ -559,7 +559,7 @@ class Plugin(): raise SourceError( fmt.format(plugin=self, track=tracking)) from e """ - return self.__call(*popenargs, collect_stdout=True, fail=fail, fail_temporarily=fail_temporarily **kwargs) + return self.__call(*popenargs, collect_stdout=True, fail=fail, fail_temporarily=fail_temporarily, **kwargs) ############################################################# # Private Methods used in BuildStream # diff --git a/buildstream/plugins/sources/git.py b/buildstream/plugins/sources/git.py index d079d8747..aeb1f7390 100644 --- a/buildstream/plugins/sources/git.py +++ b/buildstream/plugins/sources/git.py @@ -113,7 +113,8 @@ class GitMirror(): # with self.source.tempdir() as tmpdir: self.source.call([self.source.host_git, 'clone', '--mirror', '-n', self.url, tmpdir], - fail="Failed to clone git repository {}".format(self.url)) + fail="Failed to clone git repository {}".format(self.url), + fail_temporarily=True) try: shutil.move(tmpdir, self.mirror) @@ -124,6 +125,7 @@ class GitMirror(): def fetch(self): self.source.call([self.source.host_git, 'fetch', 'origin', '--prune'], fail="Failed to fetch from remote git repository: {}".format(self.url), + fail_temporarily=True, cwd=self.mirror) def has_ref(self): @@ -157,7 +159,8 @@ class GitMirror(): # stop the build from overwriting the files in the .git directory # inside the sandbox. self.source.call([self.source.host_git, 'clone', '--no-checkout', '--no-hardlinks', self.mirror, fullpath], - fail="Failed to create git mirror {} in directory: {}".format(self.mirror, fullpath)) + fail="Failed to create git mirror {} in directory: {}".format(self.mirror, fullpath), + fail_temporarily=True) self.source.call([self.source.host_git, 'checkout', '--force', self.ref], fail="Failed to checkout git ref {}".format(self.ref), @@ -167,7 +170,8 @@ class GitMirror(): fullpath = os.path.join(directory, self.path) self.source.call([self.source.host_git, 'clone', '--no-checkout', self.mirror, fullpath], - fail="Failed to clone git mirror {} in directory: {}".format(self.mirror, fullpath)) + fail="Failed to clone git mirror {} in directory: {}".format(self.mirror, fullpath), + fail_temporarily=True) self.source.call([self.source.host_git, 'remote', 'set-url', 'origin', self.url], fail='Failed to add remote origin "{}"'.format(self.url), |