From 2fb0cf125028b3e164741afcdbff466038de134a Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Wed, 10 Aug 2022 16:44:55 +0200 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. Update charm to consume the 1.0/stable track for the snap. Bundles: - Drop the renaming of the charm artifact and reference the series specific charm artifact in the bundles instead. - Fix gss mirror list, jammy retrofit-series and use 8.0/stable for MySQL. Closes-Bug: #1981334 Closes-Bug: #1970653 Closes-Bug: #1975491 Change-Id: I8c924038ee1c5ff258c41a44ad14ebc86a107b1b --- .gitignore | 2 + charmcraft.yaml | 19 +++-- osci.yaml | 1 + rename.sh | 13 --- requirements.txt | 22 ----- src/layer.yaml | 5 +- src/tests/bundles/focal-xena.yaml | 10 +-- src/tests/bundles/focal-yoga.yaml | 10 +-- src/tests/bundles/impish-xena.yaml | 130 ----------------------------- src/tests/bundles/jammy-yoga.yaml | 6 +- src/wheelhouse.txt | 17 +--- tox.ini | 18 +--- 12 files changed, 33 insertions(+), 220 deletions(-) delete mode 100755 rename.sh delete mode 100644 src/tests/bundles/impish-xena.yaml diff --git a/.gitignore b/.gitignore index 9fc3311..692c512 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,7 @@ .tox .stestr +interfaces +layers *__pycache__* *.pyc build diff --git a/charmcraft.yaml b/charmcraft.yaml index 6703d0e..34ed1a5 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -11,24 +11,29 @@ parts: 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 src + ln -sf ../hooks/start src/charm.py bases: - build-on: - name: ubuntu channel: "20.04" - architectures: - - amd64 + architectures: [amd64, s390x, ppc64el, arm64] run-on: - name: ubuntu channel: "20.04" - architectures: [amd64, s390x, ppc64el, arm64] + - build-on: - name: ubuntu channel: "22.04" architectures: [amd64, s390x, ppc64el, arm64] + run-on: + - name: ubuntu + channel: "22.04" diff --git a/osci.yaml b/osci.yaml index d36c624..0653b4e 100644 --- a/osci.yaml +++ b/osci.yaml @@ -8,3 +8,4 @@ needs_charm_build: true charm_build_name: octavia-diskimage-retrofit build_type: charmcraft + charmcraft_channel: 2.0/stable diff --git a/rename.sh b/rename.sh deleted file mode 100755 index d0c35c9..0000000 --- a/rename.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -charm=$(grep "charm_build_name" osci.yaml | awk '{print $2}') -echo "renaming ${charm}_*.charm to ${charm}.charm" -echo -n "pwd: " -pwd -ls -al -echo "Removing bad downloaded charm maybe?" -if [[ -e "${charm}.charm" ]]; -then - rm "${charm}.charm" -fi -echo "Renaming charm here." -mv ${charm}_*.charm ${charm}.charm diff --git a/requirements.txt b/requirements.txt index 7755b95..e294fb8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,28 +3,6 @@ # 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 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/layer.yaml b/src/layer.yaml index 64a4687..a8da5d2 100644 --- a/src/layer.yaml +++ b/src/layer.yaml @@ -9,11 +9,10 @@ options: basic: use_venv: True include_system_packages: False - packages: [ 'libffi-dev', 'libssl-dev' ] snap: octavia-diskimage-retrofit: - channel: beta - devmode: True + channel: 1.0/stable + classic: true comment: | Using devmode pending resolution of snapd fuse-support issue https://github.com/openstack-charmers/octavia-diskimage-retrofit/issues/6 diff --git a/src/tests/bundles/focal-xena.yaml b/src/tests/bundles/focal-xena.yaml index 344e9b4..5428c24 100644 --- a/src/tests/bundles/focal-xena.yaml +++ b/src/tests/bundles/focal-xena.yaml @@ -30,14 +30,14 @@ applications: - '0' - '1' - '2' - channel: 8.0.19/edge + channel: 8.0/edge keystone-mysql-router: charm: ch:mysql-router - channel: 8.0.19/edge + channel: 8.0/edge glance-mysql-router: charm: ch:mysql-router - channel: 8.0.19/edge + channel: 8.0/edge keystone: charm: ch:keystone @@ -68,7 +68,7 @@ applications: path: 'streams/v1/index.sjson', max: 1, item_filters: [ - 'release~(xenial|bionic|focal)', + 'release~(focal)', 'arch~(x86_64|amd64)', 'ftype~(disk1.img|disk.img)' ] @@ -101,7 +101,7 @@ applications: channel: yoga/edge octavia-diskimage-retrofit: - charm: ../../../octavia-diskimage-retrofit.charm + charm: ../../../octavia-diskimage-retrofit_ubuntu-20.04-amd64.charm options: retrofit-series: focal diff --git a/src/tests/bundles/focal-yoga.yaml b/src/tests/bundles/focal-yoga.yaml index b70ad38..ef3dd5a 100644 --- a/src/tests/bundles/focal-yoga.yaml +++ b/src/tests/bundles/focal-yoga.yaml @@ -30,14 +30,14 @@ applications: - '0' - '1' - '2' - channel: 8.0.19/edge + channel: 8.0/edge keystone-mysql-router: charm: ch:mysql-router - channel: 8.0.19/edge + channel: 8.0/edge glance-mysql-router: charm: ch:mysql-router - channel: 8.0.19/edge + channel: 8.0/edge keystone: charm: ch:keystone @@ -68,7 +68,7 @@ applications: path: 'streams/v1/index.sjson', max: 1, item_filters: [ - 'release~(xenial|bionic|focal)', + 'release~(focal)', 'arch~(x86_64|amd64)', 'ftype~(disk1.img|disk.img)' ] @@ -101,7 +101,7 @@ applications: channel: yoga/edge octavia-diskimage-retrofit: - charm: ../../../octavia-diskimage-retrofit.charm + charm: ../../../octavia-diskimage-retrofit_ubuntu-20.04-amd64.charm options: retrofit-series: focal diff --git a/src/tests/bundles/impish-xena.yaml b/src/tests/bundles/impish-xena.yaml deleted file mode 100644 index 7855ed2..0000000 --- a/src/tests/bundles/impish-xena.yaml +++ /dev/null @@ -1,130 +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': - -applications: - - mysql-innodb-cluster: - constraints: mem=3072M - charm: ch:mysql-innodb-cluster - num_units: 3 - options: - source: *openstack-origin - to: - - '0' - - '1' - - '2' - channel: 8.0.19/edge - - keystone-mysql-router: - charm: ch:mysql-router - channel: 8.0.19/edge - glance-mysql-router: - charm: ch:mysql-router - channel: 8.0.19/edge - - keystone: - charm: ch:keystone - num_units: 1 - options: - openstack-origin: *openstack-origin - to: - - '3' - channel: yoga/edge - - glance: - charm: ch:glance - num_units: 1 - options: - openstack-origin: *openstack-origin - to: - - '4' - channel: yoga/edge - - glance-simplestreams-sync: - charm: ch:glance-simplestreams-sync - num_units: 1 - options: - source: ppa:simplestreams-dev/trunk - use_swift: False - mirror_list: "[{url: 'http://cloud-images.ubuntu.com/daily/', - name_prefix: 'ubuntu:released', - path: 'streams/v1/index.sjson', - max: 1, - item_filters: [ - 'release~(xenial|bionic|focal)', - 'arch~(x86_64|amd64)', - 'ftype~(disk1.img|disk.img)' - ] - }]" - # NOTE(coreycb): Drop minimal mirror until https://pad.lv/1933966 - # is fixed. - # - # mirror_list: "[{url: 'http://cloud-images.ubuntu.com/daily/', - # name_prefix: 'ubuntu:released', - # path: 'streams/v1/index.sjson', - # max: 1, - # item_filters: [ - # 'release~(xenial|bionic|focal)', - # 'arch~(x86_64|amd64)', - # 'ftype~(disk1.img|disk.img)' - # ] - # }, - # {url: 'http://cloud-images.ubuntu.com/minimal/daily/', - # name_prefix: 'ubuntu:released', - # path: 'streams/v1/index.sjson', - # max: 1, - # item_filters: [ - # 'release~(xenial|bionic|focal)', - # 'arch~(x86_64|amd64)', - # 'ftype~(disk1.img|disk.img)' - # ] - # }]" - to: - - '5' - channel: yoga/edge - - octavia-diskimage-retrofit: - charm: ../../../octavia-diskimage-retrofit.charm - options: - retrofit-series: focal - -relations: - - - - 'glance-simplestreams-sync:juju-info' - - 'octavia-diskimage-retrofit:juju-info' - - - - 'keystone-mysql-router:shared-db' - - 'keystone:shared-db' - - - 'keystone-mysql-router:db-router' - - 'mysql-innodb-cluster:db-router' - - - - 'glance-mysql-router:shared-db' - - 'glance:shared-db' - - - 'glance-mysql-router:db-router' - - 'mysql-innodb-cluster:db-router' - - - - 'keystone:identity-service' - - 'glance:identity-service' - - - - 'keystone:identity-service' - - 'glance-simplestreams-sync:identity-service' - - - - 'keystone:identity-credentials' - - 'octavia-diskimage-retrofit:identity-credentials' diff --git a/src/tests/bundles/jammy-yoga.yaml b/src/tests/bundles/jammy-yoga.yaml index 4568418..946592b 100644 --- a/src/tests/bundles/jammy-yoga.yaml +++ b/src/tests/bundles/jammy-yoga.yaml @@ -68,7 +68,7 @@ applications: path: 'streams/v1/index.sjson', max: 1, item_filters: [ - 'release~(xenial|bionic|focal)', + 'release~(focal|jammy)', 'arch~(x86_64|amd64)', 'ftype~(disk1.img|disk.img)' ] @@ -101,9 +101,9 @@ applications: channel: yoga/edge octavia-diskimage-retrofit: - charm: ../../../octavia-diskimage-retrofit.charm + charm: ../../../octavia-diskimage-retrofit_ubuntu-22.04-amd64.charm options: - retrofit-series: focal + retrofit-series: jammy relations: diff --git a/src/wheelhouse.txt b/src/wheelhouse.txt index 8842706..bd4a08e 100644 --- a/src/wheelhouse.txt +++ b/src/wheelhouse.txt @@ -1,21 +1,6 @@ +# Charm dependencies keystoneauth1 python-glanceclient -poetry-core - -# Pin pyrsistent<0.18.0 as later versions require setuptools >= 42.0.0 -pyrsistent<0.18.0 -# python-zipp 2.x introduces a requirement for setuptools 42.x which is not available. -# resolve conflict: -# layer-basic requires setuptools<42, zipp>=2.0.0 requires setuptools>42 -# LP: #1862186 -zipp < 2.0.0 -# cryptography 3.4 introduces a requirement for rust code in the module. As it has to be compiled -# on the machine during install, this breaks installs. Instead pin to <3.4 until a solution can be -# found that doesn't require compiling on the target machine. -# LP: #1915171 -cryptography<3.4 - -setuptools < 50.0 git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack diff --git a/tox.ini b/tox.ini index e22fe48..74ee3a4 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 -o {toxinidir}/build/builds src {posargs} [testenv:add-build-lock-file] basepython = python3