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.

Change-Id: Ibfe317d1056e44baa32c414d33f54d656887d2a1
This commit is contained in:
Dmitrii Shcherbakov 2022-09-15 16:09:31 +03:00
parent 2ea68bb50d
commit f7a4a460ad
8 changed files with 50 additions and 63 deletions

View File

@ -6,28 +6,44 @@ parts:
- tox
- git
- python3-dev
- libffi-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/
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
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

@ -1,10 +1,11 @@
- project:
templates:
- charm-unit-jobs-py38
- charm-unit-jobs-py310
- charm-unit-jobs-py310
- charm-xena-functional-jobs
- charm-yoga-functional-jobs
vars:
needs_charm_build: true
charm_build_name: ovn-dedicated-chassis
build_type: charmcraft
charmcraft_channel: 2.0/stable

View File

@ -3,14 +3,18 @@
# 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
# Build requirements
cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35.
charm-tools==2.8.3
# 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
git+https://github.com/juju/charm-tools.git
simplejson

View File

@ -56,11 +56,8 @@ applications:
- '6'
channel: latest/edge
nrpe:
charm: cs:nrpe
ovn-dedicated-chassis:
charm: ../../../ovn-dedicated-chassis.charm
charm: ../../../ovn-dedicated-chassis_ubuntu-20.04-amd64.charm
num_units: 2
options:
source: *openstack-origin
@ -80,5 +77,3 @@ relations:
- 'ovn-central:ovsdb'
- - 'ovn-dedicated-chassis:certificates'
- 'vault:certificates'
- - 'ovn-dedicated-chassis:nrpe-external-master'
- 'nrpe:nrpe-external-master'

View File

@ -56,11 +56,8 @@ applications:
- '6'
channel: latest/edge
nrpe:
charm: cs:nrpe
ovn-dedicated-chassis:
charm: ../../../ovn-dedicated-chassis.charm
charm: ../../../ovn-dedicated-chassis_ubuntu-20.04-amd64.charm
num_units: 2
options:
source: *openstack-origin
@ -80,5 +77,3 @@ relations:
- 'ovn-central:ovsdb'
- - 'ovn-dedicated-chassis:certificates'
- 'vault:certificates'
- - 'ovn-dedicated-chassis:nrpe-external-master'
- 'nrpe:nrpe-external-master'

View File

@ -57,7 +57,7 @@ applications:
channel: latest/edge
ovn-dedicated-chassis:
charm: ../../../ovn-dedicated-chassis.charm
charm: ../../../ovn-dedicated-chassis_ubuntu-22.04-amd64.charm
num_units: 2
options:
source: *openstack-origin

View File

@ -20,9 +20,6 @@ target_deploy_status:
vault:
workload-status: blocked
workload-status-message-prefix: Vault needs to be initialized
nrpe:
workload-status: blocked
workload-status-message-prefix: "Nagios server not configured or related"
configure:
- zaza.openstack.charm_tests.vault.setup.auto_initialize_no_validation

29
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
@ -31,17 +19,14 @@ minversion = 3.18.0
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
TERM=linux
LAYER_PATH={toxinidir}/layers
INTERFACE_PATH={toxinidir}/interfaces
JUJU_REPOSITORY={toxinidir}/build
passenv = http_proxy https_proxy INTERFACE_PATH LAYER_PATH JUJU_REPOSITORY
passenv = no_proxy http_proxy https_proxy INTERFACE_PATH LAYER_PATH JUJU_REPOSITORY
install_command =
{toxinidir}/pip.sh install {opts} {packages}
allowlist_externals =
charmcraft
bash
tox
rename.sh
deps =
-r{toxinidir}/requirements.txt
@ -50,13 +35,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
@ -93,15 +77,10 @@ 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
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]