Migrate to charmhub handling

This commit is contained in:
Chris MacNaughton 2022-03-25 13:53:33 +01:00
parent 611f22e54b
commit 0461a0cc81
5 changed files with 75 additions and 4 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.

26
charmcraft.yaml Normal file
View File

@ -0,0 +1,26 @@
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

@ -12,6 +12,7 @@
name: focal-pacific
parent: func-target
dependencies:
charm-build
- osci-lint
- tox-py35
- tox-py36
@ -19,3 +20,15 @@
- tox-py38
vars:
tox_extra_args: focal-pacific
- job:
name: focal-quincy
parent: func-target
dependencies:
- charm-build
- osci-lint
- tox-py35
- tox-py36
- tox-py37
- tox-py38
vars:
tox_extra_args: focal-quincy

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
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
@ -130,4 +143,4 @@ commands =
[flake8]
# Ignore E902 because the unit_tests directory is missing in the built charm.
ignore = E402,E226,E902,W504
ignore = E402,E226,E902