Merge "Make service URLs configurable."

This commit is contained in:
Dan Albert 2015-01-10 00:43:03 +00:00 committed by Gerrit Code Review
commit c8fec746b6
2 changed files with 16 additions and 13 deletions

View File

@ -20,11 +20,15 @@ Setup
Create a `config.py` in the same directory as the sources. The structure of the Create a `config.py` in the same directory as the sources. The structure of the
configuration file is as follows: configuration file is as follows:
client_secret_file = 'CLIENT_SECRET_FILE.json' ```python
jenkins_credentials = { client_secret_file = 'CLIENT_SECRET_FILE.json'
'username': 'JENKINS_USERNAME', build_listener_url = 'BUILD_LISTENER_URL'
'password': 'JENKINS_PASSWORD', jenkins_url = 'JENKINS_URL'
} jenkins_credentials = {
'username': 'JENKINS_USERNAME',
'password': 'JENKINS_PASSWORD',
}
```
The client secret file comes from the Gmail API page of the [Google Developers The client secret file comes from the Gmail API page of the [Google Developers
Console](https://console.developers.google.com/). The Jenkins credentials are Console](https://console.developers.google.com/). The Jenkins credentials are
@ -37,8 +41,10 @@ settings](https://android-review.googlesource.com/#/settings/http-password).
To launch the services: To launch the services:
$ python build_listener.py >build.log 2>&1 & ```bash
$ python gmail_listener.py >mail.log 2>&1 & $ python build_listener.py >build.log 2>&1 &
$ python gmail_listener.py >mail.log 2>&1 &
```
The mail listener will direct your browser to an authentication page for the The mail listener will direct your browser to an authentication page for the
Gmail API. Gmail API.

View File

@ -94,8 +94,7 @@ def get_gerrit_info(body):
def clean_project(gerrit_info, dry_run): def clean_project(gerrit_info, dry_run):
username = bionicbb.config.jenkins_credentials['username'] username = bionicbb.config.jenkins_credentials['username']
password = bionicbb.config.jenkins_credentials['password'] password = bionicbb.config.jenkins_credentials['password']
# TODO(danalbert): Move Jenkins server URL into config.py. jenkins_url = bionicbb.config.jenkins_url
jenkins_url = 'http://bionicbb.mtv.corp.google.com:8080'
jenkins = jenkinsapi.api.Jenkins(jenkins_url, username, password) jenkins = jenkinsapi.api.Jenkins(jenkins_url, username, password)
build = 'clean-bionic-presubmit' build = 'clean-bionic-presubmit'
@ -130,7 +129,7 @@ def build_project(gerrit_info, dry_run):
username = bionicbb.config.jenkins_credentials['username'] username = bionicbb.config.jenkins_credentials['username']
password = bionicbb.config.jenkins_credentials['password'] password = bionicbb.config.jenkins_credentials['password']
jenkins_url = 'http://bionicbb.mtv.corp.google.com:8080' jenkins_url = bionicbb.config.jenkins_url
jenkins = jenkinsapi.api.Jenkins(jenkins_url, username, password) jenkins = jenkinsapi.api.Jenkins(jenkins_url, username, password)
project = gerrit_info['Project'] project = gerrit_info['Project']
@ -198,9 +197,7 @@ def drop_rejection(gerrit_info, dry_run):
'changeid': gerrit_info['Change-Id'], 'changeid': gerrit_info['Change-Id'],
'patchset': gerrit_info['PatchSet'] 'patchset': gerrit_info['PatchSet']
} }
# TODO(danalbert): Move the URL for the build listener service into url = '{}/{}'.format(bionicbb.config.build_listener_url, 'drop-rejection')
# config.py.
url = 'http://bionicbb.mtv.corp.google.com:5000/drop-rejection'
headers = {'Content-Type': 'application/json;charset=UTF-8'} headers = {'Content-Type': 'application/json;charset=UTF-8'}
if not dry_run: if not dry_run:
try: try: