24
24
from distro_info import UbuntuDistroInfo
26
26
DEV_SERIES = UbuntuDistroInfo().devel()
29
"mediaplayer-app-autopilot",
30
"gallery-app-autopilot",
31
"webbrowser-app-autopilot",
32
"unity8-app-autopilot",
33
"friends-app-autopilot",
34
"notes-app-autopilot",
35
"camera-app-autopilot",
36
"phone-app-autopilot",
37
"share-app-autopilot",
44
'device': device.split('-', 2)[0], # turn grouper-01 into grouper
45
'device_name': device,
44
63
help="Dry run mode. Don't execute jenkins commands.")
45
64
parser.add_argument("-u", "--username",
46
65
help="username to use when logging into Jenkins.")
66
parser.add_argument("-P", "--publish", action="store_true",
67
help="Publish at the end of the job")
47
68
parser.add_argument("-p", "--password",
48
69
help="username to use when logging into Jenkins")
70
parser.add_argument("--prefix",
71
help="Prefix to add to the beginning of the job name")
49
72
parser.add_argument("-j", "--jenkins", default="http://10.98.0.1:8080/",
50
73
help="URL of jenkins instance to configure jobs in.")
51
parser.add_argument("-n", "--name", default="maguro-01",
52
help=("Device name where the job should be executed "
53
"(default=%(default)s)"))
74
parser.add_argument("-n", "--name", action='append',
75
help=("Device names where the job should be executed."
76
" Can be used more than once."))
54
77
parser.add_argument("-s", "--series", default=DEV_SERIES,
55
78
help=("series of Ubuntu to download "
56
79
"(default=%(default)s)"))
80
def _get_job_name(args, testname):
81
if (testname in ("default", "security", "sdk")):
82
fmt = "{series}-touch-{type}-smoke-{testname}"
83
return fmt.format(series=args.series,
84
type=args.name[:args.name.index("-")],
103
def _get_job_name(args, device, testname):
106
prefix=args.prefix+"-"
107
if (testname in ("eventstat", "smem")):
108
fmt = "{prefix}{testname}-{series}-touch-armhf-install-idle-{type}"
109
return fmt.format(prefix=prefix,
112
type=device[:device.index("-")])
114
fmt = "{prefix}{series}-touch-{type}-smoke-{testname}"
115
return fmt.format(prefix=prefix,
117
type=device[:device.index("-")],
85
118
testname=testname)
87
fmt = "{testname}-{series}-touch-armhf-install-idle-{type}"
88
return fmt.format(series=args.series,
90
type=args.name[:args.name.index("-")])
93
def _configure_job(instance, env, args, testname):
121
def _configure_job(instance, env, args, device, testname, project_names):
94
122
tmpl_name = "touch-%s.xml.jinja2" % testname
95
123
tmpl = env.get_template(tmpl_name)
96
cfg = tmpl.render(name=args.name,
124
cfg = tmpl.render(name=device,
97
125
series=args.series,
98
type=args.name[:args.name.index("-")],
100
jobname = _get_job_name(args, testname)
126
type=device[:device.index("-")],
128
publish=args.publish,
129
projects=project_names)
130
jobname = _get_job_name(args, device, testname)
102
132
_dryrun_func(jobname, cfg)
126
156
env = _get_environment()
128
for testname in TESTS:
129
logging.debug("configuring job for %s" %testname)
130
_configure_job(jenkins_inst, env, args, testname)
158
device_list = args.name if args.name else DEVICES
159
for device in device_list:
161
for testname in TESTS:
162
if testname=="master":
164
project_names.append(_get_job_name(args, device, testname))
165
for testname in TESTS:
166
logging.debug("configuring job for %s" %testname)
167
_configure_job(jenkins_inst, env, args, device, testname,
132
170
if __name__ == '__main__':