Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge from default

changeset:   2479:ae382e1ebf43
parent:      2477:b21b584125f2
user:        Chris AtLee <catlee@mozilla.com>
date:        Thu Jul 19 17:21:03 2012 -0400
summary:     Bug 774862: Disable repo reset detection. r=bhearsum

changeset:   2480:1155eadd6e87
tag:         tip
user:        Nick Thomas <nthomas@mozilla.com>
date:        Fri Jul 20 09:33:06 2012 +1200
summary:     Bug 741688, buildIDSchedFunc can generate invalid build ids, r=catlee

--HG--
branch : production-0.8
  • Loading branch information...
commit 9ce787dc42db8084f5ee3736d0948866026de48c 2 parents 820127b + 13a4c20
@rail rail authored
View
19 changes/hgpoller.py
@@ -250,15 +250,16 @@ def _make_url(self):
return str(url)
def dataFailed(self, res):
- if hasattr(res.value, 'status') and res.value.status == '500' and \
- 'unknown revision' in res.value.response:
- # Indicates that the revision can't be found. The repo has most
- # likely been reset. Forget about our lastChangeset, and set
- # emptyRepo to True so we can trigger builds for new changes there
- if self.verbose:
- log.msg("%s has been reset" % self.baseURL)
- self.lastChangeset = None
- self.emptyRepo = True
+ # XXX: disabled for bug 774862
+ #if hasattr(res.value, 'status') and res.value.status == '500' and \
+ #'unknown revision' in res.value.response:
+ ## Indicates that the revision can't be found. The repo has most
+ ## likely been reset. Forget about our lastChangeset, and set
+ ## emptyRepo to True so we can trigger builds for new changes there
+ #if self.verbose:
+ #log.msg("%s has been reset" % self.baseURL)
+ #self.lastChangeset = None
+ #self.emptyRepo = True
return self.super_class.dataFailed(self, res)
def processData(self, query):
View
5 common.py
@@ -33,6 +33,11 @@ def genBuildUID():
"""Return a unique build uid"""
return uuid.uuid4().hex
+def incrementBuildID(buildID):
+ """Add 1 second to a buildID, handling rollovers to next minute/hour/etc"""
+ epoch = time.mktime(time.strptime(buildID, "%Y%m%d%H%M%S"))
+ return genBuildID(epoch+1)
+
def reallyShort(name, product=None):
prefix = ''
if product != None and 'thunderbird' in product:
View
13 misc_scheduler.py
@@ -13,7 +13,7 @@
reload(buildbotcustom.try_parser)
from buildbotcustom.try_parser import TryParser
-from buildbotcustom.common import genBuildID, genBuildUID
+from buildbotcustom.common import genBuildID, genBuildUID, incrementBuildID
from buildbot.process.properties import Properties
from buildbot.util import json
@@ -83,13 +83,14 @@ def buildIDSchedFunc(sched, t, ssid):
state = sched.get_state(t)
# Get the last buildid we scheduled from the database
- lastid = state.get('last_buildid', 0)
+ lastid = state.get('last_buildid', '19700101000000')
- newid = genBuildID()
+ incrementedid = incrementBuildID(lastid)
+ nowid = genBuildID()
- # Our new buildid will be the highest of the last buildid+1 or the buildid
- # based on the current date
- newid = str(max(int(newid), int(lastid)+1))
+ # Our new buildid will be the highest of the last buildid incremented or
+ # the buildid based on the current date
+ newid = str(max(int(nowid), int(incrementedid)))
# Save it in the scheduler's state so we don't generate the same one again.
state['last_buildid'] = newid
View
16 test/test_misc_scheduler_propfuncs.py
@@ -37,22 +37,30 @@ def tearDown(self):
def test_buildIDSchedFunc(self):
import time
with mock.patch.object(time, 'time') as time_method:
- time_method.return_value = 10
+ time_method.return_value = 58
self.dbc.runInteractionNow(lambda t: buildIDSchedFunc(self.s, t, None))
state = self.dbc.runInteractionNow(lambda t: self.s.get_state(t))
- self.assertEquals(state['last_buildid'], time.strftime("%Y%m%d%H%M%S", time.localtime(10)))
+ self.assertEquals(state['last_buildid'], time.strftime("%Y%m%d%H%M%S", time.localtime(58)))
# Running this again at the same time should increment our buildid by 1
self.dbc.runInteractionNow(lambda t: buildIDSchedFunc(self.s, t, None))
state = self.dbc.runInteractionNow(lambda t: self.s.get_state(t))
- self.assertEquals(state['last_buildid'], time.strftime("%Y%m%d%H%M%S", time.localtime(11)))
+ self.assertEquals(state['last_buildid'], time.strftime("%Y%m%d%H%M%S", time.localtime(59)))
+
+ # Running this again at the same time should increment our buildid by 1
+ # and cross the minute boundary properly
+ self.dbc.runInteractionNow(lambda t: buildIDSchedFunc(self.s, t, None))
+ state = self.dbc.runInteractionNow(lambda t: self.s.get_state(t))
+ self.assertEquals(state['last_buildid'][-3:], '100')
+ self.assertEquals(state['last_buildid'], time.strftime("%Y%m%d%H%M%S", time.localtime(60)))
# If time happens to go backwards, our buildid shouldn't
time_method.return_value = 8
self.dbc.runInteractionNow(lambda t: buildIDSchedFunc(self.s, t, None))
state = self.dbc.runInteractionNow(lambda t: self.s.get_state(t))
- self.assertEquals(state['last_buildid'], time.strftime("%Y%m%d%H%M%S", time.localtime(12)))
+ self.assertEquals(state['last_buildid'][-3:], '101')
+ self.assertEquals(state['last_buildid'], time.strftime("%Y%m%d%H%M%S", time.localtime(61)))
def test_buildUIDSchedFunc(self):
import uuid
Please sign in to comment.
Something went wrong with that request. Please try again.