Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with latest LXD LTS #1640

Closed
Batalex opened this issue Apr 11, 2024 · 11 comments
Closed

Incompatibility with latest LXD LTS #1640

Batalex opened this issue Apr 11, 2024 · 11 comments
Labels
Bug Something isn't working

Comments

@Batalex
Copy link
Contributor

Batalex commented Apr 11, 2024

Bug Description

It seems like the lxd snap stable channel updated to a version not yet compatible with charmcraft.

Unfortunately, it is not easy to roll back lxd to a previous version, because its internal database would break.

To Reproduce

  • lxd and charmcraft snaps both tracking latest/stable
  • charmcraft pack

Environment

OS: Ubuntu 23.10

Snaps:

sudo snap list | grep -E "lxd|charmcraft"

charmcraft                 2.5.5                       2453      latest/stable       canonical**    classic
lxd                        5.21.1-43998c6              28155     latest/stable       canonical**    -

charmcraft.yaml

# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.

type: charm
parts:
  charm:
    charm-binary-python-packages:
      - setuptools
    build-packages:
      - pkg-config
      - libffi-dev
      - libssl-dev
      - rustc
      - cargo
bases:
  - build-on:
      - name: "ubuntu"
        channel: "22.04"
    run-on:
      - name: "ubuntu"
        channel: "22.04"

Relevant log output

cat /home/alex/.local/state/charmcraft/log/charmcraft-20240411-101147.334110.log

2024-04-11 10:11:47.335 Starting charmcraft version 2.5.5
2024-04-11 10:11:47.336 Reading '/home/alex/work/zookeeper-k8s-operator/metadata.yaml'
2024-04-11 10:11:47.338 Validating metadata keys
2024-04-11 10:11:47.339 Reading '/home/alex/work/zookeeper-k8s-operator/actions.yaml'
2024-04-11 10:11:47.340 Validating actions.yaml
2024-04-11 10:11:47.340 Reading '/home/alex/work/zookeeper-k8s-operator/config.yaml'
2024-04-11 10:11:47.341 Validating config.yaml
2024-04-11 10:11:47.342 System details: OSPlatform(system='ubuntu', release='23.10', machine='x86_64'); Environment: DESKTOP_SESSION='ubuntu', XDG_CURRENT_DESKTOP='ubuntu:GNOME'
2024-04-11 10:11:47.358 Packing the charm.
2024-04-11 10:11:47.456 charmcraft internal error: InvalidVersion("Invalid version: '5.21.1 LTS'")
2024-04-11 10:11:47.461 Traceback (most recent call last):
2024-04-11 10:11:47.461   File "/snap/charmcraft/2453/lib/python3.10/site-packages/charmcraft/main.py", line 187, in main
2024-04-11 10:11:47.461     retcode = dispatcher.run()
2024-04-11 10:11:47.461   File "/snap/charmcraft/2453/lib/python3.10/site-packages/craft_cli/dispatcher.py", line 484, in run
2024-04-11 10:11:47.461     return self._loaded_command.run(self._parsed_command_args)
2024-04-11 10:11:47.461   File "/snap/charmcraft/2453/lib/python3.10/site-packages/charmcraft/commands/pack.py", line 153, in run
2024-04-11 10:11:47.461     self._pack_charm(parsed_args, builder)
2024-04-11 10:11:47.461   File "/snap/charmcraft/2453/lib/python3.10/site-packages/charmcraft/commands/pack.py", line 204, in _pack_charm
2024-04-11 10:11:47.461     charms = builder.run(
2024-04-11 10:11:47.461   File "/snap/charmcraft/2453/lib/python3.10/site-packages/charmcraft/instrum.py", line 152, in _f
2024-04-11 10:11:47.461     return func(*args, **kwargs)
2024-04-11 10:11:47.461   File "/snap/charmcraft/2453/lib/python3.10/site-packages/charmcraft/package.py", line 282, in run
2024-04-11 10:11:47.461     charmcraft.providers.ensure_provider_is_available(self.provider)
2024-04-11 10:11:47.461   File "/snap/charmcraft/2453/lib/python3.10/site-packages/charmcraft/providers.py", line 232, in ensure_provider_is_available
2024-04-11 10:11:47.461     provider.ensure_provider_is_available()
2024-04-11 10:11:47.461   File "/snap/charmcraft/2453/lib/python3.10/site-packages/craft_providers/lxd/lxd_provider.py", line 80, in ensure_provider_is_available
2024-04-11 10:11:47.461     ensure_lxd_is_ready()
2024-04-11 10:11:47.461   File "/snap/charmcraft/2453/lib/python3.10/site-packages/craft_providers/lxd/installer.py", line 127, in ensure_lxd_is_ready
2024-04-11 10:11:47.461     if not lxd.is_supported_version():
2024-04-11 10:11:47.461   File "/snap/charmcraft/2453/lib/python3.10/site-packages/craft_providers/lxd/lxd.py", line 85, in is_supported_version
2024-04-11 10:11:47.461     return packaging.version.parse(version) >= minimum_version
2024-04-11 10:11:47.461   File "/snap/charmcraft/2453/lib/python3.10/site-packages/packaging/version.py", line 54, in parse
2024-04-11 10:11:47.461     return Version(version)
2024-04-11 10:11:47.461   File "/snap/charmcraft/2453/lib/python3.10/site-packages/packaging/version.py", line 200, in __init__
2024-04-11 10:11:47.461     raise InvalidVersion(f"Invalid version: '{version}'")
2024-04-11 10:11:47.461 packaging.version.InvalidVersion: Invalid version: '5.21.1 LTS'
2024-04-11 10:11:47.461 Full execution log: '/home/alex/.local/state/charmcraft/log/charmcraft-20240411-101147.334110.log'
@Batalex Batalex added the Bug Something isn't working label Apr 11, 2024
Copy link

Thank you for reporting us your feedback!

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

This message was autogenerated

@DnPlas
Copy link

DnPlas commented Apr 11, 2024

@DnPlas
Copy link

DnPlas commented Apr 11, 2024

A workaround for this is to revert the LXD version to 5.20, the issue seems to be caused because LXD now append the LTS suffix at the end of the versions starting from 5.21, and charmcraft doesn't seem to handle that correctly. Source.

@jnsgruk
Copy link
Member

jnsgruk commented Apr 11, 2024

FWIW I fixed this in my nix ports with a relatively trivial patch: jnsgruk/crafts-flake@e2adae3

@sergiusens / @cmatsuoka we probably need to get craft-providers updated with new releases for the tools fairly quickly. My solution probably isn't the right one, but it's because the new LTS version of LXD reports its version as 5.21 LTS rather than 5.21 afaict.

@ca-scribner
Copy link

Not as urgent as fixing the actual bug here, but it would be helpful to add some CI that would catch things like this in the future. For example, weekly CI that runs on edge channels of the dependencies, etc. This feels like something that can be detected ahead of it hitting users

@jnsgruk
Copy link
Member

jnsgruk commented Apr 11, 2024

This will be fixed by: #1641

Turns out the issue was already fixed in craft-providers 1.23.1

@lengau
Copy link
Collaborator

lengau commented Apr 11, 2024

Thanks folks! Yes, we'll be fixing this with a 2.6 release rather than backporting the fix to the older craft-providers. Plan is to put that into candidate today and hopefully push pretty much immediately into stable. The only other change in 2.6.0 is #1623.

@DnPlas
Copy link

DnPlas commented Apr 11, 2024

Awesome @lengau, thanks!

@lengau
Copy link
Collaborator

lengau commented Apr 11, 2024

This is available on the candidate channel now, and presuming the tests I do in the next few hours look good it'll be moving to stable shortly.

Announcement

@lengau
Copy link
Collaborator

lengau commented Apr 12, 2024

This is now on stable.

rgildein added a commit to canonical/charm-apt-mirror that referenced this issue Apr 16, 2024
* Set controller channel to 3.4 in CI

The functional tests requiered some changes, they were done strangely
and I'm not sure why they worked before. I think it's maybe due [1],
but I did not have time to investigate more.

---
[1]: pytest-dev/pytest-asyncio#706

* tmp fix until [1] is not resulved

---
[1]: canonical/charmcraft#1640

* drop bootstack-actions for func tests

* define concurrency in CI

* dropping tmp usage of 5.20/stable for LXD

* Switch back to bootstack-actions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

6 participants