Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merge default->production

--HG--
branch : production-0.8
  • Loading branch information...
commit 6c773d8b85a8c2305b4c91c04569140411b95f01 2 parents da773c3 + 55838f1
@escapewindow escapewindow authored
View
7 misc.py
@@ -59,9 +59,7 @@
from buildbotcustom.status.generators import buildTryChangeMessage
from buildbotcustom.env import MozillaEnvironments
from buildbotcustom.misc_scheduler import tryChooser, buildIDSchedFunc, \
- buildUIDSchedFunc, lastGoodFunc
-from buildbotcustom.status.log_handlers import SubprocessLogHandler
-from build.paths import getRealpath
+ buildUIDSchedFunc, lastGoodFunc, lastRevFunc
# This file contains misc. helper function that don't make sense to put in
# other files. For example, functions that are called in a master.cfg
@@ -873,8 +871,9 @@ def generateBranchObjects(config, name, secrets=None):
if len(periodicPgoBuilders) > 0:
pgo_scheduler = makePropertiesScheduler(
- Nightly,
+ SpecificNightly,
[buildIDSchedFunc, buildUIDSchedFunc])(
+ ssFunc=lastRevFunc(config['repo_path'], triggerBuildIfNoChanges=False),
name="%s pgo" % name,
branch=config['repo_path'],
builderNames=periodicPgoBuilders,
View
28 misc_scheduler.py
@@ -314,3 +314,31 @@ def ssFunc(scheduler, t):
rev = later_rev
return SourceStamp(branch=scheduler.branch, revision=rev)
return ssFunc
+
+def lastRevFunc(branch, triggerBuildIfNoChanges=True):
+ """Returns a function that returns the latest revision on branch."""
+ def ssFunc(scheduler, t):
+ #### NOTE: called in a thread!
+ db = scheduler.parent.db
+
+ c = lastChange(db, t, branch)
+ if not c:
+ return None
+
+ rev = c.revision
+ log.msg("lastChange returned %s" % (rev))
+
+ # Find the last revision our scheduler's builders have built. This can
+ # include forced builds.
+ last_built_rev = getLastBuiltRevision(db, t, branch,
+ scheduler.builderNames)
+ log.msg("lastBuiltRevision was %s" % last_built_rev)
+
+ if last_built_rev is not None:
+ # Make sure that rev is newer than the last revision we built.
+ later_rev = getLatestRev(db, t, branch, rev, last_built_rev)
+ if later_rev == last_built_rev and not triggerBuildIfNoChanges:
+ log.msg("lastGoodRev: Skipping %s since we've already built it" % rev)
+ return None
+ return SourceStamp(branch=scheduler.branch, revision=rev)
+ return ssFunc
View
8 process/factory.py
@@ -7137,9 +7137,7 @@ def addSetupSteps(self):
name='cleanup device',
workdir='.',
description="Cleanup Device",
- command=['python', '/builds/sut_tools/cleanup.py',
- WithProperties("%(sut_ip)s"),
- ],
+ command=['python', '/builds/sut_tools/cleanup.py'],
haltOnFailure=True)
)
self.addStep(ShellCommand(
@@ -7506,9 +7504,7 @@ def addCleanupSteps(self):
name='cleanup device',
workdir=self.workdirBase,
description="Cleanup Device",
- command=['python', '/builds/sut_tools/cleanup.py',
- WithProperties("%(sut_ip)s"),
- ],
+ command=['python', '/builds/sut_tools/cleanup.py'],
env=self.env,
haltOnFailure=True)
)
View
29 test/test_misc_scheduler_nightly.py
@@ -7,7 +7,7 @@
from buildbot.changes.changes import Change
from buildbotcustom.misc_scheduler import lastChange, lastGoodRev, \
- getLatestRev, getLastBuiltRevision, lastGoodFunc
+ getLatestRev, getLastBuiltRevision, lastGoodFunc, lastRevFunc
from buildbotcustom.scheduler import SpecificNightly
import mock
@@ -177,6 +177,33 @@ def test_lastGoodFunc(self):
ss = self.dbc.runInteractionNow(lambda t: ssFunc(self.s, t))
self.assertEquals(ss, None)
+ def test_lastRevFunc(self):
+ createTestData(self.dbc)
+ self.s.builderNames = ['builder1']
+
+ # Check that ssFunc returns something for both branches
+ ssFunc = lastRevFunc('b1')
+ ss = self.dbc.runInteractionNow(lambda t: ssFunc(self.s, t))
+ self.assertEquals(ss.revision, 'r1')
+
+ ssFunc = lastRevFunc('b2')
+ ss = self.dbc.runInteractionNow(lambda t: ssFunc(self.s, t))
+ self.assertEquals(ss.revision, 'r234567890')
+
+ # Check that ssFunc returns None if triggerBuildIfNoChanges=False
+ # and we already built the revision
+ ssFunc = lastRevFunc('b1', triggerBuildIfNoChanges=False)
+ ss = self.dbc.runInteractionNow(lambda t: ssFunc(self.s, t))
+ self.assertEquals(ss, None)
+
+ # Check that ssFunc returns the later revision if we already built something old
+ c1 = Change(who='me!', branch='b1', revision='r345', files=[], comments='really important', when=2, revlink='from poller')
+ self.dbc.addChangeToDatabase(c1)
+ ssFunc = lastRevFunc('b1', triggerBuildIfNoChanges=False)
+ ss = self.dbc.runInteractionNow(lambda t: ssFunc(self.s, t))
+ self.assertEquals(ss.revision, 'r345')
+
+
class TestSpecificNightlyScheduler(unittest.TestCase):
basedir = "test_misc_scheduler_nightly_scheduler"
def setUp(self):
Please sign in to comment.
Something went wrong with that request. Please try again.