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
=== modified file 'qakit/ust/worker.py'
--- qakit/ust/worker.py 2016-10-18 08:40:00 +0000
+++ qakit/ust/worker.py 2016-10-26 00:50:35 +0000
@@ -25,16 +25,13 @@
2525
2626
27class Worker:27class Worker:
28
29 bileto_results = {"PASSED": "Approved", "FAILURE": "Failed", "QUEUED": "Queued"}
30
31 def __init__(self):28 def __init__(self):
32 self.conf = Config()29 self.conf = Config()
33 self.jenkins = Jenkins(self.conf.parser.get('jenkins', 'server'),30 self.jenkins = Jenkins(self.conf.parser.get('jenkins', 'server'),
34 self.conf.parser.get('jenkins', 'username'),31 self.conf.parser.get('jenkins', 'username'),
35 self.conf.parser.get('jenkins', 'password'))32 self.conf.parser.get('jenkins', 'password'))
3633
37 def run_ust(self, ppa):34 def run_ust(self, team, ppa):
38 """"35 """"
39 This method will execute the following steps:36 This method will execute the following steps:
40 1. Get the source packages from launchpad that are37 1. Get the source packages from launchpad that are
@@ -50,20 +47,18 @@
50 c. Setup the device for testing47 c. Setup the device for testing
51 d. Run the tests48 d. Run the tests
5249
53 :param ppa is the ppa associated to the request in bileto and it is50 :param team is the launchpad team that owns the ppa
54 expected to be in the format team/ppa_name.51 :param ppa is the name of the launchpad ppa to test
55 For example: ci-train-ppa-service/landing-059
5652
57 This method has two entry points, it can be called by importing the53 This method has two entry points, it can be called by importing the
58 qakit module and creating a Worker instance like this54 qakit module and creating a Worker instance like this
59 Worker().run_ust("ci-train-ppa-service/landing-059")55 Worker().run_ust("ci-train-ppa-service", "1234.1")
60 And there's also an amqp entry point. The start method will start an amqp56 And there's also an amqp entry point. The start method will start an amqp
61 client which will be subscribed to /ubuntu-system-test, whenever a message57 client which will be subscribed to /ubuntu-system-test, whenever a message
62 is published in such a topic, it will be process by the58 is published in such a topic, it will be process by the
63 process_ust_request method which will call this one to run the tests59 process_ust_request method which will call this one to run the tests
64 """60 """
65 team, ppa_name = ppa.split('/')61 launchpad_ppa = Ppa(team=team, name=ppa)
66 launchpad_ppa = Ppa(team=team, name=ppa_name)
67 src_pkgs = launchpad_ppa.get_source_packages()62 src_pkgs = launchpad_ppa.get_source_packages()
68 packages = list(63 packages = list(
69 set([package.source_package_name for package in src_pkgs]))64 set([package.source_package_name for package in src_pkgs]))
@@ -81,10 +76,10 @@
81 tests_ids = ' '76 tests_ids = ' '
8277
83 self.jenkins.build_job(self.conf.parser.get('jenkins', 'job_name'),78 self.jenkins.build_job(self.conf.parser.get('jenkins', 'job_name'),
84 {"PPA": ppa, "TESTS_TO_RUN": tests_ids, "REQUEST_ID": request_id},79 {"PPA": '{}/{}'.format(team, ppa), "TESTS_TO_RUN": tests_ids, "REQUEST_ID": request_id},
85 {'token': self.conf.parser.get('jenkins', 'token')})80 {'token': self.conf.parser.get('jenkins', 'token')})
8681
87 def get_result(self, ppa):82 def get_result(self, team, ppa):
88 """83 """
89 The tests results are retrieved from jenkins and the ppa is used to get the84 The tests results are retrieved from jenkins and the ppa is used to get the
90 appropriate tests results. As when the tests were triggered, the list of85 appropriate tests results. As when the tests were triggered, the list of
@@ -98,8 +93,7 @@
98 If the correct build is not found in the get_job_info results, then we'll check the93 If the correct build is not found in the get_job_info results, then we'll check the
99 get_queue_info and if the build is not found there, then an error is returned94 get_queue_info and if the build is not found there, then an error is returned
100 """95 """
101 team, ppa_name = ppa.split('/')96 launchpad_ppa = Ppa(team=team, name=ppa)
102 launchpad_ppa = Ppa(team=team, name=ppa_name)
103 request_id = launchpad_ppa.calculate_hash()97 request_id = launchpad_ppa.calculate_hash()
10498
105 builds = self.jenkins.get_job_info(99 builds = self.jenkins.get_job_info(
@@ -168,7 +162,7 @@
168 logging.info('Message received {}'.format(body))162 logging.info('Message received {}'.format(body))
169163
170 ppa = json.loads(body.decode('utf-8'))['ppa']164 ppa = json.loads(body.decode('utf-8'))['ppa']
171 self.run_ust(ppa)165 self.run_ust(*ppa.split('/'))
172166
173167
174class UstResult:168class UstResult:
175169
=== modified file 'silo-card-bot/silo_notifier'
--- silo-card-bot/silo_notifier 2016-09-26 10:13:00 +0000
+++ silo-card-bot/silo_notifier 2016-10-26 00:50:35 +0000
@@ -161,7 +161,7 @@
161 logging.debug('Writing status to %s', path)161 logging.debug('Writing status to %s', path)
162 status = {}162 status = {}
163 for row in data:163 for row in data:
164 status[row['request_id']] = row['qa_signoff']164 status[row['id']] = row['qa_signoff']
165 with open(path, 'w+') as status_file:165 with open(path, 'w+') as status_file:
166 json.dump(status, status_file)166 json.dump(status, status_file)
167 except:167 except:
@@ -182,7 +182,7 @@
182 done = set()182 done = set()
183183
184 for row in rows:184 for row in rows:
185 request_id = unicode(row['request_id'])185 request_id = unicode(row['id'])
186 old_status = testing_status.get(request_id, '')186 old_status = testing_status.get(request_id, '')
187 new_status = row['qa_signoff']187 new_status = row['qa_signoff']
188 if request_id in done:188 if request_id in done:
@@ -279,8 +279,8 @@
279 ### Merge Proposals279 ### Merge Proposals
280 {}280 {}
281 ''').format(281 ''').format(
282 request['request_id'],282 request['id'],
283 BILETO_URL + '#/ticket/{}'.format(request['request_id']),283 BILETO_URL + '#/ticket/{}'.format(request['id']),
284 silo_utils.linkify_bugs(request['description']),284 silo_utils.linkify_bugs(request['description']),
285 request['test_plan'],285 request['test_plan'],
286 mps286 mps
@@ -311,7 +311,6 @@
311 if READY not in request['qa_signoff']:311 if READY not in request['qa_signoff']:
312 return False312 return False
313313
314 silo_name = request['siloname']
315 landers = ", ".join(request['landers'].split())314 landers = ", ".join(request['landers'].split())
316 # additional_packages = request[COL.additional_source_packages_to_land]315 # additional_packages = request[COL.additional_source_packages_to_land]
317 additional_packages = ""316 additional_packages = ""
@@ -331,8 +330,8 @@
331 projectnames = request['sources'].split()330 projectnames = request['sources'].split()
332331
333 message = "[{}] {} - {} : {}".format(332 message = "[{}] {} - {} : {}".format(
334 request['request_id'],333 request['id'],
335 silo_name,334 request['ppa'],
336 ", ".join(projectnames),335 ", ".join(projectnames),
337 landers)336 landers)
338 description = get_description(request, mps)337 description = get_description(request, mps)
@@ -464,7 +463,7 @@
464463
465def remove_not_ready_for_qa(api_key, token, landing_data, dry_run=False):464def remove_not_ready_for_qa(api_key, token, landing_data, dry_run=False):
466 """ Move to failed the cards that are not ready for QA anymore """465 """ Move to failed the cards that are not ready for QA anymore """
467 reqs_ready = [req['request_id'] for req in landing_data466 reqs_ready = [req['id'] for req in landing_data
468 if READY in req['qa_signoff']]467 if READY in req['qa_signoff']]
469468
470 for request in get_cards_ready_for_qa(api_key, token):469 for request in get_cards_ready_for_qa(api_key, token):

Subscribers

People subscribed via source and target branches