|
# This file is part of Buildbot. Buildbot is free software: you can # redistribute it and/or modify it under the terms of the GNU General Public # License as published by the Free Software Foundation, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more # details. # # You should have received a copy of the GNU General Public License along with # this program; if not, write to the Free Software Foundation, Inc., 51 # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. # # Copyright Buildbot Team Members
#!/usr/bin/env python github_buildbot.py is based on git_buildbot.py
github_buildbot.py will determine the repository information from the JSON HTTP POST it receives from github.com and build the appropriate repository. If your github repository is private, you must add a ssh key to the github repository for the user who initiated the build on the buildslave.
"""
except ImportError: import simplejson as json
# python is silly about how it handles timezones """ fixed offset timezone """ hours = self.hours)
return datetime.timedelta(0)
#"1970-01-01T00:00:00+00:00" result.groups() offsetsign = 1 else:
int(month), int(day), int(hour), int(minute), int(second), 0, offsetTimezone)
""" Reponds only to POST events and starts the build process
:arguments: request the http request object """ project = project[0] # This field is unused: #private = payload['repository']['private']
""" Consumes the JSON as a python object and actually starts the build.
:arguments: payload Python Object that represents the JSON sent by GitHub Service Hook. """
# We only care about regular heads, i.e. branches
log.msg("Branch `%s' deleted, ignoring" % branch) return [] else: who = commit['author']['name'] + " <" + commit['author']['email'] + ">", files = files, comments = commit['message'], revision = commit['id'], when = when, branch = branch, revlink = commit['url'], repository = repo_url, project = project)
|