-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjenaco
executable file
·57 lines (45 loc) · 1.91 KB
/
jenaco
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env python
##########################################################################################
#
# jenaco -- reflect Jenkins Builds in Agile Central
#
USAGE = """
Usage: python jenaco.py <config_file.yml>
where the config file named must have content in YAML format with 3 sections;
one for the Agile Central system,
one for the Jenkins system,
one for the Service configuration
"""
##########################################################################################
import sys
import re
import traceback
import inspect
sys.path.insert(0, 'bldeif')
from bldeif.bld_connector_runner import BuildConnectorRunner
from bldeif.utils.eif_exception import ConfigurationError, OperationalError
PROG = 'jenaco'
##########################################################################################
def main(args):
try:
connector_runner = BuildConnectorRunner(args)
connector_runner.run()
except ConfigurationError as msg:
# raising a ConfigurationError will cause an ERROR to be logged
sys.stderr.write('ERROR: %s detected a fatal configuration error. See log file.\n' % PROG)
sys.exit(1)
except Exception as msg:
sys.stderr.write('ERROR: %s encountered an ERROR condition.\n' % PROG)
# blurt out a formatted stack trace
excp_type, excp_value, tb = sys.exc_info()
traceback.print_tb(tb)
mo = re.search(r"'(?P<ex_name>.+)'", str(excp_type))
if mo:
excp_type = mo.group('ex_name').replace('exceptions.', '').replace('bldeif.utils.', '')
sys.stderr.write('%s: %s\n' % (excp_type, str(excp_value)))
sys.exit(2)
sys.exit(0)
##########################################################################################
##########################################################################################
if __name__ == '__main__':
main(sys.argv[1:])