Build failure when artifact cache is incorrectly set up
- Dominant language
- Python
- Stars
- 140
- Forks
- 45
- Avg merge
- 1d 3h
- Merged PRs (30d)
- 6
Description
[See original issue on GitLab](https://gitlab.com/BuildStream/buildstream/-/issues/766)
In GitLab by [[Gitlab user @raoul]](https://gitlab.com/raoul).hidalgocharman on Nov 14, 2018, 15:46
## Summary
[//]: # (Summarize the bug encountered concisely)
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
[//]: # (How one can reproduce the issue - this is very important)
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?
[//]: # (What actually happens)
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?
[//]: # (What you should see instead)
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
[//]: # (Paste any relevant logs - please use code blocks ``` to format console output, logs, and code as it's hard to read otherwise. You can also add a Snippet and link it here. Check the markdown giude on Gitlab for further tips)
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
[//]: # (If you can, link to the line of code that might be responsible for the problem)
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.
----
Contributor guide
Research direction
Start at buildstream._artifactcache.artifact_cache.py:735 and reproduce the failure with an incorrectly configured artifact cache and remote-execution settings in project.conf. Trace the earlier remote-initialization warning and the later push_directory call. Done means an unavailable or misconfigured artifact cache does not fail the entire build and the failure is reported usefully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100