Skip to content

Commit

Permalink
Merge branch 'master' into nine
Browse files Browse the repository at this point in the history
  • Loading branch information
djmitche committed Aug 27, 2013
2 parents cd47049 + 95ed381 commit 5072346
Show file tree
Hide file tree
Showing 25 changed files with 627 additions and 73 deletions.
88 changes: 88 additions & 0 deletions .travis.yml
@@ -0,0 +1,88 @@
# Travis CI configuration file
# http://about.travis-ci.org/docs/

language: python

python:
- "2.5"
- "2.6"
- "2.7"

env:
- TWISTED=9.0.0 SQLALCHEMY=latest SQLALCHEMY_MIGRATE=0.7.1
- TWISTED=10.2.0 SQLALCHEMY=latest SQLALCHEMY_MIGRATE=0.7.1
- TWISTED=11.1.0 SQLALCHEMY=latest SQLALCHEMY_MIGRATE=0.7.1
- TWISTED=12.2.0 SQLALCHEMY=latest SQLALCHEMY_MIGRATE=0.7.1
- TWISTED=13.0.0 SQLALCHEMY=latest SQLALCHEMY_MIGRATE=0.7.1
- TWISTED=latest SQLALCHEMY=latest SQLALCHEMY_MIGRATE=latest

matrix:
exclude:
# Disable not supported Twisted versions on Python 2.5
- python: "2.5"
env: TWISTED=12.2.0 SQLALCHEMY=latest SQLALCHEMY_MIGRATE=0.7.1
- python: "2.5"
env: TWISTED=13.0.0 SQLALCHEMY=latest SQLALCHEMY_MIGRATE=0.7.1

include:
# Test different versions on SQLAlchemy
- python: "2.7"
env: TWISTED=12.0.0 SQLALCHEMY=0.6.0 SQLALCHEMY_MIGRATE=0.7.1
- python: "2.7"
env: TWISTED=12.0.0 SQLALCHEMY=0.6.8 SQLALCHEMY_MIGRATE=0.7.1
- python: "2.7"
env: TWISTED=12.0.0 SQLALCHEMY=0.7.0 SQLALCHEMY_MIGRATE=0.7.1
- python: "2.7"
env: TWISTED=12.0.0 SQLALCHEMY=0.7.4 SQLALCHEMY_MIGRATE=0.7.1
- python: "2.7"
env: TWISTED=12.0.0 SQLALCHEMY=0.7.8 SQLALCHEMY_MIGRATE=0.7.1
- python: "2.7"
env: TWISTED=12.0.0 SQLALCHEMY=latest SQLALCHEMY_MIGRATE=0.6.1

# Test different versions of SQLAlchemy-migrate
- python: "2.7"
env: TWISTED=12.0.0 SQLALCHEMY=latest SQLALCHEMY_MIGRATE=0.6.1
- python: "2.7"
env: TWISTED=12.0.0 SQLALCHEMY=latest SQLALCHEMY_MIGRATE=0.7.1
- python: "2.7"
env: TWISTED=12.0.0 SQLALCHEMY=latest SQLALCHEMY_MIGRATE=0.7.2

# Dependencies installation commands
install:
# zope.interface dropped Python 2.5 support in 4.0.0
- "[ $TRAVIS_PYTHON_VERSION != '2.5' ] || pip install 'zope.interface<4.0.0'"
- "[ $TWISTED = latest ] || pip install Twisted==$TWISTED"
- "[ $SQLALCHEMY = latest ] || pip install sqlalchemy==$SQLALCHEMY"
- "[ $SQLALCHEMY_MIGRATE = latest ] || pip install sqlalchemy-migrate==$SQLALCHEMY_MIGRATE"
- pushd master; python setup.py develop; popd
- pushd slave; python setup.py develop; popd
# mock is preinstalled on Travis
# txgithub requires Twisted >= 12.3.0, which doesn't work on Python 2.5.
- "[ $TRAVIS_PYTHON_VERSION = '2.5' ] || pip install txgithub"

# Determine is current configuration is latest
- |
if [[ $TRAVIS_PYTHON_VERSION == '2.7' && $TWISTED == latest && \
$SQLALCHEMY = latest && $SQLALCHEMY_MIGRATE = latest ]]; then
export IS_LATEST=true
else
export IS_LATEST=false
fi;
# Run additional tests only in latest configuration
- "[ $IS_LATEST = false ] || pip install pylint"
- "[ $IS_LATEST = false ] || pip install pyflakes"
- "[ $IS_LATEST = false ] || pip install sphinx"

# Tests running commands
script:
- trial buildbot.test
- trial buildslave.test

# Run additional tests only in latest configuration
- "[ $IS_LATEST = false ] || make pylint"
- "[ $IS_LATEST = false ] || make pyflakes"
- "[ $IS_LATEST = false ] || make docs"

notifications:
email: false
2 changes: 0 additions & 2 deletions common/pylintrc
Expand Up @@ -91,7 +91,6 @@ disable=
C0324,
C1001,
E0101,
E0102,
E0202,
E0203,
E0211,
Expand All @@ -102,7 +101,6 @@ disable=
E1002,
E1101,
E1102,
E1111,
E1120,
E1121,
E1123,
Expand Down
2 changes: 1 addition & 1 deletion master/buildbot/buildslave/openstack.py
Expand Up @@ -99,7 +99,7 @@ def _start_instance(self):
duration = 0
interval = self._poll_resolution
inst = instance
while inst.status == BUILD:
while inst.status.startswith(BUILD):
time.sleep(interval)
duration += interval
if duration % 60 == 0:
Expand Down
9 changes: 8 additions & 1 deletion master/buildbot/changes/p4poller.py
Expand Up @@ -21,6 +21,7 @@
import datetime
import dateutil
import os
import exceptions

from twisted.python import log
from twisted.internet import defer, utils
Expand Down Expand Up @@ -153,7 +154,13 @@ def _poll(self):
result = yield self._get_process_output(args)

# decode the result from its designated encoding
result = result.decode(self.encoding)
try:
result = result.decode(self.encoding)
except exceptions.UnicodeError, ex:
log.msg("P4Poller: couldn't decode changelist description: %s" % ex.encoding)
log.msg("P4Poller: in object: %s" % ex.object)
log.err("P4Poller: poll failed")
raise

lines = result.split('\n')
# SF#1555985: Wade Brainerd reports a stray ^M at the end of the date
Expand Down
4 changes: 2 additions & 2 deletions master/buildbot/changes/svnpoller.py
Expand Up @@ -191,9 +191,9 @@ def getProcessOutput(self, args):
def get_prefix(self):
args = ["info", "--xml", "--non-interactive", self.svnurl]
if self.svnuser:
args.extend(["--username=%s" % self.svnuser])
args.append("--username=%s" % self.svnuser)
if self.svnpasswd:
args.extend(["--password=%s" % self.svnpasswd])
args.append("--password=%s" % self.svnpasswd)
if self.extra_args:
args.extend(self.extra_args)
d = self.getProcessOutput(args)
Expand Down
3 changes: 2 additions & 1 deletion master/buildbot/db/pool.py
Expand Up @@ -95,8 +95,9 @@ def __init__(self, engine, verbose=False):
# messages about versions and other warnings
log_msg = log.msg
if verbose:
def log_msg(m):
def _log_msg(m):
print m
log_msg = _log_msg

pool_size = 5

Expand Down
1 change: 1 addition & 0 deletions master/buildbot/status/web/authz.py
Expand Up @@ -32,6 +32,7 @@ class Authz(object):
'stopBuild',
'stopAllBuilds',
'cancelPendingBuild',
'cancelAllPendingBuilds',
'stopChange',
'cleanShutdown',
'showUsersPage',
Expand Down
39 changes: 39 additions & 0 deletions master/buildbot/status/web/builder.py
Expand Up @@ -127,6 +127,41 @@ def performAction(self, req):
# go back to the welcome page
defer.returnValue(path_to_root(req))

class CancelAllPendingBuildsActionResource(ActionResource):

def __init__(self, status, selectedOrAll):
self.status = status
self.selectedOrAll = selectedOrAll
self.action = 'cancelAllPendingBuilds'

@defer.inlineCallbacks
def performAction(self, req):
authz = self.getAuthz(req)
res = yield authz.actionAllowed('cancelAllPendingBuilds', req)
if not res:
defer.returnValue(path_to_authzfail(req))
return

builders = None
if self.selectedOrAll == 'all':
builders = self.status.getBuilderNames()
elif self.selectedOrAll == 'selected':
builders = [b for b in req.args.get("selected", []) if b]

c = interfaces.IControl(self.getBuildmaster(req))
for bname in builders:
authz = self.getAuthz(req)
builder_control = c.getBuilder(bname)

brcontrols = yield builder_control.getPendingBuildRequestControls()

for build_req in brcontrols:
log.msg("Cancelling %s" % build_req)
build_req.cancel()

# go back to the welcome page
defer.returnValue(path_to_root(req))

class PingBuilderActionResource(ActionResource):

def __init__(self, builder_status):
Expand Down Expand Up @@ -489,6 +524,8 @@ def getChild(self, path, req):
return self.stopall(req)
if path == "stopchangeall":
return StopChangeAllResource(self.status)
if path == "cancelpendingall":
return CancelAllPendingBuildsActionResource(self.status, 'all')

return HtmlResource.getChild(self, path, req)

Expand All @@ -510,6 +547,8 @@ def getChild(self, path, req):
return self.forceselected(req)
if path == "stopselected":
return self.stopselected(req)
if path == "cancelpendingselected":
return CancelAllPendingBuildsActionResource(self.status, 'selected')

return HtmlResource.getChild(self, path, req)

Expand Down
6 changes: 3 additions & 3 deletions master/buildbot/status/web/change_hook.py
Expand Up @@ -60,9 +60,9 @@ def render_POST(self, request):

try:
changes, src = self.getChanges( request )
except ValueError, err:
request.setResponseCode(400, err.args[0])
return err.args[0]
except ValueError, val_err:
request.setResponseCode(400, val_err.args[0])
return val_err.args[0]
except Exception, e:
log.err(e, "processing changes from web hook")
msg = "Error processing changes."
Expand Down
9 changes: 8 additions & 1 deletion master/buildbot/status/web/templates/builders.html
Expand Up @@ -30,7 +30,14 @@ <h2>Stop All Builds</h2>
{{ forms.stop_build(path_to_root+"builders/_all/stopall", authz, on_all=True, label='All Builds') }}
{% endif %}
{% endif %}


{% if authz.advertiseAction('cancelAllPendingBuilds', request) %}
<h2>Cancel Selected Pending Builds</h2>
{{ forms.cancel_build(path_to_root+"builders/_selected/cancelpendingselected", authz, on_selected=True, builders=builders, label='Selected Pending Builds') }}
<h2>Cancel All Pending Builds</h2>
{{ forms.cancel_build(path_to_root+"builders/_all/cancelpendingall", authz, on_all=True, label='All Pending Builds') }}
{% endif %}

{% if num_online > 0 %}
{% if authz.advertiseAction('forceAllBuilds', request) or authz.advertiseAction('forceBuild', request) %}
<h2>Force Selected Builds</h2>
Expand Down
38 changes: 38 additions & 0 deletions master/buildbot/status/web/templates/forms.html
Expand Up @@ -78,6 +78,44 @@
{% endif %}
{% endmacro %}

{% macro cancel_build(cancel_url, authz, on_all=False, on_selected=False, builders=[], short=False, label="Build") %}
{% if not short %}
<form method="post" name="cancel_build" action="{{ cancel_url }}" class='command cancelbuild'
{{ 'style="display:inline"' if short else '' }}>
{% if not short %}
{% if on_all %}
<p>To cancel all pending builds, fill out the following field and
push the <i>Cancel {{ label }}</i> button</p>
{% elif on_selected %}
<p>To cancel selected pending builds, select the builders, fill out the
following field and push the <i>Cancel {{ label }}</i> button</p>
<table>
{% for b in builders %}
<tr>
<td align="center"><input type="checkbox" name="selected" value="{{ b.name }}"></td>
<td class="box"><a href="{{ b.link }}">{{ b.name|e }}</a></td>
</tr>
{% endfor %}
</table>

{% else %}
<p>To cancel this pending build, fill out the following field and
push the <i>Cancel {{ label }}</i> button</p>
{% endif %}
{% endif %}

{% if not short %}
<div class="row">
<span class="label">Reason:</span>
<input type="text" name="comments"/>
</div>
{% endif %}

<input type="submit" value="Cancel {{ label }}" />
</form>
{% endif %}
{% endmacro %}

{% macro force_build_scheduler_parameter(f, authz, request, sch, default_props) %}
{% if f and not f.hide and (f.fullName != "username" or not authz.authenticated(request)) %}
<div class="row{% for subtype in f.type %} force-{{subtype}}{%endfor%}"{% if f.name %} id="force-{{sch.name}}-{{f.fullName}}"{% endif %}>
Expand Down

0 comments on commit 5072346

Please sign in to comment.