diff options
author | Chandan Singh <csingh43@bloomberg.net> | 2017-09-11 20:03:14 +0100 |
---|---|---|
committer | Chandan Singh <csingh43@bloomberg.net> | 2017-09-12 14:53:14 +0100 |
commit | f9e6fadee05c14b83fe75cf107f271dc09f60044 (patch) | |
tree | 5de71236857325818002689247e16befd296cee6 | |
parent | 7bc2e070182fc45b9e6d630e95d5e90d97fc910e (diff) | |
download | buildstream-f9e6fadee05c14b83fe75cf107f271dc09f60044.tar.gz |
Construct pipeline without push queue if cannot push to artifact cache
Currently, if BuildStream is unable to push to the artifact cache for
whatever reason, the build will just error out. Fix it so that if we are
unable to push to the shared cache, we give a warning to the user and
continue building.
Fixes https://gitlab.com/BuildStream/buildstream/issues/90
-rw-r--r-- | buildstream/_pipeline.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/buildstream/_pipeline.py b/buildstream/_pipeline.py index 5f68bd1db..68ea70daf 100644 --- a/buildstream/_pipeline.py +++ b/buildstream/_pipeline.py @@ -286,20 +286,23 @@ class Pipeline(): return element - # Internal: If a remote artifact cache is configured for pushing, check that it - # actually works. - def assert_remote_artifact_cache(self): + # Internal: If a remote artifact cache is configured for pushing, check + # that it actually works. Returns True if it works, False otherwise. + def can_push_remote_artifact_cache(self): if self.artifacts.can_push(): starttime = datetime.datetime.now() self.message(self.target, MessageType.START, "Checking connectivity to remote artifact cache") try: self.artifacts.preflight() except _ArtifactError as e: - self.message(self.target, MessageType.FAIL, str(e), + self.message(self.target, MessageType.WARN, str(e), elapsed=datetime.datetime.now() - starttime) - raise PipelineError() + return False self.message(self.target, MessageType.SUCCESS, "Connectivity OK", elapsed=datetime.datetime.now() - starttime) + return True + else: + return False ############################################################# # Commands # @@ -410,8 +413,6 @@ class Pipeline(): detail="\n".join([el + "-" + str(src) for el, src, _ in self.unused_workspaces])) - self.assert_remote_artifact_cache() - if build_all or track_first: plan = list(self.dependencies(Scope.ALL)) else: @@ -436,7 +437,7 @@ class Pipeline(): queues.append(pull) queues.append(fetch) queues.append(build) - if self.artifacts.can_push(): + if self.can_push_remote_artifact_cache(): push = PushQueue() queues.append(push) queues[0].enqueue(plan) |