diff --git a/.zuul.yaml b/.zuul.yaml index 23bf5f6..fd20909 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,4 +1,4 @@ - project: templates: - - openstack-python3-charm-zed-jobs + - openstack-python3-charm-jobs - openstack-cover-jobs diff --git a/build-requirements.txt b/build-requirements.txt deleted file mode 100644 index b6d2452..0000000 --- a/build-requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -# 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 index 344d5fa..d06a6c7 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -2,32 +2,25 @@ type: charm parts: charm: + plugin: reactive + reactive-charm-build-arguments: + - --binary-wheels-from-source build-packages: - tox - git - python3-dev - libffi-dev - libssl-dev + - libxml2-dev + - libxslt1-dev + - rustc + - cargo + source: src/ + build-snaps: + - charm/latest/edge build-environment: - - CHARM_INTERFACES_DIR: /root/project/interfaces/ - - CHARM_LAYERS_DIR: /root/project/layers/ - override-build: | - apt-get install ca-certificates -y - tox -e build-reactive - override-stage: | - echo "Copying charm to staging area: $CRAFT_STAGE" - NAME=$(ls $CRAFT_PART_BUILD/build/builds) - cp -r $CRAFT_PART_BUILD/build/builds/$NAME/* $CRAFT_STAGE/ - override-prime: | - # For some reason, the normal priming chokes on the fact that there's a - # hooks directory. - cp -r $CRAFT_STAGE/* . - # Charmcraft looks for this specific entry point, and it needs to be - # executable - mkdir -p src - touch src/charm.py - chmod +x src/charm.py - + - CHARM_INTERFACES_DIR: $CRAFT_PROJECT_DIR/interfaces/ + - CHARM_LAYERS_DIR: $CRAFT_PROJECT_DIR/layers/ bases: - build-on: - name: ubuntu @@ -40,6 +33,9 @@ bases: - name: ubuntu channel: "22.10" architectures: [amd64] + - name: ubuntu + channel: "23.04" + architectures: [amd64] - build-on: - name: ubuntu channel: "22.04" @@ -51,6 +47,9 @@ bases: - name: ubuntu channel: "22.10" architectures: [arm64] + - name: ubuntu + channel: "23.04" + architectures: [arm64] - build-on: - name: ubuntu channel: "22.04" @@ -62,6 +61,9 @@ bases: - name: ubuntu channel: "22.10" architectures: [ppc64el] + - name: ubuntu + channel: "23.04" + architectures: [ppc64el] - build-on: - name: ubuntu channel: "22.04" @@ -73,3 +75,6 @@ bases: - name: ubuntu channel: "22.10" architectures: [s390x] + - name: ubuntu + channel: "23.04" + architectures: [s390x] diff --git a/osci.yaml b/osci.yaml index 0a2e2d0..cae1e86 100644 --- a/osci.yaml +++ b/osci.yaml @@ -1,9 +1,9 @@ - project: templates: - charm-unit-jobs-py310 - - charm-zed-functional-jobs + - charm-functional-jobs vars: needs_charm_build: true charm_build_name: cinder-lvm build_type: charmcraft - charmcraft_channel: 2.0/stable + charmcraft_channel: 2.1/stable diff --git a/pip.sh b/pip.sh deleted file mode 100755 index 9a7e6b0..0000000 --- a/pip.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bash -# -# This file is managed centrally by release-tools and should not be modified -# within individual charm repos. See the 'global' dir contents for available -# choices of tox.ini for OpenStack Charms: -# https://github.com/openstack-charmers/release-tools -# -# setuptools 58.0 dropped the support for use_2to3=true which is needed to -# install blessings (an indirect dependency of charm-tools). -# -# More details on the beahvior of tox and virtualenv creation can be found at -# https://github.com/tox-dev/tox/issues/448 -# -# This script is wrapper to force the use of the pinned versions early in the -# process when the virtualenv was created and upgraded before installing the -# depedencies declared in the target. -pip install 'pip<20.3' 'setuptools<50.0.0' -pip "$@" diff --git a/src/metadata.yaml b/src/metadata.yaml index d959ebd..067cbec 100644 --- a/src/metadata.yaml +++ b/src/metadata.yaml @@ -13,6 +13,7 @@ tags: series: - jammy - kinetic + - lunar subordinate: true provides: storage-backend: diff --git a/src/test-requirements.txt b/src/test-requirements.txt index 9c7afb7..e771023 100644 --- a/src/test-requirements.txt +++ b/src/test-requirements.txt @@ -4,9 +4,6 @@ # https://github.com/openstack-charmers/release-tools # -# Need tox to be available from tox... inception yes, but its a workaround for now -tox - # Functional Test Requirements (let Zaza's dependencies solve all dependencies here!) git+https://github.com/openstack-charmers/zaza.git#egg=zaza git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack diff --git a/src/tests/bundles/jammy-antelope.yaml b/src/tests/bundles/jammy-antelope.yaml new file mode 100644 index 0000000..f36ea7b --- /dev/null +++ b/src/tests/bundles/jammy-antelope.yaml @@ -0,0 +1,84 @@ +series: jammy +local_overlay_enabled: False + +variables: + openstack-origin: &openstack-origin cloud:jammy-antelope +comment: +- 'machines section to decide order of deployment. database sooner = faster' +machines: + '0': + constraints: mem=3072M + '1': + constraints: mem=3072M + '2': + constraints: mem=3072M + '3': + '4': + '5': + constraints: mem=4G root-disk=16G +relations: + - - keystone:shared-db + - keystone-mysql-router:shared-db + - - keystone-mysql-router:db-router + - mysql-innodb-cluster:db-router + - - cinder:shared-db + - cinder-mysql-router:shared-db + - - cinder-mysql-router:db-router + - mysql-innodb-cluster:db-router + - - cinder:identity-service + - keystone:identity-service + - - cinder:amqp + - rabbitmq-server:amqp + - - cinder:storage-backend + - cinder-lvm:storage-backend +applications: + mysql-innodb-cluster: + charm: ch:mysql-innodb-cluster + num_units: 3 + options: + source: *openstack-origin + to: + - '0' + - '1' + - '2' + channel: latest/edge + rabbitmq-server: + charm: ch:rabbitmq-server + num_units: 1 + options: + source: *openstack-origin + to: + - '3' + channel: latest/edge + keystone: + charm: ch:keystone + options: + openstack-origin: *openstack-origin + num_units: 1 + to: + - '4' + channel: latest/edge + keystone-mysql-router: + charm: ch:mysql-router + channel: latest/edge + cinder: + charm: ch:cinder + storage: + block-devices: '40G' + num_units: 1 + options: + openstack-origin: *openstack-origin + block-device: None + overwrite: "true" + ephemeral-unmount: /mnt + to: + - '5' + channel: latest/edge + cinder-lvm: + charm: ../../../cinder-lvm.charm + options: + block-device: '/tmp/vol1|4G' + alias: zaza-lvm + cinder-mysql-router: + charm: ch:mysql-router + channel: latest/edge diff --git a/src/tests/bundles/jammy-zed.yaml b/src/tests/bundles/jammy-zed.yaml index 6d0d566..130be4b 100644 --- a/src/tests/bundles/jammy-zed.yaml +++ b/src/tests/bundles/jammy-zed.yaml @@ -75,7 +75,7 @@ applications: - '5' channel: latest/edge cinder-lvm: - charm: ../../../cinder-lvm_ubuntu-22.04-amd64_ubuntu-22.10-amd64.charm + charm: ../../../cinder-lvm.charm options: block-device: '/tmp/vol1|4G' alias: zaza-lvm diff --git a/src/tests/bundles/kinetic-zed.yaml b/src/tests/bundles/kinetic-zed.yaml index c90fcab..10b0ad0 100644 --- a/src/tests/bundles/kinetic-zed.yaml +++ b/src/tests/bundles/kinetic-zed.yaml @@ -74,7 +74,7 @@ applications: - '5' channel: latest/edge cinder-lvm: - charm: ../../../cinder-lvm_ubuntu-22.10-amd64_ubuntu-22.10-amd64.charm + charm: ../../../cinder-lvm.charm options: block-device: '/tmp/vol1|4G' alias: zaza-lvm diff --git a/src/tests/bundles/jammy-yoga.yaml b/src/tests/bundles/lunar-antelope.yaml similarity index 95% rename from src/tests/bundles/jammy-yoga.yaml rename to src/tests/bundles/lunar-antelope.yaml index 5662798..f7d4d16 100644 --- a/src/tests/bundles/jammy-yoga.yaml +++ b/src/tests/bundles/lunar-antelope.yaml @@ -1,4 +1,4 @@ -series: jammy +series: lunar local_overlay_enabled: False variables: @@ -74,7 +74,7 @@ applications: - '5' channel: latest/edge cinder-lvm: - charm: ../../../cinder-lvm_ubuntu-22.04-amd64_ubuntu-22.10-amd64.charm + charm: ../../../cinder-lvm.charm options: block-device: '/tmp/vol1|4G' alias: zaza-lvm diff --git a/src/tests/tests.yaml b/src/tests/tests.yaml index 323391a..60d678f 100644 --- a/src/tests/tests.yaml +++ b/src/tests/tests.yaml @@ -4,13 +4,14 @@ tests: configure: - zaza.openstack.charm_tests.keystone.setup.add_demo_user gate_bundles: - - jammy-yoga -smoke_bundles: - - jammy-yoga -dev_bundles: - - jammy-yoga - jammy-zed +smoke_bundles: + - jammy-zed +dev_bundles: + - jammy-antelope - kinetic-zed + - lunar-antelope tests_options: force_deploy: - kinetic-zed + - lunar-antelope diff --git a/src/tox.ini b/src/tox.ini index b40d295..8ffff0f 100644 --- a/src/tox.ini +++ b/src/tox.ini @@ -6,32 +6,26 @@ [tox] envlist = pep8 -skipsdist = True # NOTE: Avoid build/test env pollution by not enabling sitepackages. sitepackages = False # NOTE: Avoid false positives by not skipping missing interpreters. skip_missing_interpreters = False -# NOTES: -# * We avoid the new dependency resolver by pinning pip < 20.3, see -# https://github.com/pypa/pip/issues/9187 -# * Pinning dependencies requires tox >= 3.2.0, see -# https://tox.readthedocs.io/en/latest/config.html#conf-requires -# * It is also necessary to pin virtualenv as a newer virtualenv would still -# lead to fetching the latest pip in the func* tox targets, see -# https://stackoverflow.com/a/38133283 -requires = pip < 20.3 - virtualenv < 20.0 -# NOTE: https://wiki.canonical.com/engineering/OpenStack/InstallLatestToxOnOsci -minversion = 3.18.0 [testenv] +# We use tox mainly for virtual environment management for test requirements +# and do not install the charm code as a Python package into that environment. +# Ref: https://tox.wiki/en/latest/config.html#skip_install +skip_install = True setenv = VIRTUAL_ENV={envdir} PYTHONHASHSEED=0 allowlist_externals = juju -passenv = HOME TERM CS_* OS_* TEST_* +passenv = + HOME + TERM + CS_* + OS_* + TEST_* deps = -r{toxinidir}/test-requirements.txt -install_command = - pip install {opts} {packages} [testenv:pep8] basepython = python3 diff --git a/tox.ini b/tox.ini index f7b0a40..1839a2d 100644 --- a/tox.ini +++ b/tox.ini @@ -5,39 +5,49 @@ # https://github.com/openstack-charmers/release-tools [tox] -skipsdist = True envlist = pep8,py3 # NOTE: Avoid build/test env pollution by not enabling sitepackages. sitepackages = False # NOTE: Avoid false positives by not skipping missing interpreters. skip_missing_interpreters = False -# NOTE: https://wiki.canonical.com/engineering/OpenStack/InstallLatestToxOnOsci -minversion = 3.18.0 - [testenv] +# We use tox mainly for virtual environment management for test requirements +# and do not install the charm code as a Python package into that environment. +# Ref: https://tox.wiki/en/latest/config.html#skip_install +skip_install = True setenv = VIRTUAL_ENV={envdir} PYTHONHASHSEED=0 TERM=linux + CHARM_LAYERS_DIR={toxinidir}/layers + CHARM_INTERFACES_DIR={toxinidir}/interfaces JUJU_REPOSITORY={toxinidir}/build -passenv = no_proxy http_proxy https_proxy JUJU_REPOSITORY -# We can stop using pip.sh when charmcraft snap includes new version of git: -# https://github.com/canonical/charmcraft/issues/875 -install_command = - {toxinidir}/pip.sh install {opts} {packages} +passenv = + no_proxy + http_proxy + https_proxy + CHARM_INTERFACES_DIR + CHARM_LAYERS_DIR + JUJU_REPOSITORY allowlist_externals = charmcraft bash tox + {toxinidir}/rename.sh deps = -r{toxinidir}/requirements.txt [testenv:build] basepython = python3 -deps = -r{toxinidir}/build-requirements.txt +# charmcraft clean is done to ensure that +# `tox -e build` always performs a clean, repeatable build. +# For faster rebuilds during development, +# directly run `charmcraft -v pack && ./rename.sh`. commands = charmcraft clean charmcraft -v pack + {toxinidir}/rename.sh + charmcraft clean [testenv:build-reactive] basepython = python3 @@ -65,18 +75,6 @@ deps = flake8==3.9.2 git+https://github.com/juju/charm-tools.git commands = flake8 {posargs} src unit_tests -[testenv:func-target] -# Hack to get functional tests working in the charmcraft -# world. We should fix this. -basepython = python3 -passenv = HOME TERM CS_* OS_* TEST_* -deps = -r{toxinidir}/src/test-requirements.txt -changedir = {toxinidir}/src -commands = - bash -c "if [ ! -f ../*.charm ]; then echo 'Charm does not exist. Run tox -e build'; exit 1; fi" - tox --version - tox -e func-target {posargs} - [testenv:cover] # Technique based heavily upon # https://github.com/openstack/nova/blob/master/tox.ini