From b0acd923b7257f51613a17a4e4e93baf20876528 Mon Sep 17 00:00:00 2001 From: Corey Bryant Date: Wed, 28 Sep 2022 11:42:58 +0000 Subject: [PATCH] Build separately for each supported series and use binary builds Charms for OpenStack Yoga supports both Ubuntu Focal and Jammy which means Python 3.8 and Python 3.10. Managing dependencies across those two versions is non-trivial and we need to build the charm on the series the charm is supposed to support. Switch to using a binary build which allows pip's dependency resolution to work. This patch also drops the impish bundle. Change-Id: I251f0715dd4cff68cba22ffe7d793878317bbef5 --- .zuul.yaml | 2 +- bindep.txt | 4 ++ charmcraft.yaml | 40 +++++++++++--- osci.yaml | 1 + requirements.txt | 2 +- src/metadata.yaml | 2 +- src/tests/bundles/focal-xena.yaml | 2 +- src/tests/bundles/focal-yoga.yaml | 2 +- src/tests/bundles/impish-xena.yaml | 87 ------------------------------ src/tests/bundles/jammy-yoga.yaml | 2 +- src/tests/tests.yaml | 2 - tox.ini | 20 ++----- 12 files changed, 48 insertions(+), 118 deletions(-) create mode 100644 bindep.txt delete mode 100644 src/tests/bundles/impish-xena.yaml diff --git a/.zuul.yaml b/.zuul.yaml index 0eed196..7ffc71c 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,4 +1,4 @@ - project: templates: - - openstack-python3-ussuri-jobs + - openstack-python3-charm-yoga-jobs - openstack-cover-jobs diff --git a/bindep.txt b/bindep.txt new file mode 100644 index 0000000..17575d9 --- /dev/null +++ b/bindep.txt @@ -0,0 +1,4 @@ +libffi-dev [platform:dpkg] +libpq-dev [platform:dpkg] +libxml2-dev [platform:dpkg] +libxslt1-dev [platform:dpkg] diff --git a/charmcraft.yaml b/charmcraft.yaml index 4968216..e619cbc 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -6,20 +6,48 @@ parts: - tox - git - python3-dev + - libffi-dev + 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: $CHARMCRAFT_STAGE" - NAME=$(ls $CHARMCRAFT_PART_BUILD/build/builds) - cp -r $CHARMCRAFT_PART_BUILD/build/builds/$NAME/* $CHARMCRAFT_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 $CHARMCRAFT_STAGE/* . + cp -r $CRAFT_STAGE/* . + # Charmcraft looks for this specific entry point. + mkdir -p src + touch src/charm.py + chmod +x src/charm.py bases: - name: ubuntu channel: "20.04" - architectures: - - amd64 + architectures: [amd64] + - name: ubuntu + channel: "20.04" + architectures: [arm64] + - name: ubuntu + channel: "20.04" + architectures: [ppc64el] + - name: ubuntu + channel: "20.04" + architectures: [s390x] + - name: ubuntu + channel: "22.04" + architectures: [amd64] + - name: ubuntu + channel: "22.04" + architectures: [arm64] + - name: ubuntu + channel: "22.04" + architectures: [ppc64el] + - name: ubuntu + channel: "22.04" + architectures: [s390x] diff --git a/osci.yaml b/osci.yaml index f483adb..5907eab 100644 --- a/osci.yaml +++ b/osci.yaml @@ -8,3 +8,4 @@ needs_charm_build: true charm_build_name: cinder-purestorage build_type: charmcraft + charmcraft_channel: 2.0/stable diff --git a/requirements.txt b/requirements.txt index a68620f..a8e2edc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -10,7 +10,7 @@ setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb # Build requirements cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35. -charm-tools==2.8.3 +git+https://github.com/juju/charm-tools.git simplejson diff --git a/src/metadata.yaml b/src/metadata.yaml index 7296e64..05142f5 100644 --- a/src/metadata.yaml +++ b/src/metadata.yaml @@ -12,7 +12,7 @@ tags: - misc series: - focal -- impish +- jammy subordinate: true provides: storage-backend: diff --git a/src/tests/bundles/focal-xena.yaml b/src/tests/bundles/focal-xena.yaml index 566811f..e3a451b 100644 --- a/src/tests/bundles/focal-xena.yaml +++ b/src/tests/bundles/focal-xena.yaml @@ -73,7 +73,7 @@ applications: - '4' channel: latest/edge cinder-purestorage: - charm: ../../../cinder-purestorage.charm + charm: ../../../cinder-purestorage_ubuntu-20.04-amd64.charm options: # Add config options here driver-source: ppa:openstack-charmers/purestorage-stable diff --git a/src/tests/bundles/focal-yoga.yaml b/src/tests/bundles/focal-yoga.yaml index 549c69a..be8d53a 100644 --- a/src/tests/bundles/focal-yoga.yaml +++ b/src/tests/bundles/focal-yoga.yaml @@ -73,7 +73,7 @@ applications: - '4' channel: latest/edge cinder-purestorage: - charm: ../../../cinder-purestorage.charm + charm: ../../../cinder-purestorage_ubuntu-20.04-amd64.charm options: # Add config options here driver-source: ppa:openstack-charmers/purestorage-stable diff --git a/src/tests/bundles/impish-xena.yaml b/src/tests/bundles/impish-xena.yaml deleted file mode 100644 index 5dcba67..0000000 --- a/src/tests/bundles/impish-xena.yaml +++ /dev/null @@ -1,87 +0,0 @@ -variables: - openstack-origin: &openstack-origin distro - -local_overlay_enabled: False - -series: impish - -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': - -relations: - - - 'cinder:identity-service' - - 'keystone:identity-service' - - - - 'cinder:amqp' - - 'rabbitmq-server:amqp' - - - - 'cinder:storage-backend' - - 'cinder-purestorage:storage-backend' - - - - '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' - -applications: - keystone-mysql-router: - charm: ch:mysql-router - channel: latest/edge - cinder-mysql-router: - charm: ch:mysql-router - channel: latest/edge - - mysql-innodb-cluster: - charm: ch:mysql-innodb-cluster - num_units: 3 - options: - source: *openstack-origin - to: - - '0' - - '1' - - '2' - channel: latest/edge - keystone: - charm: ch:keystone - num_units: 1 - options: - openstack-origin: *openstack-origin - to: - - '3' - channel: latest/edge - cinder: - charm: ch:cinder - num_units: 1 - options: - openstack-origin: *openstack-origin - to: - - '4' - channel: latest/edge - cinder-purestorage: - charm: ../../../cinder-purestorage.charm - options: -# Add config options here - driver-source: ppa:openstack-charmers/purestorage-stable - protocol: iscsi - volume-backend-name: cinder-pure - rabbitmq-server: - charm: ch:rabbitmq-server - num_units: 1 - to: - - '5' - channel: latest/edge diff --git a/src/tests/bundles/jammy-yoga.yaml b/src/tests/bundles/jammy-yoga.yaml index 1dba254..e64ac30 100644 --- a/src/tests/bundles/jammy-yoga.yaml +++ b/src/tests/bundles/jammy-yoga.yaml @@ -73,7 +73,7 @@ applications: - '4' channel: latest/edge cinder-purestorage: - charm: ../../../cinder-purestorage.charm + charm: ../../../cinder-purestorage_ubuntu-22.04-amd64.charm options: # Add config options here driver-source: ppa:openstack-charmers/purestorage-stable diff --git a/src/tests/tests.yaml b/src/tests/tests.yaml index dd02c26..f77da76 100644 --- a/src/tests/tests.yaml +++ b/src/tests/tests.yaml @@ -7,7 +7,6 @@ configure: - zaza.openstack.charm_tests.keystone.setup.add_demo_user gate_bundles: - focal-xena - - impish-xena smoke_bundles: - focal-xena dev_bundles: @@ -15,5 +14,4 @@ dev_bundles: - jammy-yoga tests_options: force_deploy: - - impish-xena - jammy-yoga diff --git a/tox.ini b/tox.ini index 2d60b8a..d2210b0 100644 --- a/tox.ini +++ b/tox.ini @@ -11,18 +11,6 @@ envlist = pep8,py3 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 @@ -41,7 +29,6 @@ allowlist_externals = charmcraft bash tox - rename.sh deps = -r{toxinidir}/requirements.txt @@ -50,13 +37,12 @@ basepython = python3 deps = -r{toxinidir}/build-requirements.txt commands = charmcraft clean - charmcraft -v build - {toxinidir}/rename.sh + charmcraft -v pack [testenv:build-reactive] basepython = python3 commands = - charm-build --log-level DEBUG --use-lock-file-branches -o {toxinidir}/build/builds src {posargs} + charm-build --log-level DEBUG --use-lock-file-branches --binary-wheels-from-source -o {toxinidir}/build/builds src {posargs} [testenv:add-build-lock-file] basepython = python3 @@ -96,7 +82,7 @@ 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]