From a7e6225b2b70e9bf09c54b3d1f9b3d2fa53eb4b4 Mon Sep 17 00:00:00 2001 From: Alex Kavanagh Date: Tue, 15 Feb 2022 15:13:49 +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: I546438f1af6b3f779aa01e9ddd8c8ae7c3b7d063 --- .gitignore | 1 + build-requirements.txt | 7 +++++++ osci.yaml | 4 ++++ rename.sh | 13 +++++++++++++ tests/bundles/focal-xena.yaml | 32 ++++++++++++++++---------------- tests/bundles/focal-yoga.yaml | 32 ++++++++++++++++---------------- tests/bundles/impish-xena.yaml | 32 ++++++++++++++++---------------- tests/bundles/jammy-yoga.yaml | 32 ++++++++++++++++---------------- tox.ini | 12 +++++++++++- 9 files changed, 100 insertions(+), 65 deletions(-) create mode 100644 build-requirements.txt create mode 100755 rename.sh diff --git a/.gitignore b/.gitignore index b7e47dbe..901e8bd5 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ bin .testrepository .tox *.sw[nop] +*.charm .idea *.pyc func-results.json 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/osci.yaml b/osci.yaml index da6cd318..2234cbeb 100644 --- a/osci.yaml +++ b/osci.yaml @@ -4,3 +4,7 @@ - charm-unit-jobs-py39 - charm-xena-functional-jobs - charm-yoga-functional-jobs + vars: + needs_charm_build: true + charm_build_name: ceph-mon + build_type: charmcraft 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 82602a31..e82685eb 100644 --- a/tests/bundles/focal-xena.yaml +++ b/tests/bundles/focal-xena.yaml @@ -32,19 +32,19 @@ applications: keystone-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga glance-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga cinder-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga nova-cloud-controller-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga placement-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga mysql-innodb-cluster: charm: ch:mysql-innodb-cluster @@ -55,7 +55,7 @@ applications: - '0' - '1' - '2' - channel: latest/edge + channel: stable/yoga ceph-osd: charm: ch:ceph-osd @@ -69,10 +69,10 @@ applications: - '3' - '4' - '5' - channel: latest/edge + channel: stable/yoga ceph-mon: - charm: ../../../ceph-mon + charm: ../../ceph-mon.charm num_units: 3 options: source: *openstack-origin @@ -89,7 +89,7 @@ applications: source: *openstack-origin to: - '9' - channel: latest/edge + channel: stable/yoga keystone: expose: True @@ -99,7 +99,7 @@ applications: openstack-origin: *openstack-origin to: - '10' - channel: latest/edge + channel: stable/yoga nova-compute: charm: ch:nova-compute @@ -109,7 +109,7 @@ applications: libvirt-image-backend: rbd to: - '11' - channel: latest/edge + channel: stable/yoga glance: expose: True @@ -119,7 +119,7 @@ applications: openstack-origin: *openstack-origin to: - '12' - channel: latest/edge + channel: stable/yoga cinder: expose: True @@ -131,11 +131,11 @@ applications: openstack-origin: *openstack-origin to: - '13' - channel: latest/edge + channel: stable/yoga cinder-ceph: charm: ch:cinder-ceph - channel: latest/edge + channel: stable/yoga nova-cloud-controller: expose: True @@ -145,7 +145,7 @@ applications: openstack-origin: *openstack-origin to: - '14' - channel: latest/edge + channel: stable/yoga placement: charm: ch:placement @@ -154,7 +154,7 @@ applications: openstack-origin: *openstack-origin to: - '15' - channel: latest/edge + channel: stable/yoga prometheus2: # Pin prometheus2 charm version Bug #1891942 diff --git a/tests/bundles/focal-yoga.yaml b/tests/bundles/focal-yoga.yaml index 1b264c44..1934967d 100644 --- a/tests/bundles/focal-yoga.yaml +++ b/tests/bundles/focal-yoga.yaml @@ -32,19 +32,19 @@ applications: keystone-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga glance-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga cinder-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga nova-cloud-controller-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga placement-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga mysql-innodb-cluster: charm: ch:mysql-innodb-cluster @@ -55,7 +55,7 @@ applications: - '0' - '1' - '2' - channel: latest/edge + channel: stable/yoga ceph-osd: charm: ch:ceph-osd @@ -69,10 +69,10 @@ applications: - '3' - '4' - '5' - channel: latest/edge + channel: stable/yoga ceph-mon: - charm: ../../../ceph-mon + charm: ../../ceph-mon.charm num_units: 3 options: source: *openstack-origin @@ -89,7 +89,7 @@ applications: source: *openstack-origin to: - '9' - channel: latest/edge + channel: stable/yoga keystone: expose: True @@ -99,7 +99,7 @@ applications: openstack-origin: *openstack-origin to: - '10' - channel: latest/edge + channel: stable/yoga nova-compute: charm: ch:nova-compute @@ -109,7 +109,7 @@ applications: libvirt-image-backend: rbd to: - '11' - channel: latest/edge + channel: stable/yoga glance: expose: True @@ -119,7 +119,7 @@ applications: openstack-origin: *openstack-origin to: - '12' - channel: latest/edge + channel: stable/yoga cinder: expose: True @@ -131,11 +131,11 @@ applications: openstack-origin: *openstack-origin to: - '13' - channel: latest/edge + channel: stable/yoga cinder-ceph: charm: ch:cinder-ceph - channel: latest/edge + channel: stable/yoga nova-cloud-controller: expose: True @@ -145,7 +145,7 @@ applications: openstack-origin: *openstack-origin to: - '14' - channel: latest/edge + channel: stable/yoga placement: charm: ch:placement @@ -154,7 +154,7 @@ applications: openstack-origin: *openstack-origin to: - '15' - channel: latest/edge + channel: stable/yoga prometheus2: # Pin prometheus2 charm version Bug #1891942 diff --git a/tests/bundles/impish-xena.yaml b/tests/bundles/impish-xena.yaml index bc43d2da..670fe090 100644 --- a/tests/bundles/impish-xena.yaml +++ b/tests/bundles/impish-xena.yaml @@ -33,19 +33,19 @@ applications: keystone-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga glance-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga cinder-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga nova-cloud-controller-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga placement-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga mysql-innodb-cluster: charm: ch:mysql-innodb-cluster @@ -56,7 +56,7 @@ applications: - '0' - '1' - '2' - channel: latest/edge + channel: stable/yoga ceph-osd: charm: ch:ceph-osd @@ -70,10 +70,10 @@ applications: - '3' - '4' - '5' - channel: latest/edge + channel: stable/yoga ceph-mon: - charm: ../../../ceph-mon + charm: ../../ceph-mon.charm num_units: 3 options: source: *openstack-origin @@ -90,7 +90,7 @@ applications: source: *openstack-origin to: - '9' - channel: latest/edge + channel: stable/yoga keystone: expose: True @@ -100,7 +100,7 @@ applications: openstack-origin: *openstack-origin to: - '10' - channel: latest/edge + channel: stable/yoga nova-compute: charm: ch:nova-compute @@ -110,7 +110,7 @@ applications: libvirt-image-backend: rbd to: - '11' - channel: latest/edge + channel: stable/yoga glance: expose: True @@ -120,7 +120,7 @@ applications: openstack-origin: *openstack-origin to: - '12' - channel: latest/edge + channel: stable/yoga cinder: expose: True @@ -132,11 +132,11 @@ applications: openstack-origin: *openstack-origin to: - '13' - channel: latest/edge + channel: stable/yoga cinder-ceph: charm: ch:cinder-ceph - channel: latest/edge + channel: stable/yoga nova-cloud-controller: expose: True @@ -146,7 +146,7 @@ applications: openstack-origin: *openstack-origin to: - '14' - channel: latest/edge + channel: stable/yoga placement: charm: ch:placement @@ -155,7 +155,7 @@ applications: openstack-origin: *openstack-origin to: - '15' - channel: latest/edge + channel: stable/yoga prometheus2: # Pin prometheus2 charm version Bug #1891942 diff --git a/tests/bundles/jammy-yoga.yaml b/tests/bundles/jammy-yoga.yaml index 0b98bc77..00f207ac 100644 --- a/tests/bundles/jammy-yoga.yaml +++ b/tests/bundles/jammy-yoga.yaml @@ -33,19 +33,19 @@ applications: keystone-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga glance-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga cinder-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga nova-cloud-controller-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga placement-mysql-router: charm: ch:mysql-router - channel: latest/edge + channel: stable/yoga mysql-innodb-cluster: charm: ch:mysql-innodb-cluster @@ -56,7 +56,7 @@ applications: - '0' - '1' - '2' - channel: latest/edge + channel: stable/yoga ceph-osd: charm: ch:ceph-osd @@ -70,10 +70,10 @@ applications: - '3' - '4' - '5' - channel: latest/edge + channel: stable/yoga ceph-mon: - charm: ../../../ceph-mon + charm: ../../ceph-mon.charm num_units: 3 options: source: *openstack-origin @@ -90,7 +90,7 @@ applications: source: *openstack-origin to: - '9' - channel: latest/edge + channel: stable/yoga keystone: expose: True @@ -100,7 +100,7 @@ applications: openstack-origin: *openstack-origin to: - '10' - channel: latest/edge + channel: stable/yoga nova-compute: charm: ch:nova-compute @@ -110,7 +110,7 @@ applications: libvirt-image-backend: rbd to: - '11' - channel: latest/edge + channel: stable/yoga glance: expose: True @@ -120,7 +120,7 @@ applications: openstack-origin: *openstack-origin to: - '12' - channel: latest/edge + channel: stable/yoga cinder: expose: True @@ -132,11 +132,11 @@ applications: openstack-origin: *openstack-origin to: - '13' - channel: latest/edge + channel: stable/yoga cinder-ceph: charm: ch:cinder-ceph - channel: latest/edge + channel: stable/yoga nova-cloud-controller: expose: True @@ -146,7 +146,7 @@ applications: openstack-origin: *openstack-origin to: - '14' - channel: latest/edge + channel: stable/yoga placement: charm: ch:placement @@ -155,7 +155,7 @@ applications: openstack-origin: *openstack-origin to: - '15' - channel: latest/edge + channel: stable/yoga prometheus2: # Pin prometheus2 charm version Bug #1891942 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