Add osci yaml

Add project templates and variables to osci.yaml
Add rename script to change built charm name to
charm_build_name defined in osci.yaml

Change-Id: I737badefa19fd8d65def0ab79cadaa63d7d93b5a
This commit is contained in:
Hemanth Nakkina 2022-09-09 08:56:09 +05:30
parent 3f3cfa2a8d
commit b010bab520
4 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,12 @@
- project:
templates:
- charm-unit-jobs-py38
- charm-unit-jobs-py310
- charm-publish-jobs
vars:
needs_charm_build: true
charm_build_name: ovn-relay-k8s
build_type: charmcraft
publish_charm: true
charmcraft_channel: 2.0/stable
publish_channel: latest/edge

13
charms/ovn-relay-k8s/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

View File

@ -25,7 +25,7 @@ develop a new k8s charm using the Operator Framework:
""" """
import logging import logging
from typing import List from typing import List, Mapping
from ops.framework import StoredState from ops.framework import StoredState
from ops.main import main from ops.main import main
@ -76,6 +76,15 @@ class OVNRelayOperatorCharm(ovn_charm.OSBaseOVNOperatorCharm):
ovn_ctxts.OVNDBConfigContext(self, "ovs_db")) ovn_ctxts.OVNDBConfigContext(self, "ovs_db"))
return contexts return contexts
@property
def databases(self) -> Mapping[str, str]:
"""Databases needed to support this charm.
Return empty dict as no mysql databases are
required.
"""
return {}
class OVNRelayXenaOperatorCharm(OVNRelayOperatorCharm): class OVNRelayXenaOperatorCharm(OVNRelayOperatorCharm):

View File

@ -29,6 +29,7 @@ allowlist_externals =
git git
charmcraft charmcraft
fetch-libs.sh fetch-libs.sh
rename.sh
deps = deps =
-r{toxinidir}/test-requirements.txt -r{toxinidir}/test-requirements.txt
@ -37,6 +38,7 @@ basepython = python3
deps = deps =
commands = commands =
charmcraft -v pack charmcraft -v pack
{toxinidir}/rename.sh
[testenv:fetch] [testenv:fetch]
basepython = python3 basepython = python3