Report git sha in status page version

If the installed version of Zuul is not a release, report the
git sha along with the version on the status page.

This is calculated at startup and so should not change during
the life of the process.

Change-Id: Ia48a3765f0dd7ef369b2b30ac1d79cc1f52045b6
This commit is contained in:
James E. Blair 2018-04-26 14:23:35 -07:00
parent f3194ce547
commit a30eee31b5
2 changed files with 20 additions and 1 deletions

View File

@ -257,7 +257,11 @@ class Scheduler(threading.Thread):
'/var/lib/zuul/scheduler.socket')
self.command_socket = commandsocket.CommandSocket(command_socket)
self.zuul_version = zuul_version.version_info.release_string()
if zuul_version.is_release is False:
self.zuul_version = "%s %s" % (zuul_version.release_string,
zuul_version.git_version)
else:
self.zuul_version = zuul_version.release_string
self.last_reconfigured = None
self.tenant_last_reconfigured = {}
self.autohold_requests = {}

View File

@ -15,6 +15,21 @@
# License for the specific language governing permissions and limitations
# under the License.
import json
import pbr.version
import pkg_resources
version_info = pbr.version.VersionInfo('zuul')
release_string = version_info.release_string()
is_release = None
git_version = None
try:
_metadata = json.loads(
pkg_resources.get_distribution('zuul').get_metadata('pbr.json'))
if _metadata:
is_release = _metadata['is_release']
git_version = _metadata['git_version']
except Exception:
pass