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

Add version information to /sample/info endpoint #604

Open
corneliusroemer opened this issue Oct 7, 2024 · 6 comments · May be fixed by #680 or #679
Open

Add version information to /sample/info endpoint #604

corneliusroemer opened this issue Oct 7, 2024 · 6 comments · May be fixed by #680 or #679
Assignees

Comments

@corneliusroemer
Copy link
Contributor

I was hoping I could get the version of LAPIS that's serving a response from the /sample/info endpoint but it turns out I can't.

Might be nice to add this:
Google Chrome 2024-10-07 11 41 38

This came up as part of testing new versions of LAPIS and SILO on staging.pathoplexus.org and wondering whether I was already getting responses from the new versions (without having to log in to argocd, which of course works but takes more clicks)

@fengelniederhammer
Copy link
Contributor

I also thought about adding this, but unfortunately it isn't that simple:

  • for a released version SILO and LAPIS could simply read its version from a file and return it
  • for builds on branches, we should not display a version number, but probably
    • the commit hash when running a Docker image that was built on CI
    • "local" when running it locally.

@Taepper
Copy link
Collaborator

Taepper commented Oct 8, 2024

Actually, we always have the version.txt file in the project root (automatically updated by release please).

Then the branches would return the "latest released version"

@Taepper
Copy link
Collaborator

Taepper commented Dec 11, 2024

We might use the approach from GenSpectrum/LAPIS#1019 for SILO running in Docker images

@pflanze
Copy link
Contributor

pflanze commented Jan 22, 2025

I suggest to use the following script:

#!/bin/bash
set -meuo pipefail
IFS=

header_path=include/exact_version.h

# Take version from current commit if in the git checkout, otherwise
# fall back to the version from release please.
v=$(git describe --tags --match 'v*' 2> /dev/null || { echo -n v; cat version.txt; })

printf '#define PROGRAM_VERSION "%q"\n' "$v" > "$header_path"

# Prevent the new mtime of the file from leading to spurious rebuilds:
touch -d 1972/01/01 "$header_path"

Add the path include/exact_version.h to .gitignore, and run the above script as first step during the build (I don't know cmake so am not useful here).

@pflanze
Copy link
Contributor

pflanze commented Jan 22, 2025

And include the file in the right place of course. PS. add a #pragma once too:

printf '#pragma once\n\n#define PROGRAM_VERSION "%q"\n' "$v" > "$header_path"

@Taepper Taepper linked a pull request Jan 22, 2025 that will close this issue
2 tasks
@Taepper
Copy link
Collaborator

Taepper commented Jan 22, 2025

Thank you very much!

git describe --tags --match 'v*' 2> /dev/null seems to really do exactly what we want. The rebuilding problem due to mtime is already solved by just using a preprocessor definition. I also believe it is less complex as we do not need to dynamically generate a file. I pushed a draft which shows how to do it with cmake to #679

@fengelniederhammer fengelniederhammer self-assigned this Jan 22, 2025
@fengelniederhammer fengelniederhammer linked a pull request Jan 22, 2025 that will close this issue
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants