def buildIDSchedFunc(sched, t, ssid): """Generates a unique buildid for this change. Returns a Properties instance with 'buildid' set to the buildid to use. scheduler `sched`'s state is modified as a result.""" state = sched.get_state(t) # Get the last buildid we scheduled from the database lastid = state.get('last_buildid', '19700101000000') incrementedid = incrementBuildID(lastid) nowid = genBuildID() # 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 sched.set_state(t, state) props = Properties() props.setProperty('buildid', newid, 'buildIDSchedFunc') return props
def setBuildIDProps(step, build): """Sets buildid and builduid properties. On a rebuild we willl re-generate the builduid. Otherwise, we normally get them from the scheduler. If either of buildid or builduid doesn't exist, it will be created.""" if build.reason.startswith("The web-page 'rebuild'"): # Override builduid since this is a manually triggered # rebuild build.setProperty("builduid", genBuildUID(), "setBuildProps") # Make sure we have required properties props = build.getProperties() if not props.has_key("buildid"): build.setProperty("buildid", genBuildID(), "setBuildProps") if not props.has_key("builduid"): build.setProperty("builduid", genBuildUID(), "setBuildProps") return SUCCESS
def setBuildIDProps(step, build): """Sets buildid and builduid properties. On a rebuild we willl re-generate the builduid. Otherwise, we normally get them from the scheduler. If either of buildid or builduid doesn't exist, it will be created.""" if build.reason.startswith("The web-page 'rebuild'"): # Override builduid since this is a manually triggered # rebuild build.setProperty("builduid", genBuildUID(), "setBuildProps") # Make sure we have required properties props = build.getProperties() if "buildid" not in props: build.setProperty("buildid", genBuildID(), "setBuildProps") if "builduid" not in props: build.setProperty("builduid", genBuildUID(), "setBuildProps") return SUCCESS
def buildIDSchedFunc(sched, t, ssid): """Generates a unique buildid for this change. Returns a Properties instance with 'buildid' set to the buildid to use. scheduler `sched`'s state is modified as a result.""" state = sched.get_state(t) # Get the last buildid we scheduled from the database lastid = state.get("last_buildid", 0) newid = 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)) # Save it in the scheduler's state so we don't generate the same one again. state["last_buildid"] = newid sched.set_state(t, state) props = Properties() props.setProperty("buildid", newid, "buildIDSchedFunc") return props