conduitdemo: fixups to get bugzilla integration to work (bug 1353815). r?dkl draft
authorIsrael Madueme <imadueme@mozilla.com>
Wed, 05 Apr 2017 14:18:01 -0400
changeset 5633 2c57f30827967e617e786a68b52b578290a4edd3
parent 5621 970b35b04ac003be30eab24468d46cbfee31fdca
child 5634 04174d357a0a1b5dbf61296742d6e86c55a36f00
child 5635 fac58afbb0ed5cf20ce111431f0e31a5867acdd6
push id225
push userbmo:imadueme@mozilla.com
push dateWed, 05 Apr 2017 20:46:36 +0000
reviewersdkl
bugs1353815
conduitdemo: fixups to get bugzilla integration to work (bug 1353815). r?dkl MozReview-Commit-ID: JqZg5G9Cfpe
commitindex/commitindex/api/iterations.py
commitindex/commitindex/reviews/triggers.py
conduitdemo/docker-compose.yml
conduitdemo/docker-vct-hg/hgrc
--- a/commitindex/commitindex/api/iterations.py
+++ b/commitindex/commitindex/api/iterations.py
@@ -41,17 +41,17 @@ def post(data):
             'The Bugzilla API headers in the request were not valid'
         )
 
     topic = data.get('topic', 1)
 
     # TODO: Topic lookup and validation
 
     # Trigger review creation for this iteration.
-    trigger_review(data['commits'], request.header['X-Bugzilla-API-Key'])
+    trigger_review(data['commits'], request.headers['X-Bugzilla-API-Key'])
 
     return {
         'data': {
             'id': 1,
             'topic': topic,
             'commits': [{
                 'id': commit
             } for commit in data['commits']],
--- a/commitindex/commitindex/reviews/triggers.py
+++ b/commitindex/commitindex/reviews/triggers.py
@@ -10,24 +10,27 @@ from commitindex.reviews.bugzilla import
 def get_bugzilla_client():
     return Bugzilla(rest_url=current_app.config['BUGZILLA_URL'])
 
 
 def trigger_review(commits, api_key):
     """Trigger review creation for an Iteration."""
 
     bugzilla = get_bugzilla_client()
-
+    attachments = []
     for commit in commits:
         # TODO: Create real diff
         commit_data = {}
+        commit_data['file_name'] = 'conduit test patch'
+        commit_data['is_patch'] = True
+        commit_data['summary'] = 'This is a test attachment from conduit'
         commit_data['data'] = """diff --git a/dirs/source.py b/dirs/source.py
 --- a/dirs/source.py
 +++ b/dirs/source.py
 @@ -1,8 +1,17 @@
 
 +from commitindex.reviews.bugzilla import Bugzilla"""
 
-        commit['attachment_id'] = bugzilla.create_attachment(
+        attachments.append(bugzilla.create_attachment(
             1, commit_data, api_key=api_key
-        )
+        ))
 
-    return commits
+    return attachments
--- a/conduitdemo/docker-compose.yml
+++ b/conduitdemo/docker-compose.yml
@@ -53,11 +53,13 @@ services:
     build:
       context: ../docker/mountebank/
     command: start --logfile /mb.log --debug --mock
 
   bmo:
     build:
       context: ../bmo
       dockerfile: ./docker/dockerfile-dev
+    ports:
+      - "7777:80"
 
 volumes:
   data-volume:
--- a/conduitdemo/docker-vct-hg/hgrc
+++ b/conduitdemo/docker-vct-hg/hgrc
@@ -1,11 +1,11 @@
 [ui]
 username = Wavid Dalsh <wdalsh@mozilla.com>
 
 [extensions]
 reviewboard = /root/version-control-tools/hgext/reviewboard/client.py
 conduit = /root/version-control-tools/hgext/conduit-client/client.py
 
 [bugzilla]
-username = test@example.com
+username = conduit@mozilla.bugs
 # Not a real api key
-apikey = EHdrFyax9Jz2N4hucP3YWxmxcwJqMbw8R6q4ZRv5
+apikey = zQ5TSBzq7tTZMtKYq9K1ZqJMjifKx3cPL7pIGk9Q