-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathread_job_details.py
46 lines (32 loc) · 1.32 KB
/
read_job_details.py
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
#!/.autodirect/app/Python-2.release/bin/python
# -*- coding: utf-8 -*-
"""
Owner : Oron Golan <[email protected]>
Created on : Oct 29, 2016
Description : Read Jenkins job parameters
for https://python-jenkins.readthedocs.org/
"""
import argparse
from MyLogger import MyLogger
from QueueManager import QueueManager
def print_options(options):
print "build_number: %s" % options.build_number
print "jenkins_url: %s" % options.jenkins_url
print "job_name: %s" % options.job_name
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("-d", "--build_number", help="Jenkins build number", default="1")
parser.add_argument("-j", "--jenkins_url", help="Jenkins URL", default="http://localhost:8080")
parser.add_argument("-s", "--job_name", help="Job name", default="oron")
options=parser.parse_args()
print_options(options)
return vars(options)
def main():
print ' *** start jenkins job script ***'
option = get_args()
logger = MyLogger.__call__().get_logger()
logger.info("Start logger")
queue_management_state = QueueManager(option["build_number"],option["jenkins_url"],option["job_name"])
queue_management_state.run()
if __name__ == "__main__":
main()