From 5963ea4fc32ef269d93f2fc8e05b363815397c43 Mon Sep 17 00:00:00 2001 From: Dmitrii Shcherbakov Date: Tue, 23 May 2023 23:51:34 +0300 Subject: [PATCH] Update the charm for new releases * Switch to test bundles; * Update charmcraft.yaml; * Update requirements files; * Switch to ch:osci-frr from ch:quagga; * Update tox config files. Func-Test-PR: https://github.com/openstack-charmers/zaza-openstack-tests/pull/1060 Change-Id: Ie611966bb19631a586285f45f27dc52b96ff2937 --- .zuul.yaml | 3 +- charmcraft.yaml | 83 +++++++++++++++---- osci.yaml | 5 +- pip.sh | 18 ---- requirements.txt | 22 +---- src/metadata.yaml | 3 +- src/test-requirements.txt | 3 - .../{focal-xena.yaml => jammy-antelope.yaml} | 34 ++++---- .../{focal-yoga.yaml => jammy-zed.yaml} | 34 ++++---- .../{jammy-yoga.yaml => lunar-antelope.yaml} | 32 ++++--- src/tests/tests.yaml | 13 +-- src/tox.ini | 26 +++--- test-requirements.txt | 18 +--- tox.ini | 73 ++++------------ 14 files changed, 149 insertions(+), 218 deletions(-) delete mode 100755 pip.sh rename src/tests/bundles/{focal-xena.yaml => jammy-antelope.yaml} (79%) rename src/tests/bundles/{focal-yoga.yaml => jammy-zed.yaml} (79%) rename src/tests/bundles/{jammy-yoga.yaml => lunar-antelope.yaml} (81%) diff --git a/.zuul.yaml b/.zuul.yaml index 7dd3db9..d447e1e 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,3 +1,4 @@ - project: templates: - - openstack-python3-charm-yoga-jobs + - openstack-python3-charm-jobs + - openstack-cover-jobs \ No newline at end of file diff --git a/charmcraft.yaml b/charmcraft.yaml index c9a0ed7..10cfae8 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -2,32 +2,79 @@ type: charm parts: charm: + source: src/ + plugin: reactive + reactive-charm-build-arguments: + - --binary-wheels-from-source + - -v build-packages: - - tox - git - python3-dev - override-build: | - apt-get install ca-certificates -y - tox -e build-reactive - override-stage: | - echo "Copying charm to staging area: $CHARMCRAFT_STAGE" - NAME=$(ls $CHARMCRAFT_PART_BUILD/build/builds) - cp -r $CHARMCRAFT_PART_BUILD/build/builds/$NAME/* $CHARMCRAFT_STAGE/ - override-prime: | - # For some reason, the normal priming chokes on the fact that there's a - # hooks directory. - cp -r $CHARMCRAFT_STAGE/* . + - libffi-dev + - libssl-dev + - rustc + - cargo + build-snaps: + - charm + build-environment: + - CHARM_INTERFACES_DIR: $CRAFT_PROJECT_DIR/interfaces/ + - CHARM_LAYERS_DIR: $CRAFT_PROJECT_DIR/layers/ + - MAKEFLAGS: -j$(nproc) bases: - build-on: - name: ubuntu - channel: "20.04" - architectures: - - amd64 + channel: "22.04" + architectures: [amd64] run-on: - name: ubuntu - channel: "20.04" - architectures: [amd64, s390x, ppc64el, arm64] + channel: "22.04" + architectures: [amd64] + - name: ubuntu + channel: "22.10" + architectures: [amd64] + - name: ubuntu + channel: "23.04" + architectures: [amd64] + - build-on: - name: ubuntu channel: "22.04" - architectures: [amd64, s390x, ppc64el, arm64] + architectures: [arm64] + run-on: + - name: ubuntu + channel: "22.04" + architectures: [arm64] + - name: ubuntu + channel: "22.10" + architectures: [arm64] + - name: ubuntu + channel: "23.04" + architectures: [arm64] + - build-on: + - name: ubuntu + channel: "22.04" + architectures: [ppc64el] + run-on: + - name: ubuntu + channel: "22.04" + architectures: [ppc64el] + - name: ubuntu + channel: "22.10" + architectures: [ppc64el] + - name: ubuntu + channel: "23.04" + architectures: [ppc64el] + - build-on: + - name: ubuntu + channel: "22.04" + architectures: [s390x] + run-on: + - name: ubuntu + channel: "22.04" + architectures: [s390x] + - name: ubuntu + channel: "22.10" + architectures: [s390x] + - name: ubuntu + channel: "23.04" + architectures: [s390x] diff --git a/osci.yaml b/osci.yaml index 56a09b1..5c494a2 100644 --- a/osci.yaml +++ b/osci.yaml @@ -1,10 +1,9 @@ - project: templates: - - charm-unit-jobs-py38 - charm-unit-jobs-py310 - - charm-xena-functional-jobs - - charm-yoga-functional-jobs + - charm-functional-jobs vars: needs_charm_build: true charm_build_name: neutron-dynamic-routing build_type: charmcraft + 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/requirements.txt b/requirements.txt index 7755b95..8ca0e9f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,28 +3,8 @@ # choices of *requirements.txt files for OpenStack Charms: # https://github.com/openstack-charmers/release-tools # -# NOTE(lourot): This might look like a duplication of test-requirements.txt but -# some tox targets use only test-requirements.txt whereas charm-build uses only -# requirements.txt -setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85 -# NOTE: newer versions of cryptography require a Rust compiler to build, -# see -# * https://github.com/openstack-charmers/zaza/issues/421 -# * https://mail.python.org/pipermail/cryptography-dev/2021-January/001003.html -# -cryptography<3.4 -# Build requirements -cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35. -git+https://github.com/juju/charm-tools#egg=charm-tools +git+https://github.com/juju/charm-tools.git simplejson - -# Newer versions use keywords that didn't exist in python 3.5 yet (e.g. -# "ModuleNotFoundError") -# NOTE(lourot): This might look like a duplication of test-requirements.txt but -# some tox targets use only test-requirements.txt whereas charm-build uses only -# requirements.txt -importlib-metadata<3.0.0; python_version < '3.6' -importlib-resources<3.0.0; python_version < '3.6' diff --git a/src/metadata.yaml b/src/metadata.yaml index 87ce4de..6c4bd85 100644 --- a/src/metadata.yaml +++ b/src/metadata.yaml @@ -7,8 +7,9 @@ description: | tags: - openstack series: -- focal - jammy +- kinetic +- lunar subordinate: false extra-bindings: # Used to specify the OpenStack provider network interface 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/focal-xena.yaml b/src/tests/bundles/jammy-antelope.yaml similarity index 79% rename from src/tests/bundles/focal-xena.yaml rename to src/tests/bundles/jammy-antelope.yaml index bf6ca2f..5216c72 100644 --- a/src/tests/bundles/focal-xena.yaml +++ b/src/tests/bundles/jammy-antelope.yaml @@ -1,9 +1,9 @@ local_overlay_enabled: False variables: - openstack-origin: &openstack-origin cloud:focal-xena + openstack-origin: &openstack-origin cloud:jammy-antelope -series: focal +series: jammy comment: - 'machines section to decide order of deployment. database sooner = faster' @@ -19,28 +19,26 @@ machines: '5': '6': '7': - # for quagga which has no focal support yet - series: bionic + # osci-frr has a limited set of supported series. + series: jammy applications: keystone-mysql-router: charm: ch:mysql-router - channel: 8.0.19/edge + channel: latest/edge neutron-api-mysql-router: charm: ch:mysql-router - channel: 8.0.19/edge + channel: latest/edge mysql-innodb-cluster: charm: ch:mysql-innodb-cluster num_units: 3 - options: - source: *openstack-origin to: - '0' - '1' - '2' - channel: 8.0.19/edge + channel: latest/edge keystone: charm: ch:keystone @@ -53,7 +51,7 @@ applications: haproxy-connect-timeout: 9000 to: - '3' - channel: xena/edge + channel: latest/edge neutron-api: charm: ch:neutron-api @@ -70,10 +68,10 @@ applications: haproxy-connect-timeout: 9000 to: - '4' - channel: xena/edge + channel: latest/edge neutron-dynamic-routing: - charm: ../../../neutron-dynamic-routing.charm + charm: ../../../neutron-dynamic-routing_ubuntu-22.04-amd64_ubuntu-22.10-amd64_ubuntu-23.04-amd64.charm num_units: 1 options: openstack-origin: *openstack-origin @@ -83,15 +81,13 @@ applications: rabbitmq-server: charm: ch:rabbitmq-server num_units: 1 - options: - source: *openstack-origin to: - '6' - channel: 3.8/edge + channel: latest/edge - quagga: - charm: ch:openstack-charmers-next-quagga - series: bionic + osci-frr: + charm: ch:osci-frr + series: jammy num_units: 1 to: - '7' @@ -102,7 +98,7 @@ relations: - 'rabbitmq-server:amqp' - - 'neutron-dynamic-routing:bgp-speaker' - - 'quagga:bgpclient' + - 'osci-frr:bgpclient' - - 'keystone:shared-db' - 'keystone-mysql-router:shared-db' diff --git a/src/tests/bundles/focal-yoga.yaml b/src/tests/bundles/jammy-zed.yaml similarity index 79% rename from src/tests/bundles/focal-yoga.yaml rename to src/tests/bundles/jammy-zed.yaml index 59b4653..0cf2c53 100644 --- a/src/tests/bundles/focal-yoga.yaml +++ b/src/tests/bundles/jammy-zed.yaml @@ -1,9 +1,9 @@ local_overlay_enabled: False variables: - openstack-origin: &openstack-origin cloud:focal-yoga + openstack-origin: &openstack-origin cloud:jammy-zed -series: focal +series: jammy comment: - 'machines section to decide order of deployment. database sooner = faster' @@ -19,28 +19,26 @@ machines: '5': '6': '7': - # for quagga which has no focal support yet - series: bionic + # osci-frr has a limited set of supported series. + series: jammy applications: keystone-mysql-router: charm: ch:mysql-router - channel: 8.0.19/edge + channel: latest/edge neutron-api-mysql-router: charm: ch:mysql-router - channel: 8.0.19/edge + channel: latest/edge mysql-innodb-cluster: charm: ch:mysql-innodb-cluster num_units: 3 - options: - source: *openstack-origin to: - '0' - '1' - '2' - channel: 8.0.19/edge + channel: latest/edge keystone: charm: ch:keystone @@ -53,7 +51,7 @@ applications: haproxy-connect-timeout: 9000 to: - '3' - channel: yoga/edge + channel: latest/edge neutron-api: charm: ch:neutron-api @@ -70,10 +68,10 @@ applications: haproxy-connect-timeout: 9000 to: - '4' - channel: yoga/edge + channel: latest/edge neutron-dynamic-routing: - charm: ../../../neutron-dynamic-routing.charm + charm: ../../../neutron-dynamic-routing_ubuntu-22.04-amd64_ubuntu-22.10-amd64_ubuntu-23.04-amd64.charm num_units: 1 options: openstack-origin: *openstack-origin @@ -83,15 +81,13 @@ applications: rabbitmq-server: charm: ch:rabbitmq-server num_units: 1 - options: - source: *openstack-origin to: - '6' - channel: 3.8/edge + channel: latest/edge - quagga: - charm: ch:openstack-charmers-next-quagga - series: bionic + osci-frr: + charm: ch:osci-frr + series: jammy num_units: 1 to: - '7' @@ -102,7 +98,7 @@ relations: - 'rabbitmq-server:amqp' - - 'neutron-dynamic-routing:bgp-speaker' - - 'quagga:bgpclient' + - 'osci-frr:bgpclient' - - 'keystone:shared-db' - 'keystone-mysql-router:shared-db' diff --git a/src/tests/bundles/jammy-yoga.yaml b/src/tests/bundles/lunar-antelope.yaml similarity index 81% rename from src/tests/bundles/jammy-yoga.yaml rename to src/tests/bundles/lunar-antelope.yaml index 43a494d..687b157 100644 --- a/src/tests/bundles/jammy-yoga.yaml +++ b/src/tests/bundles/lunar-antelope.yaml @@ -3,7 +3,7 @@ local_overlay_enabled: False variables: openstack-origin: &openstack-origin distro -series: jammy +series: lunar comment: - 'machines section to decide order of deployment. database sooner = faster' @@ -19,28 +19,26 @@ machines: '5': '6': '7': - # for quagga which has no jammy support yet - series: bionic + # osci-frr has a limited set of supported series. + series: jammy applications: keystone-mysql-router: charm: ch:mysql-router - channel: 8.0.19/edge + channel: latest/edge neutron-api-mysql-router: charm: ch:mysql-router - channel: 8.0.19/edge + channel: latest/edge mysql-innodb-cluster: charm: ch:mysql-innodb-cluster num_units: 3 - options: - source: *openstack-origin to: - '0' - '1' - '2' - channel: 8.0.19/edge + channel: latest/edge keystone: charm: ch:keystone @@ -53,7 +51,7 @@ applications: haproxy-connect-timeout: 9000 to: - '3' - channel: yoga/edge + channel: latest/edge neutron-api: charm: ch:neutron-api @@ -70,10 +68,10 @@ applications: haproxy-connect-timeout: 9000 to: - '4' - channel: yoga/edge + channel: latest/edge neutron-dynamic-routing: - charm: ../../../neutron-dynamic-routing.charm + charm: ../../../neutron-dynamic-routing_ubuntu-22.04-amd64_ubuntu-22.10-amd64_ubuntu-23.04-amd64.charm num_units: 1 options: openstack-origin: *openstack-origin @@ -83,15 +81,13 @@ applications: rabbitmq-server: charm: ch:rabbitmq-server num_units: 1 - options: - source: *openstack-origin to: - '6' - channel: 3.9/edge + channel: latest/edge - quagga: - charm: ch:openstack-charmers-next-quagga - series: bionic + osci-frr: + charm: ch:osci-frr + series: jammy num_units: 1 to: - '7' @@ -102,7 +98,7 @@ relations: - 'rabbitmq-server:amqp' - - 'neutron-dynamic-routing:bgp-speaker' - - 'quagga:bgpclient' + - 'osci-frr:bgpclient' - - 'keystone:shared-db' - 'keystone-mysql-router:shared-db' diff --git a/src/tests/tests.yaml b/src/tests/tests.yaml index 2e9e78d..ce885ab 100644 --- a/src/tests/tests.yaml +++ b/src/tests/tests.yaml @@ -4,18 +4,19 @@ configure: - zaza.openstack.charm_tests.dragent.configure.setup gate_bundles: -- focal-xena -- focal-yoga -- jammy-yoga +- jammy-zed smoke_bundles: -- focal-yoga +- jammy-zed -dev_bundles: [] +dev_bundles: +- jammy-zed +- jammy-antelope +- lunar-antelope tests: - zaza.openstack.charm_tests.dragent.tests.DRAgentTest tests_options: force_deploy: - - jammy-yoga + - 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/test-requirements.txt b/test-requirements.txt index a11a7d0..a7936e6 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,7 +4,6 @@ # https://github.com/openstack-charmers/release-tools # pyparsing<3.0.0 # aodhclient is pinned in zaza and needs pyparsing < 3.0.0, but cffi also needs it, so pin here. -cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35. setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85 stestr>=2.2.0 @@ -13,25 +12,10 @@ stestr>=2.2.0 # https://github.com/mtreinish/stestr/issues/145 cliff<3.0.0 -# Dependencies of stestr. Newer versions use keywords that didn't exist in -# python 3.5 yet (e.g. "ModuleNotFoundError") -importlib-metadata<3.0.0; python_version < '3.6' -importlib-resources<3.0.0; python_version < '3.6' - -# Some Zuul nodes sometimes pull newer versions of these dependencies which -# dropped support for python 3.5: -osprofiler<2.7.0;python_version<'3.6' -stevedore<1.31.0;python_version<'3.6' -debtcollector<1.22.0;python_version<'3.6' -oslo.utils<=3.41.0;python_version<'3.6' - requests>=2.18.4 charms.reactive -# Newer mock seems to have some syntax which is newer than python3.5 (e.g. -# f'{something}' -mock>=1.2,<4.0.0; python_version < '3.6' -mock>=1.2; python_version >= '3.6' +mock>=1.2 nose>=1.3.7 coverage>=3.6 diff --git a/tox.ini b/tox.ini index e22fe48..c2be05e 100644 --- a/tox.ini +++ b/tox.ini @@ -5,58 +5,42 @@ # 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 -# 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 - setuptools<50.0.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 TERM=linux - LAYER_PATH={toxinidir}/layers - INTERFACE_PATH={toxinidir}/interfaces + CHARM_LAYERS_DIR={toxinidir}/layers + CHARM_INTERFACES_DIR={toxinidir}/interfaces JUJU_REPOSITORY={toxinidir}/build -passenv = http_proxy https_proxy INTERFACE_PATH LAYER_PATH JUJU_REPOSITORY -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 - rename.sh deps = -r{toxinidir}/requirements.txt [testenv:build] basepython = python3 -deps = -r{toxinidir}/build-requirements.txt commands = charmcraft clean - charmcraft -v build - {toxinidir}/rename.sh - -[testenv:build-reactive] -basepython = python3 -commands = - charm-build --log-level DEBUG --use-lock-file-branches -o {toxinidir}/build/builds src {posargs} + charmcraft -v pack [testenv:add-build-lock-file] basepython = python3 @@ -68,21 +52,6 @@ basepython = python3 deps = -r{toxinidir}/test-requirements.txt commands = stestr run --slowest {posargs} -[testenv:py36] -basepython = python3.6 -deps = -r{toxinidir}/test-requirements.txt -commands = stestr run --slowest {posargs} - -[testenv:py38] -basepython = python3.8 -deps = -r{toxinidir}/test-requirements.txt -commands = stestr run --slowest {posargs} - -[testenv:py39] -basepython = python3.9 -deps = -r{toxinidir}/test-requirements.txt -commands = stestr run --slowest {posargs} - [testenv:py310] basepython = python3.10 deps = -r{toxinidir}/test-requirements.txt @@ -91,21 +60,9 @@ commands = stestr run --slowest {posargs} [testenv:pep8] basepython = python3 deps = flake8==3.9.2 - charm-tools==2.8.3 + 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