43
def get_candidate_info(candidate_path):
44
""" Return candidate version and revision build number. """
43
def get_candidate_version(candidate_path):
45
44
with open(os.path.join(candidate_path, 'buildvars.json')) as fp:
46
build_vars = json.load(fp)
47
return build_vars['version'], build_vars['revision_build']
45
return json.load(fp)['version']
50
48
def calculate_jobs(root, schedule_all=False):
52
50
candidates_path = get_candidates_path(root)
53
51
for candidate_path in find_candidates(root, schedule_all):
54
52
parent, candidate = os.path.split(candidate_path)
55
if candidate.startswith('1.26'):
56
# 1.26 was renamed to 2.0 because it is not compatible with 1.x
58
53
if parent != candidates_path:
59
54
raise ValueError('Wrong path')
60
candidate_version, revision_build = get_candidate_info(candidate_path)
55
candidate_version = get_candidate_version(candidate_path)
61
56
for release in releases:
62
# Releases with the same major number must be compatible.
63
if release[:2] != candidate[:2]:
57
if is_osx_client(candidate) is not is_osx_client(release):
65
for client_os in ('ubuntu', 'osx', 'windows'):
67
'old_version': release, # Client
68
'candidate': candidate_version, # Server
70
'candidate_path': candidate,
71
'client_os': client_os,
72
'revision_build': revision_build,
75
'old_version': release, # Server
76
'candidate': candidate_version, # Client
77
'new_to_old': 'false',
78
'candidate_path': candidate,
79
'client_os': client_os,
80
'revision_build': revision_build,
60
if is_osx_client(release):
63
'old_version': release, # Client
64
'candidate': candidate_version, # Server
66
'candidate_path': candidate,
67
'client_os': client_os,
70
'old_version': release, # Server
71
'candidate': candidate_version, # Client
72
'new_to_old': 'false',
73
'candidate_path': candidate,
74
'client_os': client_os,
78
def is_osx_client(path):
79
return path.endswith('-osx')
84
82
def build_jobs(credentials, root, jobs):
85
83
jenkins = Jenkins('http://localhost:8080', *credentials)
86
84
token = get_auth_token(root, 'compatibility-control')
87
os_str = {"ubuntu": "", "osx": "-osx", "windows": "-windows"}
90
'compatibility-control{}'.format(os_str[job['client_os']]), job,
86
jenkins.build_job('compatibility-control', job, token=token)