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: I99549065a4ef7c2d76356228a58b687d7cb8877c
This commit is contained in:
Corey Bryant 2022-10-04 16:47:19 -04:00
parent 9f3a527cdb
commit 0eced95520
10 changed files with 92 additions and 181 deletions

4
bindep.txt Normal file
View File

@ -0,0 +1,4 @@
libffi-dev [platform:dpkg]
libpq-dev [platform:dpkg]
libxml2-dev [platform:dpkg]
libxslt1-dev [platform:dpkg]

7
build-requirements.txt Normal file
View File

@ -0,0 +1,7 @@
# 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.

View File

@ -2,20 +2,56 @@ type: charm
parts:
charm:
source: src/
plugin: reactive
build-snaps: [charm]
build-packages:
- tox
- git
- python3-dev
- libffi-dev
- libssl-dev
- rustc
- cargo
build-environment:
- CHARM_INTERFACES_DIR: /root/project/interfaces/
- CHARM_LAYERS_DIR: /root/project/layers/
- MAKEFLAGS: -j$(nproc)
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.
mkdir -p src
touch src/charm.py
chmod +x src/charm.py
bases:
- build-on:
- name: ubuntu
channel: "20.04"
architectures:
- amd64
run-on:
- name: ubuntu
channel: "20.04"
architectures: [amd64, s390x, ppc64el, arm64]
- name: ubuntu
channel: "22.04"
architectures: [amd64, s390x, ppc64el, arm64]
- name: ubuntu
channel: "20.04"
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]

View File

@ -7,3 +7,5 @@
vars:
needs_charm_build: true
charm_build_name: octavia-dashboard
build_type: charmcraft
charmcraft_channel: 2.0/stable

View File

@ -98,7 +98,7 @@ applications:
channel: latest/edge
octavia-dashboard:
charm: ../../../octavia-dashboard
charm: ../../../octavia-dashboard_ubuntu-20.04-amd64.charm
relations:

View File

@ -98,7 +98,7 @@ applications:
channel: latest/edge
octavia-dashboard:
charm: ../../../octavia-dashboard
charm: ../../../octavia-dashboard_ubuntu-20.04-amd64.charm
relations:

View File

@ -1,147 +0,0 @@
variables:
openstack-origin: &openstack-origin distro
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':
'6':
'7':
applications:
keystone-mysql-router:
charm: ch:mysql-router
channel: latest/edge
neutron-api-mysql-router:
charm: ch:mysql-router
channel: latest/edge
octavia-mysql-router:
charm: ch:mysql-router
channel: latest/edge
openstack-dashboard-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
rabbitmq-server:
charm: ch:rabbitmq-server
num_units: 1
options:
source: *openstack-origin
to:
- '4'
channel: latest/edge
neutron-api:
charm: ch:neutron-api
num_units: 1
options:
manage-neutron-plugin-legacy-mode: true
neutron-plugin: ovs
neutron-security-groups: True
openstack-origin: *openstack-origin
to:
- '5'
channel: latest/edge
neutron-openvswitch:
charm: ch:neutron-openvswitch
num_units: 0
channel: latest/edge
octavia:
charm: ch:octavia
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '6'
channel: latest/edge
openstack-dashboard:
charm: ch:openstack-dashboard
num_units: 1
options:
openstack-origin: *openstack-origin
to:
- '7'
channel: latest/edge
octavia-dashboard:
charm: ../../../octavia-dashboard
relations:
- - 'keystone:shared-db'
- 'keystone-mysql-router:shared-db'
- - 'keystone-mysql-router:db-router'
- 'mysql-innodb-cluster:db-router'
- - 'neutron-api:shared-db'
- 'neutron-api-mysql-router:shared-db'
- - 'neutron-api-mysql-router:db-router'
- 'mysql-innodb-cluster:db-router'
- - 'octavia:shared-db'
- 'octavia-mysql-router:shared-db'
- - 'octavia-mysql-router:db-router'
- 'mysql-innodb-cluster:db-router'
- - 'openstack-dashboard:shared-db'
- 'openstack-dashboard-mysql-router:shared-db'
- - 'openstack-dashboard-mysql-router:db-router'
- 'mysql-innodb-cluster:db-router'
- - 'keystone:identity-service'
- 'neutron-api:identity-service'
- - 'keystone:identity-service'
- 'octavia:identity-service'
- - 'keystone:identity-service'
- 'openstack-dashboard:identity-service'
- - 'rabbitmq-server:amqp'
- 'neutron-api:amqp'
- - 'rabbitmq-server:amqp'
- 'octavia:amqp'
- - 'rabbitmq-server:amqp'
- 'neutron-openvswitch:amqp'
- - 'neutron-openvswitch:neutron-plugin'
- 'octavia:neutron-openvswitch'
- - 'openstack-dashboard:dashboard-plugin'
- 'octavia-dashboard:dashboard'

View File

@ -98,7 +98,7 @@ applications:
channel: latest/edge
octavia-dashboard:
charm: ../../../octavia-dashboard
charm: ../../../octavia-dashboard_ubuntu-22.04-amd64.charm
relations:

View File

@ -2,7 +2,6 @@ charm_name: octavia-dashboard
gate_bundles:
- focal-xena
- impish-xena
smoke_bundles:
- focal-xena
@ -26,5 +25,4 @@ tests:
tests_options:
force_deploy:
- impish-xena
- jammy-yoga

39
tox.ini
View File

@ -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
@ -37,13 +25,24 @@ setenv = VIRTUAL_ENV={envdir}
passenv = http_proxy https_proxy INTERFACE_PATH LAYER_PATH JUJU_REPOSITORY
install_command =
{toxinidir}/pip.sh install {opts} {packages}
allowlist_externals =
charmcraft
bash
tox
deps =
-r{toxinidir}/requirements.txt
[testenv:build]
basepython = python3
deps = -r{toxinidir}/build-requirements.txt
commands =
charm-build --log-level DEBUG --use-lock-file-branches -o {toxinidir}/build/builds src {posargs}
charmcraft clean
charmcraft -v pack
[testenv:build-reactive]
basepython = python3
commands =
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
@ -78,9 +77,21 @@ 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