summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-04-15 17:47:12 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2019-04-15 17:47:12 +0900
commitde54ba7242e44b78330e80702ab943f0081434f9 (patch)
tree07ad5193236dc0ef00a8d80836213c9c2116e9f3
parent4aafa38e0d3c73b2fb2663984ce170e7d7ed8e95 (diff)
downloadbuildstream-de54ba7242e44b78330e80702ab943f0081434f9.tar.gz
_stream.py: Mark all elements as pulled in Stream.push()
Marking all elements as pulled in Stream.push() ensures that cache keys are resolved before pushing elements, otherwise state is left unresolved in non-strict mode while elements are awaiting to download an artifact by it's strict cache key. Fixes #990
-rw-r--r--buildstream/_stream.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/buildstream/_stream.py b/buildstream/_stream.py
index 310bfbde0..19c73b85e 100644
--- a/buildstream/_stream.py
+++ b/buildstream/_stream.py
@@ -344,6 +344,20 @@ class Stream():
if not self._artifacts.has_push_remotes():
raise StreamError("No artifact caches available for pushing artifacts")
+ # Mark all dependencies of all selected elements as "pulled" before
+ # trying to push.
+ #
+ # In non-strict mode, elements which are cached by their weak keys
+ # will attempt to pull a remote artifact by it's strict key and prefer
+ # a strict key artifact, however pull does not occur when running
+ # a `bst push` session.
+ #
+ # Marking the elements as pulled is a workaround which ensures that
+ # the cache keys are resolved before pushing.
+ #
+ for element in elements:
+ element._pull_done()
+
self._pipeline.assert_consistent(elements)
self._add_queue(PushQueue(self._scheduler))
self._enqueue_plan(elements)