diff --git a/.gitignore b/.gitignore index aa85be92..347e71fc 100644 --- a/.gitignore +++ b/.gitignore @@ -6,6 +6,7 @@ revision .testrepository *.sw[nop] *.pyc +*.charm __pycache__/ .project .pydevproject 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 08289d66..ab490b3c 100644 --- a/osci.yaml +++ b/osci.yaml @@ -4,4 +4,7 @@ - charm-unit-jobs-py39 - charm-xena-functional-jobs - charm-yoga-functional-jobs - + vars: + needs_charm_build: true + charm_build_name: rabbitmq-server + 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 5b3f7757..5c2539f8 100644 --- a/tests/bundles/focal-xena.yaml +++ b/tests/bundles/focal-xena.yaml @@ -42,7 +42,7 @@ applications: channel: latest/edge rabbitmq-server: - charm: "../../../rabbitmq-server" + charm: ../../rabbitmq-server.charm num_units: 3 constraints: cpu-cores=2 diff --git a/tests/bundles/focal-yoga.yaml b/tests/bundles/focal-yoga.yaml index 1abac229..58851f9e 100644 --- a/tests/bundles/focal-yoga.yaml +++ b/tests/bundles/focal-yoga.yaml @@ -42,7 +42,7 @@ applications: channel: latest/edge rabbitmq-server: - charm: "../../../rabbitmq-server" + charm: ../../rabbitmq-server.charm num_units: 3 constraints: cpu-cores=2 diff --git a/tests/bundles/impish-xena.yaml b/tests/bundles/impish-xena.yaml index d67c783d..76f24b57 100644 --- a/tests/bundles/impish-xena.yaml +++ b/tests/bundles/impish-xena.yaml @@ -42,7 +42,7 @@ applications: channel: latest/edge rabbitmq-server: - charm: "../../../rabbitmq-server" + charm: ../../rabbitmq-server.charm num_units: 3 constraints: cpu-cores=2 diff --git a/tests/bundles/jammy-yoga.yaml b/tests/bundles/jammy-yoga.yaml index a2ef8975..3e209aa3 100644 --- a/tests/bundles/jammy-yoga.yaml +++ b/tests/bundles/jammy-yoga.yaml @@ -42,7 +42,7 @@ applications: channel: latest/edge rabbitmq-server: - charm: "../../../rabbitmq-server" + charm: ../../rabbitmq-server.charm num_units: 3 constraints: cpu-cores=2 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