This repository was archived by the owner on Feb 16, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 4 files changed +11
-5
lines changed
Expand file tree Collapse file tree 4 files changed +11
-5
lines changed Original file line number Diff line number Diff line change 11#! /usr/bin/env sh
22
3- echo " Setting VERSION='${CI_COMMIT_REF_NAME} -${CI_COMMIT_SHORT_SHA} ' in src/constants.py"
4- echo " VERSION = '${CI_COMMIT_REF_NAME} -${CI_COMMIT_SHORT_SHA} '" >> src/constants.py
3+ echo " Setting VERSION"
4+ find . -name .git -type d -prune -o -type f -name constants.py -exec sed -i s/^VERSION.* /VERSION\ =\ \' ${CI_COMMIT_REF_NAME} \' /g {} + -exec grep VERSION {} +
5+ echo " Setting BUILD"
6+ find . -name .git -type d -prune -o -type f -name constants.py -exec sed -i s/^BUILD.* /BUILD\ =\ \' ${CI_COMMIT_SHORT_SHA} \' /g {} + -exec grep BUILD {} +
Original file line number Diff line number Diff line change 1010import pygelf
1111from prometheus_client import start_http_server
1212from prometheus_client .core import REGISTRY , GaugeMetricFamily
13- import constants
13+ from . lib import constants
1414
1515LOG = logging .getLogger (__name__ )
1616logging .basicConfig (
2121)
2222
2323FILENAME = os .path .splitext (sys .modules ['__main__' ].__file__ )[0 ]
24+ version = f'{ constants .VERSION } -{ constants .BUILD } '
2425
2526
2627def configure_logging ():
@@ -166,8 +167,7 @@ def collect(self):
166167if __name__ == '__main__' :
167168 configure_logging ()
168169 PORT = int (os .environ .get ('PORT' , 9308 ))
169- # pylint: disable=no-member
170- LOG .info ("Starting {} {} on port {}" .format (FILENAME , constants .VERSION , PORT ))
170+ LOG .info ("Starting {} {} on port {}" .format (FILENAME , version , PORT ))
171171 REGISTRY .register (EtherscanCollector ())
172172 start_http_server (PORT )
173173 while True :
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+ # -*- coding: utf-8 -*-
Original file line number Diff line number Diff line change 22# -*- coding: utf-8 -*-
33""" Constants declarations """
44
5+ # These get set at build time
56VERSION = None
7+ BUILD = None
You can’t perform that action at this time.
0 commit comments