conduitdemo: fixups to get bugzilla integration to work (
bug 1353815). r?dkl
MozReview-Commit-ID: JqZg5G9Cfpe
--- 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