hey there, thanks for putting together the handy bootstrapping workflow
I have been setting this up with pytest-operator and lxd as the provider and came up against a permissions issue whereby the runner user fails to execute the charm build because it is not a member of the lxd group:
$ tox -e integration
.tox create: /home/runner/work/artifactory-operator/artifactory-operator/.tox/.tox
.tox installdeps: build, setuptools >= 44.0.0, wheel >= 0.34.2, twine >= 3.2.0, tox >= 3.20.1
.package create: /home/runner/work/artifactory-operator/artifactory-operator/.tox/.package
.package installdeps: setuptools>=44.0.0, wheel>=0.34.0
integration create: /home/runner/work/artifactory-operator/artifactory-operator/.tox/integration
integration installdeps: ops>=1.2.0, juju/python-libjuju@refs/heads/master.zip#egg=juju, pytest, pytest-operator
integration inst: /home/runner/work/artifactory-operator/artifactory-operator/.tox/.tmp/package/1/artifactory-operator-0.0.1.tar.gz
integration installed: artifactory-operator==0.0.1,attrs==21.2.0,backcall==0.2.0,bcrypt==3.2.0,cachetools==4.2.2,certifi==2021.5.30,cffi==1.14.6,charset-normalizer==2.0.4,cryptography==3.4.7,decorator==5.0.9,google-auth==2.0.1,idna==3.2,iniconfig==1.1.1,ipdb==0.13.9,ipython==7.26.0,ipython-genutils==0.2.0,jedi==0.18.0,Jinja2==3.0.1,juju @ juju/python-libjuju@refs/heads/master.zip
integration run-test-pre: PYTHONHASHSEED='3884729705'
integration run-test: commands[0] | pytest -v --tb native --show-capture=no --log-cli-level=INFO -s -m integration /home/runner/work/artifactory-operator/artifactory-operator/tests
============================= test session starts ==============================
platform linux -- Python 3.8.10, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- /home/runner/work/artifactory-operator/artifactory-operator/.tox/integration/bin/python
cachedir: .tox/integration/.pytest_cache
rootdir: /home/runner/work/artifactory-operator/artifactory-operator, configfile: pyproject.toml
plugins: asyncio-0.15.1, operator-0.8.1
collecting ... collected 65 items / 63 deselected / 2 selected
tests/test_integration.py::test_build_and_deploy /snap/bin/juju
/snap/bin/charmcraft
-------------------------------- live log setup --------------------------------
INFO pytest_operator.plugin:plugin.py:155 Using tmp_path: /home/runner/work/artifactory-operator/artifactory-operator/.tox/integration/tmp/pytest/test-integration-miah0
INFO pytest_operator.plugin:plugin.py:217 Adding model github-pr-0cb90:test-integration-miah
-------------------------------- live log call ---------------------------------
INFO pytest_operator.plugin:plugin.py:333 Building charm artifactory
FAILED
tests/test_integration.py::test_bundle
-------------------------------- live log call ---------------------------------
INFO pytest_operator.plugin:plugin.py:333 Building charm artifactory
FAILED
------------------------------ live log teardown -------------------------------
INFO pytest_operator.plugin:plugin.py:231 Model is empty
INFO pytest_operator.plugin:plugin.py:289 Destroying model test-integration-miah
...<snipped>.........................................................................
Traceback (most recent call last):
File "/home/runner/work/artifactory-operator/artifactory-operator/tests/test_integration.py", line 15, in test_bundle
bundle_path.read_text(), charm=await ops_test.build_charm(charm_path)
File "/home/runner/work/artifactory-operator/artifactory-operator/.tox/integration/lib/python3.8/site-packages/pytest_operator/plugin.py", line 351, in build_charm
raise RuntimeError(
RuntimeError: Failed to build charm /home/runner/work/artifactory-operator/artifactory-operator:
LXD requires additional permissions.
Please ensure that the user is in the 'lxd' group. (full execution logs in '/home/runner/snap/charmcraft/common/charmcraft-log-amtk_vsg')
This is a two part problem, one part of which may be addressed in #15 - the runner user must be added to the lxd group. I have done this with the following workaround:
- name: add user to lxd group
run: |
sudo usermod -a -G lxd $USER
the second issue is that the running shell session in the github runner does not acquire the group permission -- so simply adding this group doesn't resolve the bug -- the relevant code/tests need to be executed in a new context. I am currently using the following workaround:
hey there, thanks for putting together the handy bootstrapping workflow
I have been setting this up with
pytest-operator
andlxd
as the provider and came up against a permissions issue whereby the runner user fails to execute the charm build because it is not a member of thelxd
group:This is a two part problem, one part of which may be addressed in #15 - the runner user must be added to the
lxd
group. I have done this with the following workaround:the second issue is that the running shell session in the github runner does not acquire the group permission -- so simply adding this group doesn't resolve the bug -- the relevant code/tests need to be executed in a new context. I am currently using the following workaround: