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

Not able to build charms on osx #114

Open
jat-canonical opened this issue Sep 14, 2023 · 0 comments
Open

Not able to build charms on osx #114

jat-canonical opened this issue Sep 14, 2023 · 0 comments

Comments

@jat-canonical
Copy link

jat-canonical commented Sep 14, 2023

I am trying to write tests for my charm using the operator framework but the charmcraft pack step fails as it neither uses a remote lxd cluster nor does it try to use multipass as charmcraft already uses if I try to build the charm locally directly outside tests.

My charmcraft.yaml:

type: charm
bases:
- build-on:
  - name: "ubuntu"
    channel: "20.04"
  run-on:
  - name: "ubuntu"
    channel: "20.04"
    architectures: [amd64, arm64]
- build-on:
  - name: "ubuntu"
    channel: "22.04"
  run-on:
  - name: "ubuntu"
    channel: "22.04"
    architectures: [amd64, arm64]
parts:
  charm:
    source: .
    charm-requirements: [requirements.txt]
    build-packages: [git]

The error I get is :

File "/Users/jatin/canonical/nats-operator/tests/integration/test_charm.py", line 8, in test_smoke
    charm = await ops_test.build_charm(".")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jatin/canonical/nats-operator/.tox/integration/lib/python3.11/site-packages/pytest_operator/plugin.py", line 969, in build_charm
    assert "lxd" in all_groups, (
AssertionError: Group 'lxd' required but not available; ensure that lxd is available or use --destructive-mode
assert 'lxd' in {'_accessoryupdater', '_amavisd', '_analyticsd', '_analyticsusers', '_appinstalld', '_appleevents', ...}

Using --destructive-mode also fails as it does not find lxd on the host:

  File "/Users/jatin/canonical/nats-operator/tests/integration/test_charm.py", line 8, in test_smoke
    charm = await ops_test.build_charm(".")
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/jatin/canonical/nats-operator/.tox/integration/lib/python3.11/site-packages/pytest_operator/plugin.py", line 1004, in build_charm
    raise RuntimeError(
RuntimeError: Failed to build charm .:
Packing the charm.
Skipping 'bases[0].build-on[0]': name 'ubuntu' does not match host 'darwin'.
No suitable 'build-on' environment found in 'bases[0]' configuration.
Skipping 'bases[1].build-on[0]': name 'ubuntu' does not match host 'darwin'.
No suitable 'build-on' environment found in 'bases[1]' configuration.
No suitable 'build-on' environment found in any 'bases' configuration.

https://github.com/charmed-kubernetes/pytest-operator/blob/117350c3cee10dafdf42471b0d383392946bde14/pytest_operator/plugin.py#L966C31-L966C43

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant