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: parts:
charm: charm:
source: src/
plugin: reactive
reactive-charm-build-arguments:
- --binary-wheels-from-source
- -v
build-packages: build-packages:
- tox
- git - git
- python3-dev - python3-dev
- libffi-dev - libffi-dev
- libssl-dev - libssl-dev
- rustc - rustc
- cargo - cargo
build-snaps:
- charm
build-environment: build-environment:
- CHARM_INTERFACES_DIR: $CRAFT_PROJECT_DIR/interfaces/
- CHARM_LAYERS_DIR: $CRAFT_PROJECT_DIR/layers/
- MAKEFLAGS: -j$(nproc) - 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: bases:
- name: ubuntu - build-on:
channel: "20.04" - name: ubuntu
architectures: [amd64] channel: "22.04"
- name: ubuntu architectures: [amd64]
channel: "20.04" run-on:
architectures: [arm64] - name: ubuntu
- name: ubuntu channel: "22.04"
channel: "20.04" architectures: [amd64]
architectures: [ppc64el] - name: ubuntu
- name: ubuntu channel: "22.10"
channel: "20.04" architectures: [amd64]
architectures: [s390x] - build-on:
- name: ubuntu - name: ubuntu
channel: "22.04" channel: "22.04"
architectures: [amd64] architectures: [arm64]
- name: ubuntu run-on:
channel: "22.04" - name: ubuntu
architectures: [arm64] channel: "22.04"
- name: ubuntu architectures: [arm64]
channel: "22.04" - name: ubuntu
architectures: [ppc64el] channel: "22.10"
- name: ubuntu architectures: [arm64]
channel: "22.04" - build-on:
architectures: [s390x] - 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 needs_charm_build: true
charm_build_name: ovn-dedicated-chassis charm_build_name: ovn-dedicated-chassis
build_type: charmcraft build_type: charmcraft
charmcraft_channel: 2.0/stable charmcraft_channel: 2.1/stable

View File

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

View File

@ -20,7 +20,7 @@ applications:
channel: latest/edge channel: latest/edge
ovn-dedicated-chassis: 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 num_units: 2
options: options:
source: *openstack-origin source: *openstack-origin

View File

@ -22,7 +22,7 @@ applications:
channel: latest/edge channel: latest/edge
ovn-dedicated-chassis: 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 num_units: 2
options: options:
source: *openstack-origin source: *openstack-origin

View File

@ -22,7 +22,7 @@ applications:
channel: latest/edge channel: latest/edge
ovn-dedicated-chassis: 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 num_units: 2
options: options:
source: *openstack-origin source: *openstack-origin

10
tox.ini
View File

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