From 8e47acd497409675073134b4d38f44d9c8defb17 Mon Sep 17 00:00:00 2001 From: Frode Nordahl Date: Tue, 11 Oct 2022 18:27:10 +0200 Subject: [PATCH] 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 --- charmcraft.yaml | 93 +++++++++++++++++------------- osci.yaml | 2 +- src/metadata.yaml | 1 + src/tests/bundles/jammy-yoga.yaml | 2 +- src/tests/bundles/jammy-zed.yaml | 2 +- src/tests/bundles/kinetic-zed.yaml | 2 +- tox.ini | 10 +--- 7 files changed, 59 insertions(+), 53 deletions(-) diff --git a/charmcraft.yaml b/charmcraft.yaml index 96e96a2..2bbe451 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -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] diff --git a/osci.yaml b/osci.yaml index ed96823..5e49d37 100644 --- a/osci.yaml +++ b/osci.yaml @@ -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 diff --git a/src/metadata.yaml b/src/metadata.yaml index 4e971b2..b7cd6c6 100644 --- a/src/metadata.yaml +++ b/src/metadata.yaml @@ -8,6 +8,7 @@ tags: - networking series: - jammy +- kinetic subordinate: false extra-bindings: data: diff --git a/src/tests/bundles/jammy-yoga.yaml b/src/tests/bundles/jammy-yoga.yaml index a64acca..c504a98 100644 --- a/src/tests/bundles/jammy-yoga.yaml +++ b/src/tests/bundles/jammy-yoga.yaml @@ -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 diff --git a/src/tests/bundles/jammy-zed.yaml b/src/tests/bundles/jammy-zed.yaml index 4d0b6f8..5ad92ef 100644 --- a/src/tests/bundles/jammy-zed.yaml +++ b/src/tests/bundles/jammy-zed.yaml @@ -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 diff --git a/src/tests/bundles/kinetic-zed.yaml b/src/tests/bundles/kinetic-zed.yaml index fc4e3d2..e5a3fd4 100644 --- a/src/tests/bundles/kinetic-zed.yaml +++ b/src/tests/bundles/kinetic-zed.yaml @@ -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 diff --git a/tox.ini b/tox.ini index 6df34e5..aad4c8c 100644 --- a/tox.ini +++ b/tox.ini @@ -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 =