From 011733c97f338ae97b1bfba56ea464fdc73f7092 Mon Sep 17 00:00:00 2001 From: Aurelien Lourot Date: Mon, 7 Feb 2022 15:23:19 +0100 Subject: [PATCH] Migrate to charmhub Change-Id: I8b998968aecf8f6d2485d4f5153211ceeac81b27 --- build-requirements.txt | 7 +- charmcraft.yaml | 27 +++++ osci.yaml | 20 +--- rename.sh | 13 +++ tests/README.md | 19 ++++ tests/bundles/bionic-octopus.yaml | 101 ------------------ tests/bundles/focal.yaml | 26 +++-- tests/bundles/hirsute.yaml | 68 ------------ tests/bundles/overlays/bionic-octopus.yaml.j2 | 5 - tests/tests.yaml | 5 - tox.ini | 11 +- 11 files changed, 94 insertions(+), 208 deletions(-) create mode 100644 charmcraft.yaml create mode 100755 rename.sh create mode 100644 tests/README.md delete mode 100644 tests/bundles/bionic-octopus.yaml delete mode 100644 tests/bundles/hirsute.yaml delete mode 100644 tests/bundles/overlays/bionic-octopus.yaml.j2 diff --git a/build-requirements.txt b/build-requirements.txt index 38b1a77..b6d2452 100644 --- a/build-requirements.txt +++ b/build-requirements.txt @@ -1,2 +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. -git+https://github.com/canonical/charmcraft.git@0.10.2#egg=charmcraft diff --git a/charmcraft.yaml b/charmcraft.yaml new file mode 100644 index 0000000..7293321 --- /dev/null +++ b/charmcraft.yaml @@ -0,0 +1,27 @@ +type: charm + +parts: + charm: + after: + - update-certificates + charm-python-packages: + # NOTE(lourot): see + # * https://github.com/canonical/charmcraft/issues/551 + # * https://github.com/canonical/charmcraft/issues/632 + - setuptools < 58 + build-packages: + - git + + update-certificates: + plugin: nil + # See https://github.com/canonical/charmcraft/issues/658 + override-build: | + apt update + apt install -y ca-certificates + update-ca-certificates + +bases: + - name: ubuntu + channel: "20.04" + architectures: + - amd64 diff --git a/osci.yaml b/osci.yaml index 2088973..6502b8a 100644 --- a/osci.yaml +++ b/osci.yaml @@ -1,11 +1,10 @@ - project: templates: - - charm-yoga-unit-jobs + - charm-unit-jobs-py38 + - charm-unit-jobs-py39 check: jobs: - - bionic-octopus - focal-octopus - - hirsute-pacific vars: needs_charm_build: true charm_build_name: ceph-dashboard @@ -14,22 +13,9 @@ name: focal-octopus parent: func-target dependencies: + - charm-build - osci-lint - - tox-py36 - tox-py38 - tox-py39 vars: tox_extra_args: focal -- job: - name: bionic-octopus - parent: func-target - dependencies: &smoke-jobs - - focal-octopus - vars: - tox_extra_args: bionic-octopus -- job: - name: hirsute-pacific - parent: func-target - dependencies: *smoke-jobs - vars: - tox_extra_args: hirsute diff --git a/rename.sh b/rename.sh new file mode 100755 index 0000000..d0c35c9 --- /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/README.md b/tests/README.md new file mode 100644 index 0000000..31363ee --- /dev/null +++ b/tests/README.md @@ -0,0 +1,19 @@ +# Overview + +This directory provides Zaza test definitions and bundles to verify basic +deployment functionality from the perspective of this charm, its requirements +and its features, as exercised in a subset of the full OpenStack deployment +test bundle topology. + +Run the smoke tests with: + +```bash +cd ../ +tox -e build +cd tests/ +tox -e func-smoke +``` + +For full details on functional testing of OpenStack charms please refer to +the [functional testing](https://docs.openstack.org/charm-guide/latest/reference/testing.html#functional-testing) +section of the OpenStack Charm Guide. diff --git a/tests/bundles/bionic-octopus.yaml b/tests/bundles/bionic-octopus.yaml deleted file mode 100644 index 9982e4e..0000000 --- a/tests/bundles/bionic-octopus.yaml +++ /dev/null @@ -1,101 +0,0 @@ -local_overlay_enabled: False -series: bionic -applications: - percona-cluster: - charm: cs:~openstack-charmers-next/percona-cluster - num_units: 1 - options: - dataset-size: 25% - max-connections: 1000 - source: cloud:bionic-ussuri - ceph-osd: - charm: cs:~openstack-charmers-next/ceph-osd - num_units: 6 - storage: - osd-devices: 'cinder,10G' - options: - osd-devices: '/dev/test-non-existent' - source: cloud:bionic-ussuri - ceph-mon: - charm: cs:~openstack-charmers-next/ceph-mon - num_units: 3 - options: - monitor-count: '3' - source: cloud:bionic-ussuri - vault: - num_units: 1 - charm: cs:~openstack-charmers-next/vault - ceph-dashboard: - charm: ../../ceph-dashboard.charm - options: - public-hostname: 'ceph-dashboard.zaza.local' - prometheus: - charm: cs:prometheus2 - num_units: 1 - grafana: - # SSL and allow_embedding are not released into cs:grafana yet, due - # Octrober 2021 - charm: cs:~llama-charmers-next/grafana - num_units: 1 - options: - anonymous: True - install_plugins: https://storage.googleapis.com/plugins-community/vonage-status-panel/release/1.0.11/vonage-status-panel-1.0.11.zip,https://storage.googleapis.com/plugins-community/grafana-piechart-panel/release/1.6.2/grafana-piechart-panel-1.6.2.zip - install_method: snap - allow_embedding: True - telegraf: - charm: telegraf - channel: stable - options: - hostname: "{host}" - prometheus-alertmanager: - charm: cs:prometheus-alertmanager - num_units: 1 - ceph-radosgw: - charm: cs:~openstack-charmers-next/ceph-radosgw - num_units: 3 - options: - source: cloud:bionic-ussuri - ceph-fs: - charm: cs:~openstack-charmers-next/ceph-fs - num_units: 1 - options: - source: cloud:bionic-ussuri -relations: - - - 'ceph-osd:mon' - - 'ceph-mon:osd' - - - 'vault:shared-db' - - 'percona-cluster:shared-db' - - - 'ceph-dashboard:dashboard' - - 'ceph-mon:dashboard' - - - 'ceph-dashboard:certificates' - - 'vault:certificates' - - - 'ceph-mon:prometheus' - - 'prometheus:target' - - - 'grafana:grafana-source' - - 'prometheus:grafana-source' - - - 'grafana:certificates' - - 'vault:certificates' - - - 'ceph-osd:juju-info' - - 'telegraf:juju-info' - - - 'ceph-mon:juju-info' - - 'telegraf:juju-info' - - - 'telegraf:prometheus-client' - - 'prometheus:target' - - - 'telegraf:dashboards' - - 'grafana:dashboards' - - - 'ceph-dashboard:grafana-dashboard' - - 'grafana:dashboards' - - - 'ceph-dashboard:alertmanager-service' - - 'prometheus-alertmanager:alertmanager-service' - - - 'ceph-dashboard:prometheus' - - 'prometheus:website' - - - 'prometheus:alertmanager-service' - - 'prometheus-alertmanager:alertmanager-service' - - - 'ceph-radosgw:mon' - - 'ceph-mon:radosgw' - - - 'ceph-radosgw:certificates' - - 'vault:certificates' - - - 'ceph-dashboard:radosgw-dashboard' - - 'ceph-radosgw:radosgw-user' - - - 'ceph-mon:mds' - - 'ceph-fs:ceph-mds' diff --git a/tests/bundles/focal.yaml b/tests/bundles/focal.yaml index 8a06e61..34a9559 100644 --- a/tests/bundles/focal.yaml +++ b/tests/bundles/focal.yaml @@ -2,26 +2,31 @@ local_overlay_enabled: False series: focal applications: ceph-osd: - charm: cs:~openstack-charmers-next/ceph-osd + charm: ch:ceph-osd num_units: 6 storage: osd-devices: 'cinder,10G' options: osd-devices: '/dev/test-non-existent' + channel: latest/edge ceph-mon: - charm: cs:~openstack-charmers-next/ceph-mon + charm: ch:ceph-mon num_units: 3 options: monitor-count: '3' + channel: latest/edge vault: num_units: 1 - charm: cs:~openstack-charmers-next/vault + charm: ch:vault + channel: latest/edge mysql-innodb-cluster: - charm: cs:~openstack-charmers-next/mysql-innodb-cluster + charm: ch:mysql-innodb-cluster constraints: mem=3072M num_units: 3 + channel: latest/edge vault-mysql-router: - charm: cs:~openstack-charmers-next/mysql-router + charm: ch:mysql-router + channel: latest/edge ceph-dashboard: charm: ../../ceph-dashboard.charm options: @@ -32,7 +37,7 @@ applications: grafana: # SSL and allow_embedding are not released into cs:grafana yet, due # Octrober 2021 - charm: cs:~llama-charmers-next/grafana + charm: ch:grafana num_units: 1 options: anonymous: True @@ -48,16 +53,19 @@ applications: charm: cs:prometheus-alertmanager num_units: 1 ceph-radosgw: - charm: cs:~openstack-charmers-next/ceph-radosgw + charm: ch:ceph-radosgw num_units: 3 + channel: latest/edge ceph-fs: - charm: cs:~openstack-charmers-next/ceph-fs + charm: ch:ceph-fs num_units: 1 + channel: latest/edge ceph-iscsi: - charm: cs:~openstack-charmers-next/ceph-iscsi + charm: ch:ceph-iscsi num_units: 2 options: gateway-metadata-pool: iscsi-foo-metadata + channel: latest/edge relations: - - 'ceph-osd:mon' - 'ceph-mon:osd' diff --git a/tests/bundles/hirsute.yaml b/tests/bundles/hirsute.yaml deleted file mode 100644 index 215e38e..0000000 --- a/tests/bundles/hirsute.yaml +++ /dev/null @@ -1,68 +0,0 @@ -local_overlay_enabled: False -series: hirsute -applications: - ceph-osd: - charm: cs:~openstack-charmers-next/ceph-osd - num_units: 6 - storage: - osd-devices: 'cinder,10G' - options: - osd-devices: '/dev/test-non-existent' - ceph-mon: - charm: cs:~openstack-charmers-next/ceph-mon - num_units: 3 - options: - monitor-count: '3' - vault: - num_units: 1 - charm: cs:~openstack-charmers-next/vault - mysql-innodb-cluster: - charm: cs:~openstack-charmers-next/mysql-innodb-cluster - constraints: mem=3072M - num_units: 3 - vault-mysql-router: - charm: cs:~openstack-charmers-next/mysql-router - ceph-dashboard: - charm: ../../ceph-dashboard.charm - options: - public-hostname: 'ceph-dashboard.zaza.local' - ceph-radosgw-east: - charm: cs:~openstack-charmers-next/ceph-radosgw - num_units: 3 - options: - pool-prefix: east - region: east - ceph-radosgw-west: - charm: cs:~openstack-charmers-next/ceph-radosgw - num_units: 3 - options: - pool-prefix: west - region: west - ceph-fs: - charm: cs:~openstack-charmers-next/ceph-fs - num_units: 1 -relations: - - - 'ceph-osd:mon' - - 'ceph-mon:osd' - - - 'vault:shared-db' - - 'vault-mysql-router:shared-db' - - - 'vault-mysql-router:db-router' - - 'mysql-innodb-cluster:db-router' - - - 'ceph-dashboard:dashboard' - - 'ceph-mon:dashboard' - - - 'ceph-dashboard:certificates' - - 'vault:certificates' - - - 'ceph-radosgw-east:mon' - - 'ceph-mon:radosgw' - - - 'ceph-radosgw-east:certificates' - - 'vault:certificates' - - - 'ceph-dashboard:radosgw-dashboard' - - 'ceph-radosgw-east:radosgw-user' - - - 'ceph-radosgw-west:mon' - - 'ceph-mon:radosgw' - - - 'ceph-radosgw-west:certificates' - - 'vault:certificates' - - - 'ceph-dashboard:radosgw-dashboard' - - 'ceph-radosgw-west:radosgw-user' - - - 'ceph-mon:mds' - - 'ceph-fs:ceph-mds' diff --git a/tests/bundles/overlays/bionic-octopus.yaml.j2 b/tests/bundles/overlays/bionic-octopus.yaml.j2 deleted file mode 100644 index 3539227..0000000 --- a/tests/bundles/overlays/bionic-octopus.yaml.j2 +++ /dev/null @@ -1,5 +0,0 @@ -applications: - grafana: - options: - http_proxy: '{{ TEST_HTTP_PROXY }}' - install_plugins: {{ TEST_GRAFANA_PLUGIN_VONAGE_URL }},{{ TEST_GRAFANA_PLUGIN_PIECHART_URL }} diff --git a/tests/tests.yaml b/tests/tests.yaml index 8434950..163d0e9 100644 --- a/tests/tests.yaml +++ b/tests/tests.yaml @@ -1,8 +1,6 @@ charm_name: ceph-dasboard gate_bundles: - focal - - bionic-octopus - - hirsute smoke_bundles: - focal configure: @@ -28,6 +26,3 @@ target_deploy_status: telegraf: workload-status: active workload-status-message-prefix: Monitoring -tests_options: - force_deploy: - - hirsute diff --git a/tox.ini b/tox.ini index 79ddb1a..f49c50d 100644 --- a/tox.ini +++ b/tox.ini @@ -15,8 +15,12 @@ skip_missing_interpreters = False # * It is also necessary to pin virtualenv as a newer virtualenv would still # lead to fetching the latest pip in the func* tox targets, see # https://stackoverflow.com/a/38133283 +# * It is necessary to declare setuptools as a dependency otherwise tox will +# fail very early at not being able to load it. The version pinning is in +# line with `pip.sh`. requires = pip < 20.3 virtualenv < 20.0 + setuptools < 50.0.0 # NOTE: https://wiki.canonical.com/engineering/OpenStack/InstallLatestToxOnOsci minversion = 3.2.0 @@ -27,11 +31,12 @@ setenv = VIRTUAL_ENV={envdir} install_command = pip install {opts} {packages} commands = stestr run --slowest {posargs} -whitelist_externals = +allowlist_externals = git add-to-archive.py bash charmcraft + rename.sh ls pwd passenv = HOME TERM CS_* OS_* TEST_* @@ -109,7 +114,9 @@ commands = {posargs} basepython = python3 deps = -r{toxinidir}/build-requirements.txt commands = - charmcraft build + charmcraft clean + charmcraft -v build + {toxinidir}/rename.sh [testenv:func-noop] basepython = python3