From aed4289697fe768232c8547220a141cd3158f78e Mon Sep 17 00:00:00 2001 From: Michele Carignani <michele.carignani@etsi.org> Date: Mon, 30 Nov 2020 19:41:28 +0100 Subject: [PATCH] show revision information, v0.0.6 --- env_example | 3 ++- relaunch.sh | 2 ++ src/config.py | 3 +++ src/templates/home.html | 5 +++++ src/web_app.py | 9 ++++++++- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/env_example b/env_example index 3a7e2ce..c451ac1 100644 --- a/env_example +++ b/env_example @@ -1 +1,2 @@ -TOSCAIE_SECRET='super_secret_key' \ No newline at end of file +TOSCAIE_SECRET='super_secret_key' +LAST_COMMIT='something' \ No newline at end of file diff --git a/relaunch.sh b/relaunch.sh index 8f1efc5..aeb943f 100755 --- a/relaunch.sh +++ b/relaunch.sh @@ -15,6 +15,8 @@ if [ "$1" == "stop" ] ; then exit 0 fi +sed -i -E "s/(LAST_COMMIT=').+(')/\1$(git log -n 1 --oneline)'/" env + docker build -t tosca-ie-sample:latest . docker run -d --restart unless-stopped -t -p 5000:5000 --env-file ./env tosca-ie-sample diff --git a/src/config.py b/src/config.py index 8dc47a1..75593c3 100644 --- a/src/config.py +++ b/src/config.py @@ -17,3 +17,6 @@ VERSION = "0.0.5" SECRET = env_or_false("TOSCAIE_SECRET") or 'super_secret_key' +LAST_COMMIT = env_or_false("LAST_COMMIT") + +REPO_URL = "https://labs.etsi.org/rep/cti-tools/tosca2doc/tree/" \ No newline at end of file diff --git a/src/templates/home.html b/src/templates/home.html index 36a6167..6f92c12 100644 --- a/src/templates/home.html +++ b/src/templates/home.html @@ -26,12 +26,17 @@ <center> <h1>TOSCA import/export</h1> <h5 style="margin-bottom: 50px">v {{ VERSION }}</h5> + <p> The tools available on this page are provided with NO GUARANTEES and shall be used ONLY for validation of ETSI Specifications. <br/> <br/> To report bugs, questions or feature request, please use the <a href="https://forge.etsi.org/bugzilla/enter_bug.cgi?product=Forge">the issue tracker at ETSI Forge</a> and select "TOSCA tools" as component. <br/> +{% if last_rev %} + Current revision is <a href="{{rev_link}}">{{last_rev}}</a> +{% endif %} +<br/> For any other inquiry, contact <a href="mailto:cti_support@etsi.org">ETSI CTI</a></p> </center> <div class="row"> diff --git a/src/web_app.py b/src/web_app.py index 53d6935..d787300 100644 --- a/src/web_app.py +++ b/src/web_app.py @@ -69,11 +69,18 @@ def hello(): ''' Render home page ''' + if config.LAST_COMMIT is not False: + link = config.REPO_URL+config.LAST_COMMIT.split(" ")[0] + else: + link = "#" + return render_template( "./home.html", VERSION=config.VERSION, doc_allowed_versions=doc2tosca.allowed_versions, - default_tosca_version=doc2tosca.DEFAULT_TOSCA_VERSION + default_tosca_version=doc2tosca.DEFAULT_TOSCA_VERSION, + last_rev=config.LAST_COMMIT, + rev_link=link ) @app.route("/doc2tosca-info") -- GitLab