From 11687b2789c510b360729dab70ae9935704b9188 Mon Sep 17 00:00:00 2001 From: yhua Date: Mon, 5 Sep 2016 15:40:49 +0800 Subject: [PATCH] add version support in env --- Deploy/prepare | 12 +++++++++++- Deploy/templates/ui/env | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Deploy/prepare b/Deploy/prepare index c77af01b4..f1db506e1 100755 --- a/Deploy/prepare +++ b/Deploy/prepare @@ -7,6 +7,7 @@ import string import os import sys import argparse +import commands from io import open if sys.version_info[:3][0] == 2: @@ -57,6 +58,14 @@ token_expiration = rcp.get("configuration", "token_expiration") verify_remote_cert = rcp.get("configuration", "verify_remote_cert") ######## +#Read version form .git +status, output = commands.getstatusoutput('git describe --tags') +if status == 0: + version = output +else: + version = 'UNKNOWN' +####### + ui_secret = ''.join(random.choice(string.ascii_letters+string.digits) for i in range(16)) base_dir = os.path.dirname(__file__) @@ -108,7 +117,8 @@ render(os.path.join(templates_dir, "ui", "env"), use_compressed_js=use_compressed_js, ui_secret=ui_secret, verify_remote_cert=verify_remote_cert, - token_expiration=token_expiration) + token_expiration=token_expiration, + version=version) render(os.path.join(templates_dir, "ui", "app.conf"), ui_conf, diff --git a/Deploy/templates/ui/env b/Deploy/templates/ui/env index fe8f860d2..c4afba44b 100644 --- a/Deploy/templates/ui/env +++ b/Deploy/templates/ui/env @@ -20,3 +20,4 @@ EXT_ENDPOINT=$ui_url TOKEN_URL=http://ui VERIFY_REMOTE_CERT=$verify_remote_cert TOKEN_EXPIRATION=$token_expiration +VERSION=$version