diff --git a/build-requirements.txt b/build-requirements.txt new file mode 100644 index 0000000..b6d2452 --- /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 new file mode 100644 index 0000000..4968216 --- /dev/null +++ b/charmcraft.yaml @@ -0,0 +1,25 @@ +type: charm + +parts: + 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 + channel: "20.04" + architectures: + - amd64 diff --git a/metadata.yaml b/metadata.yaml new file mode 120000 index 0000000..0768683 --- /dev/null +++ b/metadata.yaml @@ -0,0 +1 @@ +src/metadata.yaml \ No newline at end of file diff --git a/osci.yaml b/osci.yaml index cae5369..6fa4403 100644 --- a/osci.yaml +++ b/osci.yaml @@ -1,11 +1,10 @@ - project: templates: - - charm-yoga-unit-jobs - - charm-yoga-functional-jobs + - charm-unit-jobs-py38 + - charm-unit-jobs-py39 - charm-xena-functional-jobs - - charm-wallaby-functional-jobs - - charm-victoria-functional-jobs - - charm-ussuri-functional-jobs + - charm-yoga-functional-jobs vars: needs_charm_build: true charm_build_name: ovn-dedicated-chassis + build_type: charmcraft 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/src/metadata.yaml b/src/metadata.yaml index de46d23..c471b66 100644 --- a/src/metadata.yaml +++ b/src/metadata.yaml @@ -7,10 +7,7 @@ description: | tags: - networking series: -- bionic - focal -- groovy -- hirsute - impish subordinate: false extra-bindings: diff --git a/src/test-requirements.txt b/src/test-requirements.txt index e771023..9c7afb7 100644 --- a/src/test-requirements.txt +++ b/src/test-requirements.txt @@ -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 diff --git a/src/tests/bundles/bionic-train.yaml b/src/tests/bundles/bionic-train.yaml deleted file mode 100644 index f28a657..0000000 --- a/src/tests/bundles/bionic-train.yaml +++ /dev/null @@ -1,31 +0,0 @@ -series: bionic -relations: -- - vault:shared-db - - mysql:shared-db -- - ovn-central:certificates - - vault:certificates -- - ovn-dedicated-chassis:ovsdb - - ovn-central:ovsdb -- - ovn-dedicated-chassis:certificates - - vault:certificates -- - ovn-dedicated-chassis:nrpe-external-master - - nrpe:nrpe-external-master -applications: - mysql: - charm: cs:~openstack-charmers-next/percona-cluster - num_units: 1 - vault: - charm: cs:~openstack-charmers-next/vault - num_units: 1 - ovn-central: - charm: cs:~openstack-charmers-next/ovn-central - num_units: 3 - options: - source: cloud:bionic-train - ovn-dedicated-chassis: - charm: ../../../ovn-dedicated-chassis - num_units: 2 - options: - source: cloud:bionic-train - nrpe: - charm: cs:nrpe diff --git a/src/tests/bundles/bionic-ussuri.yaml b/src/tests/bundles/bionic-ussuri.yaml deleted file mode 100644 index e0a4855..0000000 --- a/src/tests/bundles/bionic-ussuri.yaml +++ /dev/null @@ -1,31 +0,0 @@ -series: bionic -relations: -- - vault:shared-db - - mysql:shared-db -- - ovn-central:certificates - - vault:certificates -- - ovn-dedicated-chassis:ovsdb - - ovn-central:ovsdb -- - ovn-dedicated-chassis:certificates - - vault:certificates -- - ovn-dedicated-chassis:nrpe-external-master - - nrpe:nrpe-external-master -applications: - mysql: - charm: cs:~openstack-charmers-next/percona-cluster - num_units: 1 - vault: - charm: cs:~openstack-charmers-next/vault - num_units: 1 - ovn-central: - charm: cs:~openstack-charmers-next/ovn-central - num_units: 3 - options: - source: cloud:bionic-ussuri/proposed - ovn-dedicated-chassis: - charm: ../../../ovn-dedicated-chassis - num_units: 2 - options: - source: cloud:bionic-ussuri - nrpe: - charm: cs:nrpe diff --git a/src/tests/bundles/focal-ussuri.yaml b/src/tests/bundles/focal-ussuri.yaml deleted file mode 100644 index 83f8128..0000000 --- a/src/tests/bundles/focal-ussuri.yaml +++ /dev/null @@ -1,78 +0,0 @@ -variables: - openstack-origin: &openstack-origin distro - -series: focal - -comment: -- 'machines section to decide order of deployment. database sooner = faster' -machines: - '0': - constraints: mem=3072M - '1': - constraints: mem=3072M - '2': - constraints: mem=3072M - '3': - '4': - '5': - '6': - '7': - '8': - -applications: - - vault-mysql-router: - charm: cs:~openstack-charmers-next/mysql-router - - mysql-innodb-cluster: - charm: cs:~openstack-charmers-next/mysql-innodb-cluster - num_units: 3 - options: - source: *openstack-origin - to: - - '0' - - '1' - - '2' - - vault: - charm: cs:~openstack-charmers-next/vault - num_units: 1 - to: - - '3' - - nrpe: - charm: cs:nrpe - - ovn-central: - charm: cs:~openstack-charmers-next/ovn-central - num_units: 3 - options: - source: *openstack-origin - to: - - '4' - - '5' - - '6' - - ovn-dedicated-chassis: - charm: ../../../ovn-dedicated-chassis - num_units: 2 - options: - source: *openstack-origin - to: - - '7' - - '8' - -relations: - - - - 'vault-mysql-router:db-router' - - 'mysql-innodb-cluster:db-router' - - - 'vault:shared-db' - - 'vault-mysql-router:shared-db' - - - 'ovn-central:certificates' - - 'vault:certificates' - - - 'ovn-dedicated-chassis:ovsdb' - - 'ovn-central:ovsdb' - - - 'ovn-dedicated-chassis:certificates' - - 'vault:certificates' - - - 'ovn-dedicated-chassis:nrpe-external-master' - - 'nrpe:nrpe-external-master' diff --git a/src/tests/bundles/focal-victoria.yaml b/src/tests/bundles/focal-victoria.yaml deleted file mode 100644 index 3341176..0000000 --- a/src/tests/bundles/focal-victoria.yaml +++ /dev/null @@ -1,78 +0,0 @@ -variables: - openstack-origin: &openstack-origin cloud:focal-victoria - -series: focal - -comment: -- 'machines section to decide order of deployment. database sooner = faster' -machines: - '0': - constraints: mem=3072M - '1': - constraints: mem=3072M - '2': - constraints: mem=3072M - '3': - '4': - '5': - '6': - '7': - '8': - -applications: - - vault-mysql-router: - charm: cs:~openstack-charmers-next/mysql-router - - mysql-innodb-cluster: - charm: cs:~openstack-charmers-next/mysql-innodb-cluster - num_units: 3 - options: - source: *openstack-origin - to: - - '0' - - '1' - - '2' - - vault: - charm: cs:~openstack-charmers-next/vault - num_units: 1 - to: - - '3' - - ovn-central: - charm: cs:~openstack-charmers-next/ovn-central - num_units: 3 - options: - source: *openstack-origin - to: - - '4' - - '5' - - '6' - - nrpe: - charm: cs:nrpe - - ovn-dedicated-chassis: - charm: cs:~openstack-charmers-next/ovn-dedicated-chassis - num_units: 2 - options: - source: *openstack-origin - to: - - '7' - - '8' - -relations: - - - - 'vault-mysql-router:db-router' - - 'mysql-innodb-cluster:db-router' - - - 'vault:shared-db' - - 'vault-mysql-router:shared-db' - - - 'ovn-central:certificates' - - 'vault:certificates' - - - 'ovn-dedicated-chassis:ovsdb' - - 'ovn-central:ovsdb' - - - 'ovn-dedicated-chassis:certificates' - - 'vault:certificates' - - - 'ovn-dedicated-chassis:nrpe-external-master' - - 'nrpe:nrpe-external-master' diff --git a/src/tests/bundles/focal-wallaby.yaml b/src/tests/bundles/focal-wallaby.yaml deleted file mode 100644 index 1965f4e..0000000 --- a/src/tests/bundles/focal-wallaby.yaml +++ /dev/null @@ -1,78 +0,0 @@ -variables: - openstack-origin: &openstack-origin cloud:focal-wallaby - -series: focal - -comment: -- 'machines section to decide order of deployment. database sooner = faster' -machines: - '0': - constraints: mem=3072M - '1': - constraints: mem=3072M - '2': - constraints: mem=3072M - '3': - '4': - '5': - '6': - '7': - '8': - -applications: - - vault-mysql-router: - charm: cs:~openstack-charmers-next/mysql-router - - mysql-innodb-cluster: - charm: cs:~openstack-charmers-next/mysql-innodb-cluster - num_units: 3 - options: - source: *openstack-origin - to: - - '0' - - '1' - - '2' - - vault: - charm: cs:~openstack-charmers-next/vault - num_units: 1 - to: - - '3' - - ovn-central: - charm: cs:~openstack-charmers-next/ovn-central - num_units: 3 - options: - source: *openstack-origin - to: - - '4' - - '5' - - '6' - - nrpe: - charm: cs:nrpe - - ovn-dedicated-chassis: - charm: cs:~openstack-charmers-next/ovn-dedicated-chassis - num_units: 2 - options: - source: *openstack-origin - to: - - '7' - - '8' - -relations: - - - - 'vault-mysql-router:db-router' - - 'mysql-innodb-cluster:db-router' - - - 'vault:shared-db' - - 'vault-mysql-router:shared-db' - - - 'ovn-central:certificates' - - 'vault:certificates' - - - 'ovn-dedicated-chassis:ovsdb' - - 'ovn-central:ovsdb' - - - 'ovn-dedicated-chassis:certificates' - - 'vault:certificates' - - - 'ovn-dedicated-chassis:nrpe-external-master' - - 'nrpe:nrpe-external-master' diff --git a/src/tests/bundles/focal-xena.yaml b/src/tests/bundles/focal-xena.yaml index 315812f..e9a8661 100644 --- a/src/tests/bundles/focal-xena.yaml +++ b/src/tests/bundles/focal-xena.yaml @@ -1,6 +1,8 @@ variables: openstack-origin: &openstack-origin cloud:focal-xena +local_overlay_enabled: False + series: focal comment: @@ -22,10 +24,11 @@ machines: applications: vault-mysql-router: - charm: cs:~openstack-charmers-next/mysql-router + charm: ch:mysql-router + channel: latest/edge mysql-innodb-cluster: - charm: cs:~openstack-charmers-next/mysql-innodb-cluster + charm: ch:mysql-innodb-cluster num_units: 3 options: source: *openstack-origin @@ -33,15 +36,17 @@ applications: - '0' - '1' - '2' + channel: latest/edge vault: - charm: cs:~openstack-charmers-next/vault + charm: ch:vault num_units: 1 to: - '3' + channel: latest/edge ovn-central: - charm: cs:~openstack-charmers-next/ovn-central + charm: ch:ovn-central num_units: 3 options: source: *openstack-origin @@ -49,12 +54,13 @@ applications: - '4' - '5' - '6' + channel: latest/edge nrpe: charm: cs:nrpe ovn-dedicated-chassis: - charm: cs:~openstack-charmers-next/ovn-dedicated-chassis + charm: ../../../ovn-dedicated-chassis.charm num_units: 2 options: source: *openstack-origin diff --git a/src/tests/bundles/focal-yoga.yaml b/src/tests/bundles/focal-yoga.yaml index fcbf9b2..ebccb78 100644 --- a/src/tests/bundles/focal-yoga.yaml +++ b/src/tests/bundles/focal-yoga.yaml @@ -1,6 +1,8 @@ variables: openstack-origin: &openstack-origin cloud:focal-yoga +local_overlay_enabled: False + series: focal comment: @@ -22,10 +24,11 @@ machines: applications: vault-mysql-router: - charm: cs:~openstack-charmers-next/mysql-router + charm: ch:mysql-router + channel: latest/edge mysql-innodb-cluster: - charm: cs:~openstack-charmers-next/mysql-innodb-cluster + charm: ch:mysql-innodb-cluster num_units: 3 options: source: *openstack-origin @@ -33,15 +36,17 @@ applications: - '0' - '1' - '2' + channel: latest/edge vault: - charm: cs:~openstack-charmers-next/vault + charm: ch:vault num_units: 1 to: - '3' + channel: latest/edge ovn-central: - charm: cs:~openstack-charmers-next/ovn-central + charm: ch:ovn-central num_units: 3 options: source: *openstack-origin @@ -49,12 +54,13 @@ applications: - '4' - '5' - '6' + channel: latest/edge nrpe: charm: cs:nrpe ovn-dedicated-chassis: - charm: cs:~openstack-charmers-next/ovn-dedicated-chassis + charm: ../../../ovn-dedicated-chassis.charm num_units: 2 options: source: *openstack-origin diff --git a/src/tests/bundles/hirsute-wallaby.yaml b/src/tests/bundles/hirsute-wallaby.yaml deleted file mode 100644 index ea83f15..0000000 --- a/src/tests/bundles/hirsute-wallaby.yaml +++ /dev/null @@ -1,79 +0,0 @@ -variables: - openstack-origin: &openstack-origin distro - -series: hirsute - -comment: -- 'machines section to decide order of deployment. database sooner = faster' -machines: - '0': - constraints: mem=3072M - '1': - constraints: mem=3072M - '2': - constraints: mem=3072M - '3': - '4': - '5': - '6': - '7': - '8': - -applications: - - vault-mysql-router: - charm: cs:~openstack-charmers-next/mysql-router - - mysql-innodb-cluster: - charm: cs:~openstack-charmers-next/mysql-innodb-cluster - num_units: 3 - options: - source: *openstack-origin - to: - - '0' - - '1' - - '2' - - vault: - charm: cs:~openstack-charmers-next/vault - num_units: 1 - to: - - '3' - - nrpe: - charm: cs:nrpe - - ovn-central: - charm: cs:~openstack-charmers-next/ovn-central - num_units: 3 - options: - source: *openstack-origin - to: - - '4' - - '5' - - '6' - - ovn-dedicated-chassis: - charm: ../../../ovn-dedicated-chassis - num_units: 2 - options: - source: *openstack-origin - to: - - '7' - - '8' - - -relations: - - - - 'vault-mysql-router:db-router' - - 'mysql-innodb-cluster:db-router' - - - 'vault:shared-db' - - 'vault-mysql-router:shared-db' - - - 'ovn-central:certificates' - - 'vault:certificates' - - - 'ovn-dedicated-chassis:ovsdb' - - 'ovn-central:ovsdb' - - - 'ovn-dedicated-chassis:certificates' - - 'vault:certificates' - - - 'ovn-dedicated-chassis:nrpe-external-master' - - 'nrpe:nrpe-external-master' diff --git a/src/tests/bundles/impish-xena.yaml b/src/tests/bundles/impish-xena.yaml index 941cfed..1995dd0 100644 --- a/src/tests/bundles/impish-xena.yaml +++ b/src/tests/bundles/impish-xena.yaml @@ -1,6 +1,8 @@ variables: openstack-origin: &openstack-origin distro +local_overlay_enabled: False + series: impish comment: @@ -22,10 +24,11 @@ machines: applications: vault-mysql-router: - charm: cs:~openstack-charmers-next/mysql-router + charm: ch:mysql-router + channel: latest/edge mysql-innodb-cluster: - charm: cs:~openstack-charmers-next/mysql-innodb-cluster + charm: ch:mysql-innodb-cluster num_units: 3 options: source: *openstack-origin @@ -33,18 +36,20 @@ applications: - '0' - '1' - '2' + channel: latest/edge vault: - charm: cs:~openstack-charmers-next/vault + charm: ch:vault num_units: 1 to: - '3' + channel: latest/edge nrpe: charm: cs:nrpe ovn-central: - charm: cs:~openstack-charmers-next/ovn-central + charm: ch:ovn-central num_units: 3 options: source: *openstack-origin @@ -52,9 +57,10 @@ applications: - '4' - '5' - '6' + channel: latest/edge ovn-dedicated-chassis: - charm: ../../../ovn-dedicated-chassis + charm: ../../../ovn-dedicated-chassis.charm num_units: 2 options: source: *openstack-origin diff --git a/src/tests/bundles/jammy-yoga.yaml b/src/tests/bundles/jammy-yoga.yaml index a6255a1..a27541e 100644 --- a/src/tests/bundles/jammy-yoga.yaml +++ b/src/tests/bundles/jammy-yoga.yaml @@ -1,6 +1,8 @@ variables: openstack-origin: &openstack-origin distro +local_overlay_enabled: False + series: jammy comment: @@ -22,10 +24,11 @@ machines: applications: vault-mysql-router: - charm: cs:~openstack-charmers-next/mysql-router + charm: ch:mysql-router + channel: latest/edge mysql-innodb-cluster: - charm: cs:~openstack-charmers-next/mysql-innodb-cluster + charm: ch:mysql-innodb-cluster num_units: 3 options: source: *openstack-origin @@ -33,18 +36,20 @@ applications: - '0' - '1' - '2' + channel: latest/edge vault: - charm: cs:~openstack-charmers-next/vault + charm: ch:vault num_units: 1 to: - '3' + channel: latest/edge nrpe: charm: cs:nrpe ovn-central: - charm: cs:~openstack-charmers-next/ovn-central + charm: ch:ovn-central num_units: 3 options: source: *openstack-origin @@ -52,9 +57,10 @@ applications: - '4' - '5' - '6' + channel: latest/edge ovn-dedicated-chassis: - charm: ../../../ovn-dedicated-chassis + charm: ../../../ovn-dedicated-chassis.charm num_units: 2 options: source: *openstack-origin diff --git a/src/tests/tests.yaml b/src/tests/tests.yaml index cc6df3e..4ee7eb0 100644 --- a/src/tests/tests.yaml +++ b/src/tests/tests.yaml @@ -1,35 +1,29 @@ charm_name: ovn-dedicated-chassis gate_bundles: -- bionic-ussuri -- focal-ussuri -- focal-victoria -- focal-wallaby - focal-xena -- hirsute-wallaby - impish-xena smoke_bundles: -- focal-ussuri +- focal-xena dev_bundles: -- bionic-train - focal-yoga - jammy-yoga target_deploy_status: ovn-central: workload-status: waiting - workload-status-message: "'ovsdb-peer' incomplete, 'certificates' awaiting server certificate data" + workload-status-message-prefix: "'ovsdb-peer' incomplete, 'certificates' awaiting server certificate data" ovn-dedicated-chassis: workload-status: waiting - workload-status-message: "'certificates' awaiting server certificate data" + workload-status-message-prefix: "'certificates' awaiting server certificate data" vault: workload-status: blocked - workload-status-message: Vault needs to be initialized + workload-status-message-prefix: Vault needs to be initialized nrpe: workload-status: blocked - workload-status-message: "Nagios server not configured or related" + workload-status-message-prefix: "Nagios server not configured or related" configure: - zaza.openstack.charm_tests.vault.setup.auto_initialize_no_validation @@ -40,6 +34,4 @@ tests: tests_options: force_deploy: - - hirsute-wallaby # workaround for lp:1933643 - - impish-xena # because of nrpe charm not supporting hirsute - jammy-yoga diff --git a/test-requirements.txt b/test-requirements.txt index bb1307f..a11a7d0 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -51,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 diff --git a/tox.ini b/tox.ini index faf6092..2d60b8a 100644 --- a/tox.ini +++ b/tox.ini @@ -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