Skip to content

Commit

Permalink
Update to classic charms to build using charmcraft in CI
Browse files Browse the repository at this point in the history
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: I0febbbf7da990026b9578a3512c99539eb03bbc0
  • Loading branch information
ajkavanagh committed Feb 15, 2022
1 parent 2079a9f commit 1c88770
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 5 deletions.
7 changes: 7 additions & 0 deletions build-requirements.txt
Original file line number Diff line number Diff line change
@@ -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.
1 change: 1 addition & 0 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ parts:
source: .
prime:
- actions/*
- charmhelpers/*
- files/*
- hooks/*
- lib/*
Expand Down
Binary file added neutron-api.charm
Binary file not shown.
4 changes: 4 additions & 0 deletions osci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@
- charm-unit-jobs-py39
- charm-xena-functional-jobs
- charm-yoga-functional-jobs
vars:
needs_charm_build: true
charm_build_name: neutron-api
build_type: charmcraft
13 changes: 13 additions & 0 deletions rename.sh
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion tests/bundles/focal-xena.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ applications:
source: *openstack-origin
channel: latest/edge
neutron-api:
charm: ../../
charm: ../../neutron-api.charm
num_units: 1
options:
manage-neutron-plugin-legacy-mode: True
Expand Down
2 changes: 1 addition & 1 deletion tests/bundles/focal-yoga.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ applications:
source: *openstack-origin
channel: latest/edge
neutron-api:
charm: ../../
charm: ../../neutron-api.charm
num_units: 1
options:
manage-neutron-plugin-legacy-mode: True
Expand Down
2 changes: 1 addition & 1 deletion tests/bundles/impish-xena.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ applications:
source: *openstack-origin
channel: latest/edge
neutron-api:
charm: ../../
charm: ../../neutron-api.charm
num_units: 1
options:
manage-neutron-plugin-legacy-mode: True
Expand Down
2 changes: 1 addition & 1 deletion tests/bundles/jammy-yoga.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ applications:
source: *openstack-origin
channel: latest/edge
neutron-api:
charm: ../../
charm: ../../neutron-api.charm
num_units: 1
options:
manage-neutron-plugin-legacy-mode: True
Expand Down
12 changes: 11 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1c88770

Please sign in to comment.