Update to build using charmcraft

Due to a build problem with the reactive plugin, this change falls back
on overriding the steps and doing a manual build, but it also ensures
the CI system builds the charm using charmcraft.  Changes:

- add a build-requirements.txt
- modify charmcraft.yaml
- modify osci.yaml
    -> indicate build with charmcraft
- modify tox.ini
    -> tox -e build does charmcraft build/rename
    -> tox -e build-reactive does the reactive build
- modify bundles to use the <charm>.charm artifact in tests.
  and fix deprecation warning re: prefix
- tox inception to enable tox -e func-test in the CI

This change also re-enables the gate for Xena.

Depends-On: https://review.opendev.org/c/openstack/charm-manila-ganesha/+/831057
Change-Id: Icd7c0a6d1c4c71d28f8bf9a2d8b6a18ec58b8e4e
This commit is contained in:
Alex Kavanagh 2022-02-01 20:28:05 +00:00 committed by Corey Bryant
parent 496bfd569b
commit a7c68e591e
11 changed files with 132 additions and 67 deletions

7
build-requirements.txt Normal file
View File

@ -0,0 +1,7 @@
# NOTES(lourot):
# * We don't install charmcraft via pip anymore because it anyway spins up a
# container and scp the system's charmcraft snap inside it. So the charmcraft
# snap is necessary on the system anyway.
# * `tox -e build` successfully validated with charmcraft 1.2.1
cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35.

View File

@ -2,9 +2,21 @@ type: charm
parts:
charm:
source: src/
plugin: reactive
build-snaps: [charm]
build-packages:
- tox
- git
- python3-dev
override-build: |
apt-get install ca-certificates -y
tox -e build-reactive
override-stage: |
echo "Copying charm to staging area: $CHARMCRAFT_STAGE"
NAME=$(ls $CHARMCRAFT_PART_BUILD/build/builds)
cp -r $CHARMCRAFT_PART_BUILD/build/builds/$NAME/* $CHARMCRAFT_STAGE/
override-prime: |
# For some reason, the normal priming chokes on the fact that there's a
# hooks directory.
cp -r $CHARMCRAFT_STAGE/* .
bases:
- name: ubuntu

View File

@ -3,18 +3,9 @@
- charm-unit-jobs-py38
- charm-unit-jobs-py39
- charm-yoga-functional-jobs
# Non-voting due to:
# https://bugs.launchpad.net/charm-manila-ganesha/+bug/1952763
# - charm-xena-functional-jobs
# - charm-wallaby-functional-jobs
check:
jobs:
# Non-voting due to:
# https://bugs.launchpad.net/charm-manila-ganesha/+bug/1952763
- focal-xena:
voting: false
- impish-xena:
voting: false
- charm-xena-functional-jobs
- charm-yoga-functional-jobs
vars:
needs_charm_build: true
charm_build_name: manila-ganesha
build_type: charmcraft

13
rename.sh Executable file
View File

@ -0,0 +1,13 @@
#!/bin/bash
charm=$(grep "charm_build_name" osci.yaml | awk '{print $2}')
echo "renaming ${charm}_*.charm to ${charm}.charm"
echo -n "pwd: "
pwd
ls -al
echo "Removing bad downloaded charm maybe?"
if [[ -e "${charm}.charm" ]];
then
rm "${charm}.charm"
fi
echo "Renaming charm here."
mv ${charm}_*.charm ${charm}.charm

View File

@ -4,6 +4,9 @@
# https://github.com/openstack-charmers/release-tools
#
# Need tox to be available from tox... inception yes, but its a workaround for now
tox
# Functional Test Requirements (let Zaza's dependencies solve all dependencies here!)
git+https://github.com/openstack-charmers/zaza.git#egg=zaza
git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack

View File

@ -1,6 +1,8 @@
variables:
openstack-origin: &openstack-origin cloud:focal-xena
local_overlay_enabled: True
series: focal
comment:
@ -73,7 +75,7 @@ services:
manila-ganesha-az1:
num_units: 3
charm: ../../../manila-ganesha
charm: ../../../manila-ganesha.charm
options:
openstack-origin: *openstack-origin
to:
@ -90,7 +92,7 @@ services:
- '6'
- '7'
- '8'
channel: latest/edge
channel: quincy/edge
ceph-osd:
charm: ch:ceph-osd
@ -103,7 +105,7 @@ services:
- '9'
- '10'
- '11'
channel: latest/edge
channel: quincy/edge
ceph-fs:
charm: ch:ceph-fs
@ -113,7 +115,7 @@ services:
to:
- '12'
- '13'
channel: latest/edge
channel: quincy/edge
manila:
charm: ch:manila
@ -124,7 +126,7 @@ services:
openstack-origin: *openstack-origin
to:
- '14'
channel: latest/edge
channel: yoga/edge
nova-cloud-controller:
charm: ch:nova-cloud-controller
@ -134,7 +136,7 @@ services:
openstack-origin: *openstack-origin
to:
- '15'
channel: latest/edge
channel: yoga/edge
placement:
charm: ch:placement
@ -143,7 +145,7 @@ services:
openstack-origin: *openstack-origin
to:
- '16'
channel: latest/edge
channel: yoga/edge
nova-compute:
charm: ch:nova-compute
@ -157,7 +159,7 @@ services:
to:
- '17'
- '18'
channel: latest/edge
channel: yoga/edge
glance:
charm: ch:glance
@ -166,7 +168,7 @@ services:
openstack-origin: *openstack-origin
to:
- '19'
channel: latest/edge
channel: yoga/edge
neutron-api:
charm: ch:neutron-api
@ -179,11 +181,11 @@ services:
openstack-origin: *openstack-origin
to:
- '20'
channel: latest/edge
channel: yoga/edge
neutron-openvswitch:
charm: ch:neutron-openvswitch
channel: latest/edge
channel: yoga/edge
neutron-gateway:
charm: ch:neutron-gateway
@ -193,7 +195,7 @@ services:
openstack-origin: *openstack-origin
to:
- '21'
channel: latest/edge
channel: yoga/edge
rabbitmq-server:
charm: ch:rabbitmq-server
@ -211,7 +213,7 @@ services:
openstack-origin: *openstack-origin
to:
- '23'
channel: latest/edge
channel: yoga/edge
relations:

View File

@ -1,6 +1,8 @@
variables:
openstack-origin: &openstack-origin cloud:focal-yoga
local_overlay_enabled: True
series: focal
comment:
@ -73,7 +75,7 @@ services:
manila-ganesha-az1:
num_units: 3
charm: ../../../manila-ganesha
charm: ../../../manila-ganesha.charm
options:
openstack-origin: *openstack-origin
to:
@ -90,7 +92,7 @@ services:
- '6'
- '7'
- '8'
channel: latest/edge
channel: quincy/edge
ceph-osd:
charm: ch:ceph-osd
@ -103,7 +105,7 @@ services:
- '9'
- '10'
- '11'
channel: latest/edge
channel: quincy/edge
ceph-fs:
charm: ch:ceph-fs
@ -113,7 +115,7 @@ services:
to:
- '12'
- '13'
channel: latest/edge
channel: quincy/edge
manila:
charm: ch:manila
@ -124,7 +126,7 @@ services:
openstack-origin: *openstack-origin
to:
- '14'
channel: latest/edge
channel: yoga/edge
nova-cloud-controller:
charm: ch:nova-cloud-controller
@ -134,7 +136,7 @@ services:
openstack-origin: *openstack-origin
to:
- '15'
channel: latest/edge
channel: yoga/edge
placement:
charm: ch:placement
@ -143,7 +145,7 @@ services:
openstack-origin: *openstack-origin
to:
- '16'
channel: latest/edge
channel: yoga/edge
nova-compute:
charm: ch:nova-compute
@ -157,7 +159,7 @@ services:
to:
- '17'
- '18'
channel: latest/edge
channel: yoga/edge
glance:
charm: ch:glance
@ -166,7 +168,7 @@ services:
openstack-origin: *openstack-origin
to:
- '19'
channel: latest/edge
channel: yoga/edge
neutron-api:
charm: ch:neutron-api
@ -179,11 +181,11 @@ services:
openstack-origin: *openstack-origin
to:
- '20'
channel: latest/edge
channel: yoga/edge
neutron-openvswitch:
charm: ch:neutron-openvswitch
channel: latest/edge
channel: yoga/edge
neutron-gateway:
charm: ch:neutron-gateway
@ -193,7 +195,7 @@ services:
openstack-origin: *openstack-origin
to:
- '21'
channel: latest/edge
channel: yoga/edge
rabbitmq-server:
charm: ch:rabbitmq-server
@ -211,7 +213,7 @@ services:
openstack-origin: *openstack-origin
to:
- '23'
channel: latest/edge
channel: yoga/edge
relations:

View File

@ -1,6 +1,8 @@
variables:
openstack-origin: &openstack-origin distro
local_overlay_enabled: True
series: impish
comment:
@ -73,7 +75,7 @@ services:
manila-ganesha-az1:
num_units: 3
charm: ../../../manila-ganesha
charm: ../../../manila-ganesha.charm
options:
openstack-origin: *openstack-origin
to:
@ -90,7 +92,7 @@ services:
- '6'
- '7'
- '8'
channel: latest/edge
channel: quincy/edge
ceph-osd:
charm: ch:ceph-osd
@ -103,7 +105,7 @@ services:
- '9'
- '10'
- '11'
channel: latest/edge
channel: quincy/edge
ceph-fs:
charm: ch:ceph-fs
@ -113,7 +115,7 @@ services:
to:
- '12'
- '13'
channel: latest/edge
channel: quincy/edge
manila:
charm: ch:manila
@ -124,7 +126,7 @@ services:
openstack-origin: *openstack-origin
to:
- '14'
channel: latest/edge
channel: yoga/edge
nova-cloud-controller:
charm: ch:nova-cloud-controller
@ -134,7 +136,7 @@ services:
openstack-origin: *openstack-origin
to:
- '15'
channel: latest/edge
channel: yoga/edge
placement:
charm: ch:placement
@ -143,7 +145,7 @@ services:
openstack-origin: *openstack-origin
to:
- '16'
channel: latest/edge
channel: yoga/edge
nova-compute:
charm: ch:nova-compute
@ -157,7 +159,7 @@ services:
to:
- '17'
- '18'
channel: latest/edge
channel: yoga/edge
glance:
charm: ch:glance
@ -166,7 +168,7 @@ services:
openstack-origin: *openstack-origin
to:
- '19'
channel: latest/edge
channel: yoga/edge
neutron-api:
charm: ch:neutron-api
@ -179,11 +181,11 @@ services:
openstack-origin: *openstack-origin
to:
- '20'
channel: latest/edge
channel: yoga/edge
neutron-openvswitch:
charm: ch:neutron-openvswitch
channel: latest/edge
channel: yoga/edge
neutron-gateway:
charm: ch:neutron-gateway
@ -193,7 +195,7 @@ services:
openstack-origin: *openstack-origin
to:
- '21'
channel: latest/edge
channel: yoga/edge
rabbitmq-server:
charm: ch:rabbitmq-server
@ -211,7 +213,7 @@ services:
openstack-origin: *openstack-origin
to:
- '23'
channel: latest/edge
channel: yoga/edge
relations:

View File

@ -1,6 +1,8 @@
variables:
openstack-origin: &openstack-origin distro
local_overlay_enabled: True
series: jammy
comment:
@ -73,7 +75,7 @@ services:
manila-ganesha-az1:
num_units: 3
charm: ../../../manila-ganesha
charm: ../../../manila-ganesha.charm
options:
openstack-origin: *openstack-origin
to:
@ -90,7 +92,7 @@ services:
- '6'
- '7'
- '8'
channel: latest/edge
channel: quincy/edge
ceph-osd:
charm: ch:ceph-osd
@ -103,7 +105,7 @@ services:
- '9'
- '10'
- '11'
channel: latest/edge
channel: quincy/edge
ceph-fs:
charm: ch:ceph-fs
@ -113,7 +115,7 @@ services:
to:
- '12'
- '13'
channel: latest/edge
channel: quincy/edge
manila:
charm: ch:manila
@ -124,7 +126,7 @@ services:
openstack-origin: *openstack-origin
to:
- '14'
channel: latest/edge
channel: yoga/edge
nova-cloud-controller:
charm: ch:nova-cloud-controller
@ -134,7 +136,7 @@ services:
openstack-origin: *openstack-origin
to:
- '15'
channel: latest/edge
channel: yoga/edge
placement:
charm: ch:placement
@ -143,7 +145,7 @@ services:
openstack-origin: *openstack-origin
to:
- '16'
channel: latest/edge
channel: yoga/edge
nova-compute:
charm: ch:nova-compute
@ -157,7 +159,7 @@ services:
to:
- '17'
- '18'
channel: latest/edge
channel: yoga/edge
glance:
charm: ch:glance
@ -166,7 +168,7 @@ services:
openstack-origin: *openstack-origin
to:
- '19'
channel: latest/edge
channel: yoga/edge
neutron-api:
charm: ch:neutron-api
@ -179,11 +181,11 @@ services:
openstack-origin: *openstack-origin
to:
- '20'
channel: latest/edge
channel: yoga/edge
neutron-openvswitch:
charm: ch:neutron-openvswitch
channel: latest/edge
channel: yoga/edge
neutron-gateway:
charm: ch:neutron-gateway
@ -193,7 +195,7 @@ services:
openstack-origin: *openstack-origin
to:
- '21'
channel: latest/edge
channel: yoga/edge
rabbitmq-server:
charm: ch:rabbitmq-server
@ -211,7 +213,7 @@ services:
openstack-origin: *openstack-origin
to:
- '23'
channel: latest/edge
channel: yoga/edge
relations:

View File

@ -28,6 +28,11 @@ oslo.utils<=3.41.0;python_version<'3.6'
requests>=2.18.4
charms.reactive
# Newer mock seems to have some syntax which is newer than python3.5 (e.g.
# f'{something}'
mock>=1.2,<4.0.0; python_version < '3.6'
mock>=1.2; python_version >= '3.6'
nose>=1.3.7
coverage>=3.6
git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack
@ -46,3 +51,4 @@ pbr==5.6.0 # vault
cryptography<3.4 # vault, keystone-saml-mellon
lxml # keystone-saml-mellon
hvac # vault, barbican-vault
psutil # cinder-lvm

25
tox.ini
View File

@ -37,11 +37,24 @@ setenv = VIRTUAL_ENV={envdir}
passenv = http_proxy https_proxy INTERFACE_PATH LAYER_PATH JUJU_REPOSITORY
install_command =
{toxinidir}/pip.sh install {opts} {packages}
allowlist_externals =
charmcraft
bash
tox
rename.sh
deps =
-r{toxinidir}/requirements.txt
[testenv:build]
basepython = python3
deps = -r{toxinidir}/build-requirements.txt
commands =
charmcraft clean
charmcraft -v build
{toxinidir}/rename.sh
[testenv:build-reactive]
basepython = python3
commands =
charm-build --log-level DEBUG --use-lock-file-branches -o {toxinidir}/build/builds src {posargs}
@ -86,6 +99,18 @@ deps = flake8==3.9.2
charm-tools==2.8.3
commands = flake8 {posargs} src unit_tests
[testenv:func-target]
# Hack to get functional tests working in the charmcraft
# world. We should fix this.
basepython = python3
passenv = HOME TERM CS_* OS_* TEST_*
deps = -r{toxinidir}/src/test-requirements.txt
changedir = {toxinidir}/src
commands =
bash -c "if [ ! -f ../*.charm ]; then echo 'Charm does not exist. Run tox -e build'; exit 1; fi"
tox --version
tox -e func-target {posargs}
[testenv:cover]
# Technique based heavily upon
# https://github.com/openstack/nova/blob/master/tox.ini