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: I0f9797f5efb3716b788e4884cd271d0827c6f10a
This commit is contained in:
Corey Bryant 2022-09-20 18:12:25 +00:00
parent ac21d9c754
commit 5f83927575
5 changed files with 62 additions and 26 deletions

View File

@ -2,24 +2,72 @@ type: charm
parts:
charm:
source: src/
plugin: reactive
build-snaps:
- charm
build-packages:
- tox
- git
- python3-dev
- libffi-dev
- libssl-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: $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 src
ln -sf ../hooks/start src/charm.py
bases:
- 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]
- build-on:
- name: ubuntu
channel: "22.04"
architectures:
- amd64
architectures: [amd64]
run-on:
- name: ubuntu
channel: "22.10"
architectures: [amd64]
- build-on:
- name: ubuntu
channel: "22.04"
architectures: [amd64, s390x, ppc64el, arm64]
architectures: [arm64]
run-on:
- name: ubuntu
channel: "22.10"
architectures: [amd64, s390x, ppc64el, arm64]
architectures: [arm64]
- build-on:
- name: ubuntu
channel: "22.04"
architectures: [ppc64el]
run-on:
- name: ubuntu
channel: "22.10"
architectures: [ppc64el]
- build-on:
- name: ubuntu
channel: "22.04"
architectures: [s390x]
run-on:
- name: ubuntu
channel: "22.10"
architectures: [s390x]

View File

@ -74,7 +74,7 @@ applications:
- '5'
channel: latest/edge
cinder-lvm:
charm: ../../../cinder-lvm.charm
charm: ../../../cinder-lvm_ubuntu-22.04-amd64.charm
options:
block-device: '/tmp/vol1|4G'
alias: zaza-lvm

View File

@ -75,7 +75,7 @@ applications:
- '5'
channel: latest/edge
cinder-lvm:
charm: ../../../cinder-lvm.charm
charm: ../../../cinder-lvm_ubuntu-22.04-amd64.charm
options:
block-device: '/tmp/vol1|4G'
alias: zaza-lvm

View File

@ -74,7 +74,7 @@ applications:
- '5'
channel: latest/edge
cinder-lvm:
charm: ../../../cinder-lvm.charm
charm: ../../../cinder-lvm_ubuntu-22.10-amd64.charm
options:
block-device: '/tmp/vol1|4G'
alias: zaza-lvm

18
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
@ -33,13 +21,14 @@ setenv = VIRTUAL_ENV={envdir}
TERM=linux
JUJU_REPOSITORY={toxinidir}/build
passenv = no_proxy http_proxy https_proxy JUJU_REPOSITORY
# We can stop using pip.sh when charmcraft snap includes new version of git:
# https://github.com/canonical/charmcraft/issues/875
install_command =
{toxinidir}/pip.sh install {opts} {packages}
allowlist_externals =
charmcraft
bash
tox
rename.sh
deps =
-r{toxinidir}/requirements.txt
@ -49,12 +38,11 @@ deps = -r{toxinidir}/build-requirements.txt
commands =
charmcraft clean
charmcraft -v pack
{toxinidir}/rename.sh
[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