Use charmcraft reactive plugin for build

Charmcraft 2.1 provides the required functionality to build the
charm using the reactive plugin.

Add missing `kinetic` series in src/metadata.yaml.

Drop the `build-rective` target, old charm-tools environment
variables and redundant minversion in tox.ini.

Fixup the bases configuration and make associated changes to test
bundles.

Change-Id: I559e49ab80ca6de8b42192e1b961448a4522ce86
This commit is contained in:
Frode Nordahl 2022-10-11 18:27:10 +02:00
parent 3c061a754e
commit 8e47acd497
No known key found for this signature in database
GPG Key ID: 6A5D59A3BA48373F
7 changed files with 59 additions and 53 deletions

View File

@ -2,54 +2,67 @@ type: charm
parts:
charm:
source: src/
plugin: reactive
reactive-charm-build-arguments:
- --binary-wheels-from-source
- -v
build-packages:
- tox
- git
- python3-dev
- libffi-dev
- libssl-dev
- rustc
- cargo
build-snaps:
- charm
build-environment:
- CHARM_INTERFACES_DIR: $CRAFT_PROJECT_DIR/interfaces/
- CHARM_LAYERS_DIR: $CRAFT_PROJECT_DIR/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:
- 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]
- build-on:
- name: ubuntu
channel: "22.04"
architectures: [amd64]
run-on:
- name: ubuntu
channel: "22.04"
architectures: [amd64]
- name: ubuntu
channel: "22.10"
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]

View File

@ -6,4 +6,4 @@
needs_charm_build: true
charm_build_name: ovn-dedicated-chassis
build_type: charmcraft
charmcraft_channel: 2.0/stable
charmcraft_channel: 2.1/stable

View File

@ -8,6 +8,7 @@ tags:
- networking
series:
- jammy
- kinetic
subordinate: false
extra-bindings:
data:

View File

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

View File

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

View File

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

10
tox.ini
View File

@ -12,15 +12,12 @@ sitepackages = False
# NOTE: Avoid false positives by not skipping missing interpreters.
skip_missing_interpreters = False
# NOTE: https://wiki.canonical.com/engineering/OpenStack/InstallLatestToxOnOsci
minversion = 3.18.0
[testenv]
setenv = VIRTUAL_ENV={envdir}
PYTHONHASHSEED=0
TERM=linux
JUJU_REPOSITORY={toxinidir}/build
passenv = no_proxy http_proxy https_proxy JUJU_REPOSITORY
passenv = no_proxy http_proxy https_proxy
install_command =
{toxinidir}/pip.sh install {opts} {packages}
allowlist_externals =
@ -37,11 +34,6 @@ commands =
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
commands =