Return 1 if any remote-build failed
Metadata
Current evaluation
Closed unmerged as superseded; the proposed flag was dropped in favor of commit 13aedd1d2, which makes remote-build return an error when a build fails.
Resolution: closed superseded
Reason: A maintainer closed the PR after an alternative implementation landed. Commit 13aedd1d2 added failure exit handling without the proposed --exit-fail-on-any-failure option.
Evaluated by: mr-cal-bot
No scores available.
Issue body
- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [x] Have you successfully run `make lint`?
# Description
When using `snapcraft remote-build` in CI, it would be useful to get a failure when any of the remote build fails. This is not the behaviour that we currently have (namely, even if some build fails, the return code is `0` and the workflow is marked as ok. See: [core16-failure](https://github.com/canonical/checkbox/actions/runs/6199930599/job/16833507894)). Currently we are resorting to counting artifacts, but this process is fragile and error prone (For instance, we have discovered that the snap counting mechanism was introduced [here](https://github.com/canonical/checkbox/actions/runs/6199930599/workflow#L55) but not [here](https://github.com/canonical/checkbox/actions/runs/6491088080/workflow), leading to some failures not being detected)
This PR introduces a new flag to `remote-build`: `--exit-fail-on-any-failure`. When the flag is given, the remote build command will return 1 if any build fails, if the flag is not given it will just produce a debug message signaling the failure.
# Bug
Fixes: https://github.com/snapcore/snapcraft/issues/4142
# Testing
I can't run the following due to this exception:
- [ ] Have you successfully run `pytest tests/unit`?
```
(venv) snapcraft (return_1_remote_builds_failed) > pytest tests/unit
ImportError while loading conftest '/home/h25/prj/canonical/snapcraft/tests/conftest.py'.
tests/conftest.py:21: in <module>
import xdg.BaseDirectory
E ModuleNotFoundError: No module named 'xdg.BaseDirectory'
```
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed superseded | Closed unmerged as superseded; the proposed flag was dropped in favor of commit 13aedd1d2, which makes remote-build return an error when a build fails. | |
| stealth/space-bunny-alpha | — | closed superseded | PR #4400 was closed unmerged as superseded by an alternative implementation merged into main; its proposed --exit-fail-on-any-failure flag was not adopted. | |
| qwen/qwen3.6-35b-a3b | — | — | Superseded by an alternative implementation merged into the main branch. The proposed --exit-fail-on-any-failure flag for snapcraft remote-build was not merged, as maintainers implemented a different solution to handle build failures. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Adding a --exit-fail-on-any-failure flag to snapcraft remote-build was closed and superseded by an alternative implementation. Maintainers merged a different solution to properly handle remote build failure exit codes. |
Update history
No update history recorded yet.
Related work
-
Likely Fixed By:
snapcraft#4142
(confidence 100%)
This PR explicitly targeted the same remote-build zero-exit-code problem.
-
Likely Fixed By:
snapcraft#4826
(confidence 35%)
A later merged change made remote-build fail when no artifacts were created, addressing a related but narrower failure case.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #4480 fix(remote): return error when remote build failed | snapcraft | merged | Merged PR #4480 as commit 13aedd1d2, making remote builds return an error when a build fails and fixing #4142. |