From b4dcc38edacbd52f501f8ec7474f5b213f79bfa5 Mon Sep 17 00:00:00 2001 From: Aurelien Lourot Date: Thu, 16 Dec 2021 15:07:06 +0100 Subject: [PATCH] Add charmcraft.yaml for publishing to Charmhub See https://juju.is/docs/sdk/charmcraft-config Change-Id: Icce0e6325e61089f2b8c3bca74f442a460282379 --- build-requirements.txt | 8 +++++--- charmcraft.yaml | 12 ++++++++++++ requirements.txt | 5 ++++- tests/README.md | 9 +++++++++ tox.ini | 10 +++++++++- 5 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 charmcraft.yaml diff --git a/build-requirements.txt b/build-requirements.txt index d549549..b6d2452 100644 --- a/build-requirements.txt +++ b/build-requirements.txt @@ -1,5 +1,7 @@ -# NOTE(lourot): versions newer than 1.0.0 fail as described in -# https://github.com/canonical/charmcraft/pull/487#issuecomment-894529408 -git+https://github.com/canonical/charmcraft.git@1.0.0#egg=charmcraft +# NOTES(lourot): +# * We don't install charmcraft via pip anymore because it anyway spins up a +# container and scp the system's charmcraft snap inside it. So the charmcraft +# snap is necessary on the system anyway. +# * `tox -e build` successfully validated with charmcraft 1.2.1 cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35. diff --git a/charmcraft.yaml b/charmcraft.yaml new file mode 100644 index 0000000..b670494 --- /dev/null +++ b/charmcraft.yaml @@ -0,0 +1,12 @@ +type: charm + +parts: + charm: + build-packages: + - git + +bases: + - name: ubuntu + channel: "20.04" + architectures: + - amd64 diff --git a/requirements.txt b/requirements.txt index dc9c74f..588726e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,8 @@ ops -git+https://opendev.org/openstack/charm-ops-openstack#egg=ops_openstack + +# NOTE(lourot): spurious TLS verification issues from opendev.org, switching to +# github.com for now: +git+https://github.com/openstack/charm-ops-openstack#egg=ops_openstack ruamel.yaml pylspci diff --git a/tests/README.md b/tests/README.md index cbb3f27..31363ee 100644 --- a/tests/README.md +++ b/tests/README.md @@ -5,6 +5,15 @@ deployment functionality from the perspective of this charm, its requirements and its features, as exercised in a subset of the full OpenStack deployment test bundle topology. +Run the smoke tests with: + +```bash +cd ../ +tox -e build +cd tests/ +tox -e func-smoke +``` + For full details on functional testing of OpenStack charms please refer to the [functional testing](https://docs.openstack.org/charm-guide/latest/reference/testing.html#functional-testing) section of the OpenStack Charm Guide. diff --git a/tox.ini b/tox.ini index 241a7b5..5cfdbdb 100644 --- a/tox.ini +++ b/tox.ini @@ -27,10 +27,11 @@ setenv = VIRTUAL_ENV={envdir} install_command = pip install {opts} {packages} commands = stestr run --slowest {posargs} -whitelist_externals = +allowlist_externals = git add-to-archive.py bash + charmcraft passenv = HOME TERM CS_* OS_* TEST_* deps = -r{toxinidir}/test-requirements.txt @@ -105,8 +106,15 @@ commands = {posargs} [testenv:build] basepython = python3 deps = -r{toxinidir}/build-requirements.txt +# NOTE(lourot): charmcraft 1.0.0 used to generate +# nova-compute-nvidia-vgpu.charm, which is the behaviour expected by OSCI. +# However charmcraft 1.2.1 now generates +# nova-compute-nvidia-vgpu_ubuntu-20.04-amd64.charm instead. In order to keep +# the old behaviour we rename the file at the end. commands = + charmcraft clean charmcraft build + bash -c "mv nova-compute-nvidia-vgpu_*.charm nova-compute-nvidia-vgpu.charm" [testenv:func-noop] basepython = python3