canonical / snapcraft

Package, distribute, and update any app for Linux and IoT.
https://snapcraft.io
GNU General Public License v3.0
1.18k stars 446 forks source link

remote build: fails with some architecture definitions #4780

Closed mr-cal closed 5 months ago

mr-cal commented 6 months ago

Bug Description

Snapcraft does not handle some definitions of architectures for remote builds and fails immediately with no error or explanation.

It's possible that other variations of architectures: will fail too, so we should add a set of regression tests.

To Reproduce

snapcraft remote-build

Environment

n/a

snapcraft.yaml

name: test-snap
version: '0.1'
summary: test
description: test

grade: devel
confinement: devmode

base: core22

architectures:
  - build-on: arm64

parts:
  my-part:
    plugin: nil

Relevant log output

All data sent to remote builders will be publicly available. Are you sure you want to continue? [y/N]: y
remote-build is experimental and is subject to change. Use with caution.
Build completed.
Log files:
Artifacts:

Additional context

From @jnsgruk on the snapcrafters channel (source)

syncronize-issues-to-jira[bot] commented 6 months ago

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-2868.

This message was autogenerated

AlanGriffiths commented 6 months ago

I've also seen failures without architectures(or platforms) in the .yaml. With, for example,

snapcraft remote-build --launchpad-accept-public-upload --build-for armhf

(Which works for Miriway, but not for several of canonical's Mir based projects. Not spotted what the significant difference between these is.)

popey commented 6 months ago

Also:

This works: snapcraft remote-build --build-for riscv64

This does not: snapcraft remote-build --build-for amd64,riscv64,arm64

2024-05-02 23:33:24.773 Starting snapcraft, version 8.2.3
2024-05-02 23:33:24.773 Log verbosity level set to BRIEF
2024-05-02 23:33:24.774 Configuring application...
2024-05-02 23:33:24.774 Preparing application...
2024-05-02 23:33:24.774 Build plan: platform=None, build_for=amd64,riscv64,arm64
2024-05-02 23:33:24.774 Loading project file '/home/alan/Temp/Test/snap/snapcraft.yaml'
2024-05-02 23:33:24.779 Architecture 'amd64,riscv64,arm64' is not supported.
2024-05-02 23:33:24.779 Traceback (most recent call last):
2024-05-02 23:33:24.779   File "/snap/snapcraft/11591/lib/python3.10/site-packages/craft_application/application.py", line 508, in run
2024-05-02 23:33:24.779     self.services.project = self.get_project(
2024-05-02 23:33:24.779   File "/snap/snapcraft/11591/lib/python3.10/site-packages/craft_application/application.py", line 303, in get_project
2024-05-02 23:33:24.779     yaml_data = self._transform_project_yaml(yaml_data, build_on, build_for)
2024-05-02 23:33:24.779   File "/snap/snapcraft/11591/lib/python3.10/site-packages/craft_application/application.py", line 601, in _transform_project_yaml
2024-05-02 23:33:24.779     self._expand_environment(yaml_data=yaml_data, build_for=build_for)
2024-05-02 23:33:24.779   File "/snap/snapcraft/11591/lib/python3.10/site-packages/craft_application/application.py", line 629, in _expand_environment
2024-05-02 23:33:24.779     info = craft_parts.ProjectInfo(
2024-05-02 23:33:24.779   File "/snap/snapcraft/11591/lib/python3.10/site-packages/craft_parts/infos.py", line 99, in __init__
2024-05-02 23:33:24.779     self._set_machine(arch)
2024-05-02 23:33:24.779   File "/snap/snapcraft/11591/lib/python3.10/site-packages/craft_parts/infos.py", line 333, in _set_machine
2024-05-02 23:33:24.779     raise errors.InvalidArchitecture(arch)
2024-05-02 23:33:24.779 craft_parts.errors.InvalidArchitecture: Architecture 'amd64,riscv64,arm64' is not supported.
2024-05-02 23:33:24.779 Make sure the architecture name is correct.
2024-05-02 23:33:24.779 Recommended resolution: Make sure the architecture name is correct.
2024-05-02 23:33:24.779 Full execution log: '/home/alan/.local/state/snapcraft/log/snapcraft-20240502-233324.772745.log'
AlanGriffiths commented 6 months ago

snapcraft 2.8.4 appears to have fixed some cases. https://github.com/canonical/mir/pull/3369 builds mir-libs for a matrix of core{22,24}, {amd64,armhf,arm64). The only one failing now is core24,armhf

https://github.com/canonical/mir/actions/runs/8939586899/job/24620012565?pr=3369

Running locally, doesn't retrieve any build results to investigate further

$ cp snap/local/core24~snapcraft.yaml snap/snapcraft.yaml 
$ sed -i 's@version: testing@version: '$(git describe)'@' snap/snapcraft.yaml
$ snapcraft remote-build --launchpad-accept-public-upload --build-for armhf
$ snapcraft remote-build --launchpad-accept-public-upload --build-for armhf
remote-build is experimental and is subject to change. Use with caution.           
Build completed.rtifacts...                                                        
Log files: 
Artifacts:                                            
$
mr-cal commented 5 months ago

Fixes via #4793 and https://github.com/canonical/craft-application/pull/343