Migrate to charmhub

Change-Id: I2caffbca2b6a1a6661831c6771fe4b7d45deddd3
This commit is contained in:
Aurelien Lourot 2022-02-07 15:24:07 +01:00 committed by Liam Young
parent 0434825ea9
commit dc2171c0b2
11 changed files with 115 additions and 32 deletions

View File

@ -1 +1,7 @@
git+https://github.com/canonical/charmcraft.git@0.10.2#egg=charmcraft
# 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.

27
charmcraft.yaml Normal file
View File

@ -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

View File

@ -1,6 +1,7 @@
- project:
templates:
- charm-unit-jobs
- charm-unit-jobs-py38
- charm-unit-jobs-py39
check:
jobs:
- ceph-iscsi-focal-octopus
@ -13,11 +14,10 @@
name: ceph-iscsi-focal-octopus
parent: func-target
dependencies:
- charm-build
- osci-lint
- tox-py35
- tox-py36
- tox-py37
- tox-py38
- tox-py39
vars:
tox_extra_args: focal
- job:

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

19
tests/README.md Normal file
View File

@ -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.

View File

@ -36,11 +36,13 @@ applications:
pool-type: erasure-coded
ec-profile-k: 4
ec-profile-m: 2
# Use proposed until fix for #1883112 is backported
source: distro-proposed
to:
- '0'
- '1'
ceph-osd:
charm: cs:~openstack-charmers-next/ceph-osd
charm: ch:ceph-osd
num_units: 6
storage:
osd-devices: 'cinder,10G'
@ -53,8 +55,9 @@ applications:
- '11'
- '12'
- '13'
channel: latest/edge
ceph-mon:
charm: cs:~openstack-charmers-next/ceph-mon
charm: ch:ceph-mon
num_units: 3
options:
monitor-count: '3'
@ -62,20 +65,24 @@ applications:
- '3'
- '4'
- '5'
channel: latest/edge
vault:
num_units: 1
charm: cs:~openstack-charmers-next/vault
charm: ch:vault
to:
- '6'
channel: latest/edge
mysql-innodb-cluster:
charm: cs:~openstack-charmers-next/mysql-innodb-cluster
charm: ch:mysql-innodb-cluster
num_units: 3
to:
- '8'
- '9'
- '10'
channel: latest/edge
vault-mysql-router:
charm: cs:~openstack-charmers-next/mysql-router
charm: ch:mysql-router
channel: latest/edge
relations:
- - 'ceph-mon:client'
- 'ceph-iscsi:ceph-client'

View File

@ -35,13 +35,15 @@ applications:
num_units: 4
options:
gateway-metadata-pool: iscsi-foo-metadata
# Use proposed until fix for #1883112 is backported
source: distro-proposed
to:
- '0'
- '1'
- '16'
- '17'
ceph-osd:
charm: cs:~openstack-charmers-next/ceph-osd
charm: ch:ceph-osd
num_units: 6
storage:
osd-devices: 'cinder,10G'
@ -54,8 +56,9 @@ applications:
- '11'
- '12'
- '13'
channel: latest/edge
ceph-mon:
charm: cs:~openstack-charmers-next/ceph-mon
charm: ch:ceph-mon
num_units: 3
options:
monitor-count: '3'
@ -63,20 +66,24 @@ applications:
- '3'
- '4'
- '5'
channel: latest/edge
vault:
num_units: 1
charm: cs:~openstack-charmers-next/vault
charm: ch:vault
to:
- '6'
channel: latest/edge
mysql-innodb-cluster:
charm: cs:~openstack-charmers-next/mysql-innodb-cluster
charm: ch:mysql-innodb-cluster
num_units: 3
to:
- '8'
- '9'
- '10'
channel: latest/edge
vault-mysql-router:
charm: cs:~openstack-charmers-next/mysql-router
charm: ch:mysql-router
channel: latest/edge
relations:
- - 'ceph-mon:client'
- 'ceph-iscsi:ceph-client'

View File

@ -1,3 +0,0 @@
applications:
ceph-iscsi:
charm: ../../ceph-iscsi.charm

View File

@ -13,7 +13,7 @@ tests:
target_deploy_status:
ubuntu:
workload-status: active
workload-status-message: ''
workload-status-message-prefix: ''
vault:
workload-status: blocked
workload-status-message: Vault needs to be initialized
workload-status-message-prefix: Vault needs to be initialized

17
tox.ini
View File

@ -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,10 +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
passenv = HOME TERM CS_* OS_* TEST_*
deps = -r{toxinidir}/test-requirements.txt
@ -54,6 +60,11 @@ basepython = python3.8
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:py39]
basepython = python3.9
deps = -r{toxinidir}/requirements.txt
-r{toxinidir}/test-requirements.txt
[testenv:py3]
basepython = python3
deps = -r{toxinidir}/requirements.txt
@ -101,7 +112,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

View File

@ -195,14 +195,6 @@ class TestCephISCSIGatewayCharmBase(CharmTestCase):
self.harness.add_relation_unit(
rel_id,
'ceph-iscsi/1')
self.harness.update_relation_data(
rel_id,
'ceph-iscsi/1',
{
'ingress-address': '10.0.0.2',
'gateway_ready': 'True',
'gateway_fqdn': 'ceph-iscsi-1.example'
})
return rel_id
def complete_cluster_relation(self, rel_id):
@ -231,7 +223,8 @@ class TestCephISCSIGatewayCharmBase(CharmTestCase):
@patch('socket.getfqdn')
def test_on_create_target_action(self, _getfqdn):
_getfqdn.return_value = 'ceph-iscsi-0.example'
self.add_base_cluster_relation()
cluster_rel_id = self.add_base_cluster_relation()
self.complete_cluster_relation(cluster_rel_id)
self.harness.begin()
action_event = MagicMock()
action_event.params = {
@ -276,7 +269,8 @@ class TestCephISCSIGatewayCharmBase(CharmTestCase):
@patch('socket.getfqdn')
def test_on_create_target_action_ec(self, _getfqdn):
_getfqdn.return_value = 'ceph-iscsi-0.example'
self.add_base_cluster_relation()
cluster_rel_id = self.add_base_cluster_relation()
self.complete_cluster_relation(cluster_rel_id)
self.harness.begin()
action_event = MagicMock()
action_event.params = {