Repository navigation
Report the BuEM version on health and every response - #43
Merged
Merged
Conversation
GET /api/health returns the release and commit that serve it, and every response carries them in X-BuEM-Version and X-BuEM-Commit, so a stored result can record the version that computed it. The published image carries neither .git nor _version.py, so docker-publish.yml passes the release tag and commit as build arguments; without them the image would report the 0.1.3 fallback.
model_metadata.model_version was the fixed string BUEM-v3.0. It is now the release that computed the result, and the new model_commit holds the commit, so a stored response body records both without the headers. /api/health, the X-BuEM-* headers and model_metadata read the same values from buem.build_info().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
BuEM now reports which release and commit served a request.
Behaviour
GET /api/healthreturns{"status": "ok", "version": "6.9.0", "commit": "<sha>"}./api/processand/api/run, carries the same values in theX-BuEM-VersionandX-BuEM-Commitheaders./api/processresult records them infeatures[].properties.buem.model_metadata:model_versionis the release instead of the fixedBUEM-v3.0, and the newmodel_commitis the commit. The pinned response schema already allows extra keys inmodel_metadata.6.10.0). An image built from a push toenerplanetreportsenerplanetand its commit, so the commit distinguishes non-release images.versionis the installed package version andcommitisunknown, unlessBUEM_VERSIONandBUEM_COMMITare set.Changes
buem.build_info(): the one source of version and commit, read by/api/health, the headers andmodel_metadata.api_server.py: version and commit on/api/health, and anafter_requesthook that adds the two headers.geojson_processor.py:model_versionandmodel_commitfrombuild_info().Dockerfileanddocker-publish.yml:BUEM_VERSIONandBUEM_COMMITbuild arguments, from the metadata-action version andgithub.sha. The image has neither.gitnor_version.py, so without them it reports the0.1.3fallback.openapi.yaml,response_format.rstand the CHANGELOG document them.Testing
tests/test_version_report.py: health body and headers with the variables set, the package-version fallback without them, andmodel_version/model_commitin a result. All three fail before the change.pytest -q -m "not slow": 354 passed, 29 skipped.ruff checkandmypy srcclean.