lxd: specify arch in lxc image list command
Metadata
Current evaluation
Merged PR #2046 fixed incorrect LXD image metadata by specifying the architecture in lxc image list; merged as commit 828ea5120.
Resolution: closed resolved
Reason: PR #2046 was merged as commit 828ea5120. It passes the architecture explicitly to lxc image list, ensuring SNAPCRAFT_IMAGE_INFO selects the correct image and fixing LP #1760857.
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] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)?
- [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)?
- [x] Have you successfully run `./runtests.sh static`?
- [x] Have you successfully run `./runtests.sh unit`?
-----
This PR fixes getting the correct values for the LXD image for `SNAPCRAFT_IMAGE_INFO` (which is added to the manifest if `SNAPCRAFT_BUILD_INFO` is set). This regressed when the image used to create containers stopped containing the architecture as `ubuntu:xenial` rather than `ubuntu:xenial/$ARCH`, which is still passed to `lxc image list`. So in the end we got all matching images in an unordered list. The fix is to specify the architecture explicitly.
Fixes: [LP: #1760857](https://bugs.launchpad.net/snapcraft/+bug/1760857)
The following new tests are being modified:
- tests.unit.test_lxd.CleanbuilderTestCase.test_cleanbuild
- To verify that the image info is obtained for the right architecture.
- tests.unit.test_lxd.FailedImageInfoTestCase.test_failed_image_info_just_warns
- To verify the exact command appearing in the error message.
I locally ran the tests:
- `./runtests.sh tests/unit` unrelated failures in [tests.unit.test_lifecycle.CoreSetupTestCase.test_core_setup_if_docker_env](https://bugs.launchpad.net/snapcraft/+bug/1752576) and `tests.unit.test_elf`.
- `./runtests.sh tests/integration` with one unrelated failure in [tests.integration.general.test_parser.TestParserWikis](https://bugs.launchpad.net/snapcraft/+bug/1752580).
- `./runtests.sh tests/static`: Everything passed
Manual test steps:
- Build and install a Snapcraft snap from this branch.
- cd tests/integration/snaps/basic
- SNAPCRAFT_BUILD_INFO=1 snapcraft cleanbuild
- Open prime/snap/manifest.yaml from the resulting snap.
- Observe the manifest containing the right architecture.
- Repeat this step a few times to ensure the value is the same.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #2046 fixed incorrect LXD image metadata by specifying the architecture in lxc image list; merged as commit 828ea5120. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #2046 as 828ea5120, adding architecture to lxc image list so SNAPCRAFT_IMAGE_INFO records the correct LXD image, fixing LP #1760857. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #2046 as 828ea5120, specifying the architecture in lxc image list so SNAPCRAFT_IMAGE_INFO records the correct LXD image and fixes LP: #1760857. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged #2046 as commit 828ea5120, adding the architecture filter to lxc image list so LXD builds record the correct SNAPCRAFT_IMAGE_INFO. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #2046 as commit 828ea5120, specifying the architecture in the LXC image-list command so SNAPCRAFT_IMAGE_INFO reports the correct image. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged fix for LXD image listing regression. Explicitly specifies architecture in the lxc image list command to ensure correct SNAPCRAFT_IMAGE_INFO values in the manifest. Resolves LP: #1760857. Tests updated. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged a fix for the LXD builder that explicitly specifies the architecture in the lxc image list command. This resolves a regression causing unordered or incorrect SNAPCRAFT_IMAGE_INFO values in the manifest, addressing LP: #1760857. |
Update history
No update history recorded yet.
Related work
-
Related To:
launchpad#1760857
(confidence 100%)
This change fixes the linked Launchpad regression.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #922 feat(LXD): add other-architecture option | craft-providers | merged | Merged PR #922 added LXD support for selecting a non-host architecture by including the requested architecture in the remote image name. Prerequisite #921 had merged. | |
| #1286 lxd: Setup image and target arch for cross-compilation | snapcraft | merged | Merged #1286 as 6a7372297: LXD now uses a host-architecture image while retaining the target architecture, avoiding slow QEMU emulation during cross-compilation. | |
| #1493 lxd: only pass target arch if specified explicitly | snapcraft | merged | Merged via commit 0a7de4515, passing --target-arch to LXD only when explicitly set so builds default to the container architecture. | |
| #2232 lxd: proper filename set when using architectures | snapcraft | merged | Merged #2232 as commit 786e1e475, fixing Launchpad #1789882 by using the proper architecture-specific filename set for LXD. | |
| #1718 lxd: let lxd choose the architecture | snapcraft | merged | Merged in #1718 as 834cfce4c, delegating default container architecture selection to LXD while recording the container architecture after startup. |