Merge lp:~robru/qakit/bileto-cleanup into lp:qakit

Proposed by Robert Bruce Park
Status: Merged
Merged at revision: 200
Proposed branch: lp:~robru/qakit/bileto-cleanup
Merge into: lp:qakit
Diff against target: 139 lines (+16/-23)
2 files modified
qakit/ust/worker.py (+9/-15)
silo-card-bot/silo_notifier (+7/-8)
To merge this branch: bzr merge lp:~robru/qakit/bileto-cleanup
Reviewer Review Type Date Requested Status
Santiago Baldassin (community) Approve
Jean-Baptiste Lallement card bot Pending
Canonical Platform QA Team Pending
Review via email: mp+309306@code.launchpad.net

Description of the change

Some minor cleanups in the card bot and UST.

To post a comment you must log in.
Revision history for this message
Santiago Baldassin (sbaldassin) wrote :

Code looks good to me. If changes in Bileto are already in place, we can land this one

review: Approve
Revision history for this message
Robert Bruce Park (robru) wrote :

Yep, it's all ready to go!

Revision history for this message
Santiago Baldassin (sbaldassin) wrote :

Great Robert, we don't have automerge in qakit so you'll need to push your change to lp:qakit

Revision history for this message
Max Brustkern (nuclearbob) wrote :

Would you like to setup autolanding for qakit? We can add that to lp:qa-jenkins-jobs pretty easily.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'qakit/ust/worker.py'
2--- qakit/ust/worker.py 2016-10-18 08:40:00 +0000
3+++ qakit/ust/worker.py 2016-10-26 00:50:35 +0000
4@@ -25,16 +25,13 @@
5
6
7 class Worker:
8-
9- bileto_results = {"PASSED": "Approved", "FAILURE": "Failed", "QUEUED": "Queued"}
10-
11 def __init__(self):
12 self.conf = Config()
13 self.jenkins = Jenkins(self.conf.parser.get('jenkins', 'server'),
14 self.conf.parser.get('jenkins', 'username'),
15 self.conf.parser.get('jenkins', 'password'))
16
17- def run_ust(self, ppa):
18+ def run_ust(self, team, ppa):
19 """"
20 This method will execute the following steps:
21 1. Get the source packages from launchpad that are
22@@ -50,20 +47,18 @@
23 c. Setup the device for testing
24 d. Run the tests
25
26- :param ppa is the ppa associated to the request in bileto and it is
27- expected to be in the format team/ppa_name.
28- For example: ci-train-ppa-service/landing-059
29+ :param team is the launchpad team that owns the ppa
30+ :param ppa is the name of the launchpad ppa to test
31
32 This method has two entry points, it can be called by importing the
33 qakit module and creating a Worker instance like this
34- Worker().run_ust("ci-train-ppa-service/landing-059")
35+ Worker().run_ust("ci-train-ppa-service", "1234.1")
36 And there's also an amqp entry point. The start method will start an amqp
37 client which will be subscribed to /ubuntu-system-test, whenever a message
38 is published in such a topic, it will be process by the
39 process_ust_request method which will call this one to run the tests
40 """
41- team, ppa_name = ppa.split('/')
42- launchpad_ppa = Ppa(team=team, name=ppa_name)
43+ launchpad_ppa = Ppa(team=team, name=ppa)
44 src_pkgs = launchpad_ppa.get_source_packages()
45 packages = list(
46 set([package.source_package_name for package in src_pkgs]))
47@@ -81,10 +76,10 @@
48 tests_ids = ' '
49
50 self.jenkins.build_job(self.conf.parser.get('jenkins', 'job_name'),
51- {"PPA": ppa, "TESTS_TO_RUN": tests_ids, "REQUEST_ID": request_id},
52+ {"PPA": '{}/{}'.format(team, ppa), "TESTS_TO_RUN": tests_ids, "REQUEST_ID": request_id},
53 {'token': self.conf.parser.get('jenkins', 'token')})
54
55- def get_result(self, ppa):
56+ def get_result(self, team, ppa):
57 """
58 The tests results are retrieved from jenkins and the ppa is used to get the
59 appropriate tests results. As when the tests were triggered, the list of
60@@ -98,8 +93,7 @@
61 If the correct build is not found in the get_job_info results, then we'll check the
62 get_queue_info and if the build is not found there, then an error is returned
63 """
64- team, ppa_name = ppa.split('/')
65- launchpad_ppa = Ppa(team=team, name=ppa_name)
66+ launchpad_ppa = Ppa(team=team, name=ppa)
67 request_id = launchpad_ppa.calculate_hash()
68
69 builds = self.jenkins.get_job_info(
70@@ -168,7 +162,7 @@
71 logging.info('Message received {}'.format(body))
72
73 ppa = json.loads(body.decode('utf-8'))['ppa']
74- self.run_ust(ppa)
75+ self.run_ust(*ppa.split('/'))
76
77
78 class UstResult:
79
80=== modified file 'silo-card-bot/silo_notifier'
81--- silo-card-bot/silo_notifier 2016-09-26 10:13:00 +0000
82+++ silo-card-bot/silo_notifier 2016-10-26 00:50:35 +0000
83@@ -161,7 +161,7 @@
84 logging.debug('Writing status to %s', path)
85 status = {}
86 for row in data:
87- status[row['request_id']] = row['qa_signoff']
88+ status[row['id']] = row['qa_signoff']
89 with open(path, 'w+') as status_file:
90 json.dump(status, status_file)
91 except:
92@@ -182,7 +182,7 @@
93 done = set()
94
95 for row in rows:
96- request_id = unicode(row['request_id'])
97+ request_id = unicode(row['id'])
98 old_status = testing_status.get(request_id, '')
99 new_status = row['qa_signoff']
100 if request_id in done:
101@@ -279,8 +279,8 @@
102 ### Merge Proposals
103 {}
104 ''').format(
105- request['request_id'],
106- BILETO_URL + '#/ticket/{}'.format(request['request_id']),
107+ request['id'],
108+ BILETO_URL + '#/ticket/{}'.format(request['id']),
109 silo_utils.linkify_bugs(request['description']),
110 request['test_plan'],
111 mps
112@@ -311,7 +311,6 @@
113 if READY not in request['qa_signoff']:
114 return False
115
116- silo_name = request['siloname']
117 landers = ", ".join(request['landers'].split())
118 # additional_packages = request[COL.additional_source_packages_to_land]
119 additional_packages = ""
120@@ -331,8 +330,8 @@
121 projectnames = request['sources'].split()
122
123 message = "[{}] {} - {} : {}".format(
124- request['request_id'],
125- silo_name,
126+ request['id'],
127+ request['ppa'],
128 ", ".join(projectnames),
129 landers)
130 description = get_description(request, mps)
131@@ -464,7 +463,7 @@
132
133 def remove_not_ready_for_qa(api_key, token, landing_data, dry_run=False):
134 """ Move to failed the cards that are not ready for QA anymore """
135- reqs_ready = [req['request_id'] for req in landing_data
136+ reqs_ready = [req['id'] for req in landing_data
137 if READY in req['qa_signoff']]
138
139 for request in get_cards_ready_for_qa(api_key, token):

Subscribers

People subscribed via source and target branches