mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 12:15:20 +01:00
add version support in env
This commit is contained in:
parent
1853d636a5
commit
11687b2789
@ -7,6 +7,7 @@ import string
|
|||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
|
import commands
|
||||||
from io import open
|
from io import open
|
||||||
|
|
||||||
if sys.version_info[:3][0] == 2:
|
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")
|
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))
|
ui_secret = ''.join(random.choice(string.ascii_letters+string.digits) for i in range(16))
|
||||||
|
|
||||||
base_dir = os.path.dirname(__file__)
|
base_dir = os.path.dirname(__file__)
|
||||||
@ -108,7 +117,8 @@ render(os.path.join(templates_dir, "ui", "env"),
|
|||||||
use_compressed_js=use_compressed_js,
|
use_compressed_js=use_compressed_js,
|
||||||
ui_secret=ui_secret,
|
ui_secret=ui_secret,
|
||||||
verify_remote_cert=verify_remote_cert,
|
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"),
|
render(os.path.join(templates_dir, "ui", "app.conf"),
|
||||||
ui_conf,
|
ui_conf,
|
||||||
|
@ -20,3 +20,4 @@ EXT_ENDPOINT=$ui_url
|
|||||||
TOKEN_URL=http://ui
|
TOKEN_URL=http://ui
|
||||||
VERIFY_REMOTE_CERT=$verify_remote_cert
|
VERIFY_REMOTE_CERT=$verify_remote_cert
|
||||||
TOKEN_EXPIRATION=$token_expiration
|
TOKEN_EXPIRATION=$token_expiration
|
||||||
|
VERSION=$version
|
||||||
|
Loading…
Reference in New Issue
Block a user