From 50fd97c4ee29e0ea45f1253664337598a74bfe58 Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Tue, 15 Feb 2022 16:55:50 +0000 Subject: [PATCH] Update to classic charms to build using charmcraft in CI This update is to ensure that the Zuul Canonical CI builds the charm before functional tests and ensure that that artifact is used for the functional tests. This is to try to ensure that the charm that gets landed to the charmhub is the same charm that was tested with. Change-Id: Ic9e267db4934cb95125eebb2ff3b1ca09d64e003 --- .gitignore | 1 + build-requirements.txt | 7 +++++++ charmcraft.yaml | 1 + osci.yaml | 5 +++++ rename.sh | 13 +++++++++++++ tests/bundles/focal-xena.yaml | 20 ++++++++++---------- tests/bundles/focal-yoga.yaml | 20 ++++++++++---------- tests/bundles/impish-xena.yaml | 20 ++++++++++---------- tests/bundles/jammy-yoga.yaml | 20 ++++++++++---------- tox.ini | 12 +++++++++++- 10 files changed, 78 insertions(+), 41 deletions(-) create mode 100644 build-requirements.txt create mode 100755 rename.sh diff --git a/.gitignore b/.gitignore index a14d302d..6cd4c634 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ bin tags *.sw[nop] *.pyc +*.charm trusty/ xenial/ precise/ diff --git a/build-requirements.txt b/build-requirements.txt new file mode 100644 index 00000000..b6d2452f --- /dev/null +++ b/build-requirements.txt @@ -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. diff --git a/charmcraft.yaml b/charmcraft.yaml index ba84f314..11d5f7cd 100644 --- a/charmcraft.yaml +++ b/charmcraft.yaml @@ -6,6 +6,7 @@ parts: source: . prime: - actions/* + - charmhelpers/* - files/* - hooks/* - lib/* diff --git a/osci.yaml b/osci.yaml index 12639909..2a3c3316 100644 --- a/osci.yaml +++ b/osci.yaml @@ -11,11 +11,16 @@ voting: false - ceph-jammy-yoga_nova: voting: false + vars: + needs_charm_build: true + charm_build_name: nova-compute + build_type: charmcraft - job: name: ceph-focal-xena_nova parent: func-target dependencies: + - charm-build - osci-lint - tox-py38 - tox-py39 diff --git a/rename.sh b/rename.sh new file mode 100755 index 00000000..d0c35c97 --- /dev/null +++ b/rename.sh @@ -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 diff --git a/tests/bundles/focal-xena.yaml b/tests/bundles/focal-xena.yaml index 1d04ef95..888ae0da 100644 --- a/tests/bundles/focal-xena.yaml +++ b/tests/bundles/focal-xena.yaml @@ -75,7 +75,7 @@ applications: - '14' - '15' - '16' - channel: latest/edge + channel: quincy/edge ceph-mon: charm: ch:ceph-mon @@ -87,7 +87,7 @@ applications: - '17' - '18' - '19' - channel: latest/edge + channel: quincy/edge rabbitmq-server: charm: ch:rabbitmq-server @@ -107,7 +107,7 @@ applications: debug: true to: - '4' - channel: latest/edge + channel: yoga/edge neutron-api: charm: ch:neutron-api @@ -119,7 +119,7 @@ applications: neutron-security-groups: true to: - '5' - channel: latest/edge + channel: yoga/edge keystone: charm: ch:keystone @@ -128,7 +128,7 @@ applications: openstack-origin: *openstack-origin to: - '6' - channel: latest/edge + channel: yoga/edge neutron-gateway: charm: ch:neutron-gateway @@ -138,7 +138,7 @@ applications: bridge-mappings: physnet1:br-ex to: - '7' - channel: latest/edge + channel: yoga/edge glance: charm: ch:glance @@ -147,11 +147,11 @@ applications: openstack-origin: *openstack-origin to: - '8' - channel: latest/edge + channel: yoga/edge neutron-openvswitch: charm: ch:neutron-openvswitch - channel: latest/edge + channel: yoga/edge placement: charm: ch:placement @@ -160,10 +160,10 @@ applications: openstack-origin: *openstack-origin to: - '9' - channel: latest/edge + channel: yoga/edge nova-compute: - charm: ../../../nova-compute + charm: ../../nova-compute.charm num_units: 1 storage: ephemeral-device: '40G' diff --git a/tests/bundles/focal-yoga.yaml b/tests/bundles/focal-yoga.yaml index 24bc4846..71df4ba0 100644 --- a/tests/bundles/focal-yoga.yaml +++ b/tests/bundles/focal-yoga.yaml @@ -75,7 +75,7 @@ applications: - '14' - '15' - '16' - channel: latest/edge + channel: quincy/edge ceph-mon: charm: ch:ceph-mon @@ -87,7 +87,7 @@ applications: - '17' - '18' - '19' - channel: latest/edge + channel: quincy/edge rabbitmq-server: charm: ch:rabbitmq-server @@ -107,7 +107,7 @@ applications: debug: true to: - '4' - channel: latest/edge + channel: yoga/edge neutron-api: charm: ch:neutron-api @@ -119,7 +119,7 @@ applications: neutron-security-groups: true to: - '5' - channel: latest/edge + channel: yoga/edge keystone: charm: ch:keystone @@ -128,7 +128,7 @@ applications: openstack-origin: *openstack-origin to: - '6' - channel: latest/edge + channel: yoga/edge neutron-gateway: charm: ch:neutron-gateway @@ -138,7 +138,7 @@ applications: bridge-mappings: physnet1:br-ex to: - '7' - channel: latest/edge + channel: yoga/edge glance: charm: ch:glance @@ -147,11 +147,11 @@ applications: openstack-origin: *openstack-origin to: - '8' - channel: latest/edge + channel: yoga/edge neutron-openvswitch: charm: ch:neutron-openvswitch - channel: latest/edge + channel: yoga/edge placement: charm: ch:placement @@ -160,10 +160,10 @@ applications: openstack-origin: *openstack-origin to: - '9' - channel: latest/edge + channel: yoga/edge nova-compute: - charm: ../../../nova-compute + charm: ../../nova-compute.charm num_units: 1 storage: ephemeral-device: '40G' diff --git a/tests/bundles/impish-xena.yaml b/tests/bundles/impish-xena.yaml index cc95f5c3..99a464dd 100644 --- a/tests/bundles/impish-xena.yaml +++ b/tests/bundles/impish-xena.yaml @@ -75,7 +75,7 @@ applications: - '14' - '15' - '16' - channel: latest/edge + channel: quincy/edge ceph-mon: charm: ch:ceph-mon @@ -87,7 +87,7 @@ applications: - '17' - '18' - '19' - channel: latest/edge + channel: quincy/edge rabbitmq-server: charm: ch:rabbitmq-server @@ -107,7 +107,7 @@ applications: debug: true to: - '4' - channel: latest/edge + channel: yoga/edge neutron-api: charm: ch:neutron-api @@ -119,7 +119,7 @@ applications: neutron-security-groups: true to: - '5' - channel: latest/edge + channel: yoga/edge keystone: charm: ch:keystone @@ -128,7 +128,7 @@ applications: openstack-origin: *openstack-origin to: - '6' - channel: latest/edge + channel: yoga/edge neutron-gateway: charm: ch:neutron-gateway @@ -138,7 +138,7 @@ applications: bridge-mappings: physnet1:br-ex to: - '7' - channel: latest/edge + channel: yoga/edge glance: charm: ch:glance @@ -147,11 +147,11 @@ applications: openstack-origin: *openstack-origin to: - '8' - channel: latest/edge + channel: yoga/edge neutron-openvswitch: charm: ch:neutron-openvswitch - channel: latest/edge + channel: yoga/edge placement: charm: ch:placement @@ -160,10 +160,10 @@ applications: openstack-origin: *openstack-origin to: - '9' - channel: latest/edge + channel: yoga/edge nova-compute: - charm: ../../../nova-compute + charm: ../../nova-compute.charm num_units: 1 storage: ephemeral-device: '40G' diff --git a/tests/bundles/jammy-yoga.yaml b/tests/bundles/jammy-yoga.yaml index 05d78a65..0c42df8f 100644 --- a/tests/bundles/jammy-yoga.yaml +++ b/tests/bundles/jammy-yoga.yaml @@ -75,7 +75,7 @@ applications: - '14' - '15' - '16' - channel: latest/edge + channel: quincy/edge ceph-mon: charm: ch:ceph-mon @@ -87,7 +87,7 @@ applications: - '17' - '18' - '19' - channel: latest/edge + channel: quincy/edge rabbitmq-server: charm: ch:rabbitmq-server @@ -107,7 +107,7 @@ applications: debug: true to: - '4' - channel: latest/edge + channel: yoga/edge neutron-api: charm: ch:neutron-api @@ -119,7 +119,7 @@ applications: neutron-security-groups: true to: - '5' - channel: latest/edge + channel: yoga/edge keystone: charm: ch:keystone @@ -128,7 +128,7 @@ applications: openstack-origin: *openstack-origin to: - '6' - channel: latest/edge + channel: yoga/edge neutron-gateway: charm: ch:neutron-gateway @@ -138,7 +138,7 @@ applications: bridge-mappings: physnet1:br-ex to: - '7' - channel: latest/edge + channel: yoga/edge glance: charm: ch:glance @@ -147,11 +147,11 @@ applications: openstack-origin: *openstack-origin to: - '8' - channel: latest/edge + channel: yoga/edge neutron-openvswitch: charm: ch:neutron-openvswitch - channel: latest/edge + channel: yoga/edge placement: charm: ch:placement @@ -160,10 +160,10 @@ applications: openstack-origin: *openstack-origin to: - '9' - channel: latest/edge + channel: yoga/edge nova-compute: - charm: ../../../nova-compute + charm: ../../nova-compute.charm num_units: 1 storage: ephemeral-device: '40G' diff --git a/tox.ini b/tox.ini index 86d1e904..81fd2492 100644 --- a/tox.ini +++ b/tox.ini @@ -37,10 +37,20 @@ setenv = VIRTUAL_ENV={envdir} install_command = {toxinidir}/pip.sh install {opts} {packages} commands = stestr run --slowest {posargs} -allowlist_externals = juju +allowlist_externals = + charmcraft + rename.sh passenv = HOME TERM CS_* OS_* TEST_* deps = -r{toxinidir}/test-requirements.txt +[testenv:build] +basepython = python3 +deps = -r{toxinidir}/build-requirements.txt +commands = + charmcraft clean + charmcraft -v build + {toxinidir}/rename.sh + [testenv:py35] basepython = python3.5 deps = -r{toxinidir}/requirements.txt