summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Pollard <tom.pollard@codethink.co.uk>2019-09-26 15:04:07 +0100
committerTom Pollard <tom.pollard@codethink.co.uk>2019-12-02 11:38:34 +0000
commited25a344a421532f7ca27c045381e88309ebe532 (patch)
treeb2d426250b0f7b5c7c7a986c68a2ad774c808ccf
parent05aaf3eadff2981fe3c16e6c3a808c37f0ca1187 (diff)
downloadbuildstream-tpollard/failedsource.tar.gz
element.py: Explicitly ensure failed build sources are not pushedtpollard/failedsource
-rw-r--r--src/buildstream/element.py3
-rw-r--r--tests/sourcecache/push.py2
2 files changed, 3 insertions, 2 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index ffce257bf..134ca3024 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -1846,7 +1846,8 @@ class Element(Plugin):
return True
def _skip_source_push(self):
- if not self.__sources or self._get_workspace():
+ # Skip push if we have no sources, are workspaced or the given element failed to build
+ if any([not self.__sources, self._get_workspace(), not self._get_build_result()[0]]):
return True
return not (self.__sourcecache.has_push_remotes(plugin=self) and self._source_cached())
diff --git a/tests/sourcecache/push.py b/tests/sourcecache/push.py
index 719860425..551593e18 100644
--- a/tests/sourcecache/push.py
+++ b/tests/sourcecache/push.py
@@ -254,5 +254,5 @@ def test_source_push_build_fail(cli, tmpdir, datafiles):
res.assert_task_error(ErrorDomain.ELEMENT, None)
# Sources are not pushed as the build queue is before the source push
- # queue.
+ # queue. We explicitly don't want to push failed build source by default.
assert "Pushed source " not in res.stderr