From d5e90e9f1d696811b1234ea2c67eabd0b50fabb7 Mon Sep 17 00:00:00 2001 From: Carl Csaposs Date: Fri, 13 Oct 2023 10:40:43 +0000 Subject: [PATCH] Add git hash to charm_version while charm versioning spec is pending review --- tox.ini | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tox.ini b/tox.ini index 5830d8374..351a3f202 100644 --- a/tox.ini +++ b/tox.ini @@ -23,12 +23,20 @@ allowlist_externals = {[testenv]allowlist_externals} charmcraft mv + cp commands_pre = poetry export --only main,charm-libs --output requirements.txt + # Workaround to add unique identifier (git hash) to charm version while specification + # DA053 - Charm versioning + # (https://docs.google.com/document/d/1Jv1jhWLl8ejK3iJn7Q3VbCIM9GIhp8926bgXpdtx-Sg/edit?pli=1) + # is pending review. + cp charm_version charm_version.backup + python -c 'import pathlib; import subprocess; file = pathlib.Path("charm_version"); version = file.read_text().strip(); git_hash=subprocess.run(["git", "describe", "--always"], capture_output=True, check=True, encoding="utf-8").stdout; file.write_text(f"{version}+{git_hash}")' commands = build: charmcraft pack {posargs} commands_post = mv requirements.txt requirements-last-build.txt + mv charm_version.backup charm_version [testenv:format] description = Apply coding style standards to code