Skip to content

Commit

Permalink
Add git hash to charm_version while charm versioning spec is pending …
Browse files Browse the repository at this point in the history
…review
  • Loading branch information
carlcsaposs-canonical committed Oct 13, 2023
1 parent d90750a commit d5e90e9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d5e90e9

Please sign in to comment.