From e8009c2d26f8b871909dbbd408ae46b73b98ed93 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sat, 19 Dec 2020 06:51:10 -0600 Subject: [PATCH] adding version endpoint --- .dockerignore | 3 ++- .gitignore | 3 ++- Makefile | 13 +++++++++---- frigate/http.py | 5 +++++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/.dockerignore b/.dockerignore index 0fb206db6..c6f4105f3 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,4 +3,5 @@ docs/ .gitignore debug config/ -*.pyc \ No newline at end of file +*.pyc +.git \ No newline at end of file diff --git a/.gitignore b/.gitignore index dbd8b9741..57f373c26 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ debug config/config.yml models *.mp4 -*.db \ No newline at end of file +*.db +frigate/version.py \ No newline at end of file diff --git a/Makefile b/Makefile index 8cc2ca33b..ec608f33c 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,17 @@ default_target: amd64_frigate +COMMIT_HASH := $(shell git log -1 --pretty=format:"%h") + +version: + echo "VERSION='0.8.0-$(COMMIT_HASH)'" > frigate/version.py + amd64_wheels: docker build --tag blakeblackshear/frigate-wheels:amd64 --file docker/Dockerfile.wheels . amd64_ffmpeg: docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-amd64 --file docker/Dockerfile.ffmpeg.amd64 . -amd64_frigate: +amd64_frigate: version docker build --tag frigate-base --build-arg ARCH=amd64 --file docker/Dockerfile.base . docker build --tag frigate --file docker/Dockerfile.amd64 . @@ -18,7 +23,7 @@ amd64nvidia_wheels: amd64nvidia_ffmpeg: docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-amd64nvidia --file docker/Dockerfile.ffmpeg.amd64nvidia . -amd64nvidia_frigate: +amd64nvidia_frigate: version docker build --tag frigate-base --build-arg ARCH=amd64nvidia --file docker/Dockerfile.base . docker build --tag frigate --file docker/Dockerfile.amd64nvidia . @@ -30,7 +35,7 @@ aarch64_wheels: aarch64_ffmpeg: docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-aarch64 --file docker/Dockerfile.ffmpeg.aarch64 . -aarch64_frigate: +aarch64_frigate: version docker build --tag frigate-base --build-arg ARCH=aarch64 --file docker/Dockerfile.base . docker build --tag frigate --file docker/Dockerfile.aarch64 . @@ -42,7 +47,7 @@ armv7_wheels: armv7_ffmpeg: docker build --tag blakeblackshear/frigate-ffmpeg:1.0.0-armv7 --file docker/Dockerfile.ffmpeg.armv7 . -armv7_frigate: +armv7_frigate: version docker build --tag frigate-base --build-arg ARCH=armv7 --file docker/Dockerfile.base . docker build --tag frigate --file docker/Dockerfile.armv7 . diff --git a/frigate/http.py b/frigate/http.py index 641ed80a7..cfa8db026 100644 --- a/frigate/http.py +++ b/frigate/http.py @@ -13,6 +13,7 @@ from peewee import SqliteDatabase, operator, fn, DoesNotExist from playhouse.shortcuts import model_to_dict from frigate.models import Event +from frigate.version import VERSION logger = logging.getLogger(__name__) @@ -144,6 +145,10 @@ def events(): def config(): return jsonify(current_app.frigate_config.to_dict()) +@bp.route('/version') +def version(): + return VERSION + @bp.route('/stats') def stats(): camera_metrics = current_app.camera_metrics