Skip to content

Commit

Permalink
Add option to 'Rebuild' button to build updated sources
Browse files Browse the repository at this point in the history
Right now the Rebuild button builds the exact same checkout as another build. This makes it difficult
for the following workflow:
 * run a build on a branch; it fails
 * fix the branch it built
 * hit "rebuild" -> but it builds the original revision
  • Loading branch information
Jared Grubb committed May 1, 2013
1 parent 7268940 commit f0dbd4d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
4 changes: 2 additions & 2 deletions master/buildbot/process/builder.py
Expand Up @@ -558,7 +558,7 @@ def get_brs((bsid,brids)):
return d

@defer.inlineCallbacks
def rebuildBuild(self, bs, reason="<rebuild, no reason given>", extraProperties=None):
def rebuildBuild(self, bs, reason="<rebuild, no reason given>", extraProperties=None, absolute=True):
if not bs.isFinished():
return

Expand All @@ -570,7 +570,7 @@ def rebuildBuild(self, bs, reason="<rebuild, no reason given>", extraProperties=
properties.updateFromProperties(extraProperties)

properties_dict = dict((k,(v,s)) for (k,v,s) in properties.asList())
ssList = bs.getSourceStamps(absolute=True)
ssList = bs.getSourceStamps(absolute=absolute)

if ssList:
sourcestampsetid = yield ssList[0].getSourceStampSetId(self.control.master)
Expand Down
12 changes: 11 additions & 1 deletion master/buildbot/status/web/build.py
Expand Up @@ -57,6 +57,13 @@ def performAction(self, req):
comments.decode(getRequestCharset(req))
reason = ("The web-page 'rebuild' button was pressed by "
"'%s': %s\n" % (name, comments))

useSourcestamp = req.args.get("useSourcestamp", None)
if useSourcestamp and useSourcestamp==['updated']:
absolute=False
else:
absolute=True

msg = ""
extraProperties = getAndCheckProperties(req)
if not bc or not b.isFinished() or extraProperties is None:
Expand All @@ -66,7 +73,10 @@ def performAction(self, req):
if bc:
msg += "could not get builder control"
else:
tup = yield bc.rebuildBuild(b, reason, extraProperties)
tup = yield bc.rebuildBuild(b,
reason=reason,
extraProperties=extraProperties,
absolute=absolute)
# rebuildBuild returns None on error (?!)
if not tup:
msg = "rebuilding a build failed "+ str(tup)
Expand Down
7 changes: 7 additions & 0 deletions master/buildbot/status/web/templates/forms.html
Expand Up @@ -218,6 +218,13 @@ <h3>{{ sch.name|e }}</h3>
<span class="label">Reason for re-running build:</span>
<input type='text' name='comments' />
</div>
<div class="row">
Rebuild using:
<select name="useSourcestamp">
<option value='exact' selected>Exact same revisions</option>
<option value='updated'>Same sourcestamps (ignoring 'got revision')</option>
</select>
</div>
<input type="submit" value="Rebuild" />
</form>
{% endmacro %}
Expand Down
3 changes: 3 additions & 0 deletions master/docs/relnotes/index.rst
Expand Up @@ -21,6 +21,9 @@ Features
* Buildbot now support a new PNG Status Resource that can be accessed publicly from for example README.md files or wikis or whatever other resource.
This view produces an image in PNG format with information about the last build for the given builder name or whatever other build number if is passed as an argument to the view.

* The 'Rebuild' button on the web pages for builds features a dropdown to choose whether to
rebuild from exact revisions or from the same sourcestamps (ie, update branch references)

Deprecations, Removals, and Non-Compatible Changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down

0 comments on commit f0dbd4d

Please sign in to comment.