757.2.1
by Aaron Bentley
Start implementing building industrial tests. |
1 |
#!/usr/bin/env python
|
2 |
from argparse import ArgumentParser |
|
870.1.1
by Aaron Bentley
Use authenticated access for schedule_reliability_tests. |
3 |
|
4 |
from jujuci import ( |
|
5 |
add_credential_args, |
|
6 |
get_credentials, |
|
7 |
)
|
|
777.1.1
by Aaron Bentley
Move find_candidates, get under test. |
8 |
from utility import ( |
1071.1.4
by Aaron Bentley
Use find_branch_latest, and limit to 3. |
9 |
find_latest_branch_candidates, |
757.2.1
by Aaron Bentley
Start implementing building industrial tests. |
10 |
)
|
11 |
||
12 |
from jenkins import Jenkins |
|
13 |
||
769.2.1
by Aaron Bentley
Allow suite to be specified. |
14 |
from industrial_test import ( |
15 |
FULL, |
|
16 |
suites, |
|
17 |
)
|
|
18 |
||
19 |
||
20 |
def parse_args(argv=None): |
|
757.2.1
by Aaron Bentley
Start implementing building industrial tests. |
21 |
parser = ArgumentParser() |
22 |
parser.add_argument( |
|
23 |
'root_dir', help='Directory containing releases and candidates dir') |
|
872.1.1
by Aaron Bentley
Accept multiple --suite options. |
24 |
parser.add_argument('--suite', help='Test suite to run', default=[], |
25 |
choices=suites.keys(), action='append') |
|
769.2.2
by Aaron Bentley
Allow specifying jobs for schedule_reliability_tests. |
26 |
parser.add_argument('jobs', nargs='*', metavar='job', |
27 |
help='Jobs to schedule builds for.') |
|
870.1.1
by Aaron Bentley
Use authenticated access for schedule_reliability_tests. |
28 |
add_credential_args(parser) |
769.2.2
by Aaron Bentley
Allow specifying jobs for schedule_reliability_tests. |
29 |
result = parser.parse_args(argv) |
30 |
if result.jobs == []: |
|
31 |
result.jobs = None |
|
870.1.1
by Aaron Bentley
Use authenticated access for schedule_reliability_tests. |
32 |
credentials = get_credentials(result) |
33 |
return result, credentials |
|
34 |
||
35 |
||
36 |
def build_job(credentials, root, job_name, candidates, suite): |
|
872.1.1
by Aaron Bentley
Accept multiple --suite options. |
37 |
parameters = {'suite': ','.join(suite), 'attempts': '10'} |
1533.1.1
by Aaron Bentley
Allow schedule_reliability_tests on release-slave. |
38 |
jenkins = Jenkins('http://juju-ci.vapour.ws:8080', credentials.user, |
870.1.1
by Aaron Bentley
Use authenticated access for schedule_reliability_tests. |
39 |
credentials.password) |
1302.1.1
by Aaron Bentley
Include revision_build in industrial-test job params. |
40 |
for candidate, revision_build in candidates: |
41 |
call_parameters = { |
|
42 |
'revision_build': '{:d}'.format(revision_build), |
|
43 |
}
|
|
769.2.1
by Aaron Bentley
Allow suite to be specified. |
44 |
call_parameters.update(parameters) |
1533.1.1
by Aaron Bentley
Allow schedule_reliability_tests on release-slave. |
45 |
jenkins.build_job(job_name, call_parameters) |
757.2.1
by Aaron Bentley
Start implementing building industrial tests. |
46 |
|
47 |
||
1071.1.4
by Aaron Bentley
Use find_branch_latest, and limit to 3. |
48 |
def main(argv=None): |
49 |
args, credentials = parse_args(argv) |
|
872.1.1
by Aaron Bentley
Accept multiple --suite options. |
50 |
suite = args.suite |
51 |
if suite == []: |
|
52 |
suite = [FULL] |
|
1071.1.8
by Aaron Bentley
Remove redundant list(). |
53 |
candidates = find_latest_branch_candidates(args.root_dir)[:3] |
769.2.2
by Aaron Bentley
Allow specifying jobs for schedule_reliability_tests. |
54 |
jobs = args.jobs |
55 |
if jobs is None: |
|
56 |
jobs = ['industrial-test', 'industrial-test-aws', |
|
57 |
'industrial-test-joyent'] |
|
58 |
for job in jobs: |
|
872.1.1
by Aaron Bentley
Accept multiple --suite options. |
59 |
build_job(credentials, args.root_dir, job, candidates, suite) |
757.2.1
by Aaron Bentley
Start implementing building industrial tests. |
60 |
|
61 |
||
62 |
if __name__ == '__main__': |
|
63 |
main() |