`snapcraft remote-build` succeeds even if the build fails
Metadata
Current evaluation
Fixed in Snapcraft 8 by PR #4826 (commit 552897340), which makes remote-build fail when Launchpad produces no artifacts.
Resolution: closed resolved
Reason: The maintainer linked the earlier fix issue #4783, implemented by merged PR #4826 and commit 552897340. It addresses the false-success exit code affecting Snapcraft 7.5.6.
Evaluated by: mr-cal-bot
No scores available.
Issue body
### Bug Description
`snapcraft remote-build` will return an exit code of 0 even if the remote build fails. This makes it hard to use in automated scripts, as the return value cannot be used to determine if the build succeeded. It should return a non-zero exit value if the operation fails, in line with Unix conventions.
### To Reproduce
`snapcraft remote-build --launchpad-accept-public-upload --build-on="amd64,arm64,ppc64el,s390x"`
### Environment
Running on an AWS instance in Jenkins. Ubuntu Focal, amd64. Snapcraft 7.5.6.
### snapcraft.yaml
```yaml
https://github.com/juju/juju/blob/3.5/snap/snapcraft.yaml
```
### Relevant log output
```shell
12:21:20 Build status as of 2024-09-30 17:21:20.064750:
12:21:20 arch=s390x state=Currently building
12:21:20 arch=ppc64el state=Currently building
12:21:50 Build status as of 2024-09-30 17:21:50.664508:
12:21:50 arch=s390x state=Failed to build
12:21:50 arch=ppc64el state=Failed to build
12:21:51 Starting Snapcraft 7.5.6
12:21:51 Logging execution to '/home/jenkins/.local/state/snapcraft/log/snapcraft-20240930-171430.461014.log'
12:21:51 Snap file not available for arch 's390x'.
12:21:52 Build log available at 'juju_s390x.txt'
12:21:52 Build failed for arch 's390x'.
12:21:52 Snap file not available for arch 'ppc64el'.
12:21:53 Build log available at 'juju_ppc64el.txt'
12:21:53 Build failed for arch 'ppc64el'.
12:21:53 Build complete.
12:21:55 + '[' 0 -ne 0 ']' # this line was checking the exit status
```
### Additional context
_No response_
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Fixed in Snapcraft 8 by PR #4826 (commit 552897340), which makes remote-build fail when Launchpad produces no artifacts. | |
| stealth/space-bunny-alpha | — | closed resolved | Remote-build failure handling was addressed in Snapcraft 8 via #4783, fixed by merged PR #4826, which reports an error when no build artifacts are produced. | |
| qwen/qwen3.6-35b-a3b | — | — | Resolved in snapcraft 8 via issue #4783. The remote-build command now correctly returns a non-zero exit code upon failure, enabling proper automation handling. | |
| qwen/qwen3.6-35b-a3b | — | — | Fixed in snapcraft 8 via issue #4783. The remote-build command now returns a non-zero exit code on failure, resolving automation script compatibility issues. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Fixed in snapcraft 8 via issue 4783. The snapcraft remote-build command now correctly returns a non-zero exit code on failure, resolving the automation compatibility bug. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
canonical/snapcraft#4826
(confidence 99%)
Merged fix makes remote-build report an error when no build artifacts are produced.
-
Duplicate Of:
canonical/snapcraft#4783
(confidence 96%)
The maintainer identified #4783 as the earlier issue containing the Snapcraft 8 resolution.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #4783 remote build: fail if launchpad fails to create artifacts | snapcraft | closed | Remote-build silently succeeded when Launchpad produced no artifacts. Fixed by merged PR #4826 (commit 552897340), which makes snapcraft remote-build fail when no artifacts are created. | |
| #4142 snapcraft remote-build exits with return code 0 even when some snaps failed to build for a given arch | snapcraft | closed | Closed without a documented fix; later #4826 (552897340) only made remote-build fail when no artifacts were produced, not when some architecture builds failed. | |
| #4478 bug: remote-build broke in snapcraft 8.0 | snapcraft | closed | Fixed by PR #4482, merged as commit 6300e0ee2: remote-build pushes now use the Git CLI instead of libgit2, avoiding SSL broken-pipe failures. | |
| #4826 fix(remote-build): fail if no artifacts are created | snapcraft | merged | Merged in #4826 (commit 552897340): remote-build now fails when Launchpad creates no artifacts, fixing #4783. | |
| #4397 `snapcraft remote-build --launchpad-timeout` does not work | snapcraft | closed | Fixed Snapcraft 7 remote-build argument parsing in merged PRs #4426 (c6f41daa8) and #4427 (0054b0cfe), covering the main and fallback builders. | |
| #4479 remote-build broken with shallow clones | snapcraft | closed | Fixed in Snapcraft 8.0.1 by PR #4498 (commit 1e285148e), which falls back to the legacy remote builder for shallow Git clones on core20/core22. | |
| #2642 remote-build: detect early build errors | snapcraft | merged | Merged PR #2642 by cjp256: remote-build now detects early Launchpad build errors (e.g. missing snapcraft.yaml) instead of misreporting a busy builder; landed as commit 73fd95e86. | |
| #5384 remote build: snapcraft incorrectly follows symlinks | snapcraft | open | remote-build previously failed while copying dangling symlinks; craft-application 7.1.1 fixed this via PR #1104, and Snapcraft now requires craft-application >=7.4.1. | |
| #3648 cli: reintroduce remote-build and promote to snapcraft help | snapcraft | merged | Merged PR #3648 (commit 8dc1ac016), restoring remote-build and promote in Snapcraft's main CLI help for Launchpad bug #1943244. | |
| #2768 remote-build: autorecovery | snapcraft | merged | PR #2768 by cjp256 added autorecovery for `snapcraft remote-build` (retry/poll recovery of failed Launchpad builds), approved and merged as commit 0077d8265. |