You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 07:21:36 UTC

[buildstream] 05/10: Explicitly ensure failed build sources are not pushed

This is an automated email from the ASF dual-hosted git repository.

tvb pushed a commit to branch tpollard/streamasync
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 1142484eca2df3ec966e5f6147554cb2a5346b1e
Author: Tom Pollard <to...@codethink.co.uk>
AuthorDate: Thu Sep 26 15:04:07 2019 +0100

    Explicitly ensure failed build sources are not pushed
---
 src/buildstream/element.py | 3 ++-
 tests/sourcecache/push.py  | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index 4ebb17d..58eb7a9 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -1880,7 +1880,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 not self.__sources or self._get_workspace() or 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 1be2d40..5038e23 100644
--- a/tests/sourcecache/push.py
+++ b/tests/sourcecache/push.py
@@ -295,5 +295,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