summaryrefslogtreecommitdiff
path: root/src/buildstream/element.py
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2020-09-29 17:33:54 +0200
committerJürg Billeter <j@bitron.ch>2020-09-29 17:52:24 +0200
commitc83217694faf365f3a94be03bb684a5a3e1c2d5a (patch)
tree39b8d0465e9a1f0e16982317b0e50e347af9e1d1 /src/buildstream/element.py
parentd1885eafaf002f6f8c30cefa89d9c75fd352e444 (diff)
downloadbuildstream-c83217694faf365f3a94be03bb684a5a3e1c2d5a.tar.gz
element.py: Add skip_uncached parameter to _skip_push()
This allows proper error handling when pushing an uncached element should result in a failure (bst artifact push), not a skipped job (bst build).
Diffstat (limited to 'src/buildstream/element.py')
-rw-r--r--src/buildstream/element.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/buildstream/element.py b/src/buildstream/element.py
index ff7dcbbbb..57aa37a85 100644
--- a/src/buildstream/element.py
+++ b/src/buildstream/element.py
@@ -1971,22 +1971,24 @@ class Element(Plugin):
#
# Determine whether we should create a push job for this element.
#
+ # Args:
+ # skip_uncached (bool): Whether to skip elements that aren't cached
+ #
# Returns:
# (bool): True if this element does not need a push job to be created
#
- def _skip_push(self):
+ def _skip_push(self, *, skip_uncached):
if not self.__artifacts.has_push_remotes(plugin=self):
# No push remotes for this element's project
return True
# Do not push elements that aren't cached, or that are cached with a dangling buildtree
# ref unless element type is expected to have an an empty buildtree directory
- if not self._cached_buildtree() and self._buildtree_exists():
- return True
-
- # Do not push tainted artifact
- if self.__get_tainted():
- return True
+ if skip_uncached:
+ if not self._cached():
+ return True
+ if not self._cached_buildtree() and self._buildtree_exists():
+ return True
return False