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: I1bf4aac08cf7388fec4550d40887a8df45927589
This commit is contained in:
parent
1dc253a098
commit
66c5f42350
|
@ -2,24 +2,76 @@ 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: "22.04"
|
||||
architectures:
|
||||
- amd64
|
||||
architectures: [amd64]
|
||||
run-on:
|
||||
- name: ubuntu
|
||||
channel: "22.04"
|
||||
architectures: [amd64, s390x, ppc64el, arm64]
|
||||
architectures: [amd64]
|
||||
- name: ubuntu
|
||||
channel: "22.10"
|
||||
architectures: [amd64, s390x, ppc64el, arm64]
|
||||
architectures: [amd64]
|
||||
- build-on:
|
||||
- name: ubuntu
|
||||
channel: "22.04"
|
||||
architectures: [arm64]
|
||||
run-on:
|
||||
- name: ubuntu
|
||||
channel: "22.04"
|
||||
architectures: [arm64]
|
||||
- name: ubuntu
|
||||
channel: "22.10"
|
||||
architectures: [arm64]
|
||||
- build-on:
|
||||
- name: ubuntu
|
||||
channel: "22.04"
|
||||
architectures: [ppc64el]
|
||||
run-on:
|
||||
- name: ubuntu
|
||||
channel: "22.04"
|
||||
architectures: [ppc64el]
|
||||
- name: ubuntu
|
||||
channel: "22.10"
|
||||
architectures: [ppc64el]
|
||||
- build-on:
|
||||
- name: ubuntu
|
||||
channel: "22.04"
|
||||
architectures: [s390x]
|
||||
run-on:
|
||||
- name: ubuntu
|
||||
channel: "22.04"
|
||||
architectures: [s390x]
|
||||
- name: ubuntu
|
||||
channel: "22.10"
|
||||
architectures: [s390x]
|
||||
|
|
|
@ -90,7 +90,7 @@ applications:
|
|||
- '7'
|
||||
|
||||
designate:
|
||||
charm: ../../../designate.charm
|
||||
charm: ../../../designate_ubuntu-22.04-amd64_ubuntu-22.10-amd64.charm
|
||||
num_units: 1
|
||||
options:
|
||||
nameservers: 'ns1.amuletexample.com. ns2.amuletexample.com.'
|
||||
|
|
|
@ -90,7 +90,7 @@ applications:
|
|||
- '7'
|
||||
|
||||
designate:
|
||||
charm: ../../../designate.charm
|
||||
charm: ../../../designate_ubuntu-22.04-amd64_ubuntu-22.10-amd64.charm
|
||||
num_units: 1
|
||||
options:
|
||||
nameservers: 'ns1.amuletexample.com. ns2.amuletexample.com.'
|
||||
|
|
|
@ -90,7 +90,7 @@ applications:
|
|||
- '7'
|
||||
|
||||
designate:
|
||||
charm: ../../../designate.charm
|
||||
charm: ../../../designate_ubuntu-22.04-amd64_ubuntu-22.10-amd64.charm
|
||||
num_units: 1
|
||||
options:
|
||||
nameservers: 'ns1.amuletexample.com. ns2.amuletexample.com.'
|
||||
|
|
18
tox.ini
18
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
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue