Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git describe --always --tags issues #282

Open
silenius opened this issue Jun 28, 2024 · 1 comment
Open

git describe --always --tags issues #282

silenius opened this issue Jun 28, 2024 · 1 comment

Comments

@silenius
Copy link

In dashboard/templates/dashboard/_footer.html the version is displayed. It uses:

def human_readable_git_version_number() -> str:
    """Return the git tag name (if available) or the git commit hash (if not)"""
    return subprocess.check_output(
        ["git", "describe", "--always", "--tags"], encoding="UTF-8"
    ).strip()

from dashboard/utils.py under the hood.

In our deployment only some directories are owned and/or writable by the user (for security reasons) and git describe fails:

www-py311-2024Q2% git describe --always --tags
fatal: detected dubious ownership in repository at '/usr/local/www/sites/gbif-alert'
To add an exception for this directory, call:

        git config --global --add safe.directory /usr/local/www/sites/gbif-alert

Another potential issue is that subprocess.check_output forks a new process which could be an issue if many clients are hitting the frontpage at the same time

@niconoe
Copy link
Member

niconoe commented Jul 1, 2024

Thanks @silenius, indeed I wonder for a long time is this approach is sane (ideally, even having the git repository at the deployed location shouldn't be a requirement, I think). I'll look for another approach, the good thing about this one was that it worked everywhere and was easy, but something like running that command at release time and storing its output in a text file might be better!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants