Build failure when artifact cache is incorrectly set up
Summary
If you specify an artifact cache incorrectly, you eventually get something along these lines
[00:00:08][f0c3789e][build:hello.bst] FAILURE push_directory was called, but no remote artifact servers are configured as push remotes.
Either more useful information or a warning that continues despite not successfully pushing to a directory would be preferable.
Steps to reproduce
Add an artifact cache in project.conf that isn't actually set up, and a remote-execution service (but it doesn't need to be configured correctly).
For example, provided you don't have an artifact server running locally on 50052:
artifacts:
- url: https://localhost:50052
push: true
remote-execution:
url: http://remote-execution-server:50051
Then try and build an artifact.
What is the current bug behavior?
It warns at the beginning that it failed to initialise the remote:
[--:--:--][][] WARNING Failed to initialize remote http://localhost:50052: Connect Failed
Then when trying to push an artifact after building it, the entire build fails.
What is the expected correct behavior?
Highlighting that it failed to initialise the remote in the build failure would be more useful , but it doesn't seem appropriate that an incorrectly configure artifact cache (or one that is currently down) should cause an entire build to fail.
When remote execution isn't specified the build will still continue, and it should also do this when remote execution is specified.
Relevant logs and/or screenshots
Using the following project.conf for the autotools example project, with artifacts and remote-execution specified:
# Unique project name
name: autotools
# Required BuildStream format version
format-version: 18
# Subdirectory where elements are stored
element-path: elements
# Define some aliases for the tarballs we download
aliases:
alpine: https://gnome7.codethink.co.uk/tarballs/
gnu: http://ftpmirror.gnu.org/gnu/automake/
artifacts:
- url: http://localhost:50052
push: true
remote-execution:
url: http://remote-execution-server:50051
When trying to build you get the following failure message on hello.bst:
[00:00:06][f0c3789e][build:hello.bst ] FAILURE Running configure-commands
[--:--:--][f0c3789e][build:hello.bst ] START Caching artifact
[00:00:00][f0c3789e][build:hello.bst ] SUCCESS Caching artifact
[00:00:09][f0c3789e][build:hello.bst ] FAILURE push_directory was called, but no remote artifact servers are configured as push remotes.
Printing the last 20 lines from log file:
/home/raoulhidalgo/.cache/buildstream/logs/autotools/hello/f0c3789e-build.26301.log
======================================================================
[--:--:--] START hello.bst: Integrating sandbox
[00:00:00] SUCCESS hello.bst: Integrating sandbox
[--:--:--] START hello.bst: Staging sources
[00:00:00] SUCCESS hello.bst: Staging sources
[--:--:--] START hello.bst: Running configure-commands
[--:--:--] STATUS hello.bst: Running configure-commands
export NOCONFIGURE=1;
if [ -x ./configure ]; then true;
elif [ -x ./autogen ]; then ./autogen;
elif [ -x ./autogen.sh ]; then ./autogen.sh;
elif [ -x ./bootstrap ]; then ./bootstrap;
elif [ -x ./bootstrap.sh ]; then ./bootstrap.sh;
else autoreconf -ivf .;
fi
[00:00:06] FAILURE hello.bst: Running configure-commands
[--:--:--] START hello.bst: Caching artifact
[00:00:00] SUCCESS hello.bst: Caching artifact
[00:00:09] FAILURE hello.bst: push_directory was called, but no remote artifact servers are configured as push remotes.
======================================================================
Build failure on element: hello.bst
Possible fixes
The exception is raised in buildstream._artifactcache.artifact_cache.py:735.
Maybe make sure it doesn't attempt to use push_directory when no artifact caches get successfully set up, or make push_directory silently pass.