def __init__(self, base_url, wrenchlane, prefix, suffix, *args, **kwargs): self.logger = None self.base_url = base_url self.wrenchlane = wrenchlane self.prefix = prefix self.suffix = suffix LoggingBuildStep.__init__(self, name="BostonNasGetPackageUrlStep", haltOnFailure=True, *args, **kwargs)
def __init__(self, master, workdir, inipath, l10nbase, redirects, locale, tree, **kwargs): """ @type master: string @param master: name of the master @type workdir: string @param workdir: local directory (relative to the Builder's root) where the mozilla and the l10n trees reside @type inipath: string @param inipath: path to the l10n.ini file, relative to the workdir @type l10nbase: string @param l10nbase: path to the localization dirs, relative to the workdir @type locale: string @param locale: Language code of the localization to be compared. @type tree: string @param tree: The tree identifier for this branch/product combo. """ LoggingBuildStep.__init__(self, **kwargs) self.args = {'workdir': workdir, 'inipath': inipath, 'l10nbase': l10nbase, 'redirects': redirects, 'locale': locale, 'tree': tree} self.master = master
def __init__(self, abbase=None, workdir=None, btarget=None, **kwargs): LoggingBuildStep.__init__(self, **kwargs) self.workdir = workdir self.abbase = abbase self.btarget = btarget self.description = ["Setting", "Destination"] self.addFactoryArguments(abbase=abbase, workdir=workdir, btarget=btarget)
def test_evaluateCommand_log_eval_func(self): cmd = FakeCmd("Log text", "") def eval(cmd, step_status): return WARNINGS lbs = LoggingBuildStep(log_eval_func=eval) status = lbs.evaluateCommand(cmd) self.assertEqual(status, WARNINGS, "evaluateCommand didn't call log_eval_func or overrode its results")
def __init__(self, schedulerNames=[], sourceStamp=None, updateSourceStamp=None, alwaysUseLatest=False, waitForFinish=False, set_properties={}, copy_properties=[], **kwargs): if not schedulerNames: raise ValueError("You must specify a scheduler to trigger") if sourceStamp and (updateSourceStamp is not None): raise ValueError("You can't specify both sourceStamp and updateSourceStamp") if sourceStamp and alwaysUseLatest: raise ValueError("You can't specify both sourceStamp and alwaysUseLatest") if alwaysUseLatest and (updateSourceStamp is not None): raise ValueError("You can't specify both alwaysUseLatest and updateSourceStamp") self.schedulerNames = schedulerNames self.sourceStamp = sourceStamp if updateSourceStamp is not None: self.updateSourceStamp = updateSourceStamp else: self.updateSourceStamp = not (alwaysUseLatest or sourceStamp) self.alwaysUseLatest = alwaysUseLatest self.waitForFinish = waitForFinish self.set_properties = set_properties self.copy_properties = copy_properties self.running = False self.ended = False LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(schedulerNames=schedulerNames, sourceStamp=sourceStamp, updateSourceStamp=updateSourceStamp, alwaysUseLatest=alwaysUseLatest, waitForFinish=waitForFinish, set_properties=set_properties, copy_properties=copy_properties)
def testStopBuildWaitingForStepLocks(self): b = self.build slavebuilder = Mock() l = SlaveLock('lock') lock_access = l.access('counting') l.access = lambda mode: lock_access real_lock = b.builder.botmaster.getLockByID(l).getLock(slavebuilder) step = LoggingBuildStep(locks=[lock_access]) b.setStepFactories([FakeStepFactory(step)]) real_lock.claim(Mock(), l.access('counting')) gotLocks = [False] def acquireLocks(res=None): gotLocks[0] = True retval = LoggingBuildStep.acquireLocks(step, res) self.assert_(b.currentStep is step) b.stopBuild('stop it') return retval step.acquireLocks = acquireLocks step.setStepStatus = Mock() step._step_status = Mock() step.step_status.addLog().chunkSize = 10 step.step_status.getLogs.return_value = [] b.startBuild(FakeBuildStatus(), None, slavebuilder) self.assertEqual(gotLocks, [True]) self.assert_(('stepStarted', (), {}) in step.step_status.method_calls) self.assertEqual(b.result, EXCEPTION)
def __init__(self, schedulerNames=[], sourceStamp = None, sourceStamps = None, updateSourceStamp=None, alwaysUseLatest=False, waitForFinish=False, set_properties={}, copy_properties=[], **kwargs): if not schedulerNames: config.error( "You must specify a scheduler to trigger") if (sourceStamp or sourceStamps) and (updateSourceStamp is not None): config.error( "You can't specify both sourceStamps and updateSourceStamp") if (sourceStamp or sourceStamps) and alwaysUseLatest: config.error( "You can't specify both sourceStamps and alwaysUseLatest") if alwaysUseLatest and (updateSourceStamp is not None): config.error( "You can't specify both alwaysUseLatest and updateSourceStamp" ) self.schedulerNames = schedulerNames self.sourceStamps = sourceStamps or [] if sourceStamp: self.sourceStamps.append(sourceStamp) if updateSourceStamp is not None: self.updateSourceStamp = updateSourceStamp else: self.updateSourceStamp = not (alwaysUseLatest or self.sourceStamps) self.alwaysUseLatest = alwaysUseLatest self.waitForFinish = waitForFinish self.set_properties = set_properties self.copy_properties = copy_properties self.running = False self.ended = False LoggingBuildStep.__init__(self, **kwargs)
def __init__(self, githubuser, githubrepo, githubtoken, state, *args, **kwargs): self.githubuser = githubuser self.githubrepo = githubrepo self.githubtoken = githubtoken assert state in ["pending", "success", "error", "failure"] self.state = state LoggingBuildStep.__init__(self, *args, **kwargs)
def testStopBuildWaitingForStepLocks(self): b = self.build l = SlaveLock("lock") lock_access = l.access("counting") l.access = lambda mode: lock_access real_lock = b.builder.botmaster.getLockByID(l).getLock(self.slavebuilder.slave) step = LoggingBuildStep(locks=[lock_access]) b.setStepFactories([FakeStepFactory(step)]) real_lock.claim(Mock(), l.access("counting")) gotLocks = [False] def acquireLocks(res=None): gotLocks[0] = True retval = LoggingBuildStep.acquireLocks(step, res) self.assert_(b.currentStep is step) b.stopBuild("stop it") return retval step.acquireLocks = acquireLocks b.startBuild(FakeBuildStatus(), None, self.slavebuilder) self.assertEqual(gotLocks, [True]) self.assertEqual(b.result, CANCELLED)
def __init__(self, factory, argdict=None, **kwargs): self.description = "Check if BSP Exists" self.layerversion_intel = None self.buildername = None for k, v in argdict.iteritems(): setattr(self, k, v) LoggingBuildStep.__init__(self, **kwargs)
def __init__(self, schedulerNames=[], updateSourceStamp=True, waitForFinish=False, **kwargs): """ Trigger the given schedulers when this step is executed. @param schedulerNames: A list of scheduler names that should be triggered. Schedulers can be specified using WithProperties, if desired. @param updateSourceStamp: If True (the default), I will try to give the schedulers an absolute SourceStamp for their builds, so that a HEAD build will use the same revision even if more changes have occurred since my build's update step was run. If False, I will use the original SourceStamp unmodified. @param waitForFinish: If False (the default), this step will finish as soon as I've started the triggered schedulers. If True, I will wait until all of the triggered schedulers have finished their builds. """ assert schedulerNames, "You must specify a scheduler to trigger" self.schedulerNames = schedulerNames self.updateSourceStamp = updateSourceStamp self.waitForFinish = waitForFinish self.running = False LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(schedulerNames=schedulerNames, updateSourceStamp=updateSourceStamp, waitForFinish=waitForFinish)
def testStopBuildWaitingForStepLocks(self): b = self.build lock = WorkerLock('lock') lock_access = lock.access('counting') lock.access = lambda mode: lock_access real_lock = b.builder.botmaster.getLockByID(lock) \ .getLock(self.workerforbuilder.worker) step = LoggingBuildStep(locks=[lock_access]) b.setStepFactories([FakeStepFactory(step)]) real_lock.claim(Mock(), lock.access('counting')) gotLocks = [False] def acquireLocks(res=None): gotLocks[0] = True retval = LoggingBuildStep.acquireLocks(step, res) self.assertTrue(b.currentStep is step) b.stopBuild('stop it') return retval step.acquireLocks = acquireLocks b.startBuild(FakeBuildStatus(), self.workerforbuilder) self.assertEqual(gotLocks, [True]) self.assertEqual(b.results, CANCELLED)
def __init__(self, dbname='test',workdir=None,port=8869,netport=8971,**kwargs): LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(dbname=dbname,workdir=workdir,port=port,netport=netport) self.args = {'dbname': dbname,'workdir':workdir,'netport':netport, 'port':port} self.dbname = dbname # Compute defaults for descriptions: description = ["Dropping db"] self.description = description
def __init__(self, dbname='test',workdir=None, addonsdir=None, demo=True, lang='en_US', port=8869, netport=8975,**kwargs): LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(dbname=dbname,workdir=workdir, demo=demo, lang=lang, netport=netport,port=port, addonsdir=addonsdir) self.args = {'dbname': dbname,'workdir':workdir, 'netport':netport,'port' : port, 'addonsdir' : addonsdir} # Compute defaults for descriptions: description = ["Starting server with upgradetion"] self.description = description
def __init__(self, svnurl=None, baseURL=None, defaultBranch=None, directory=None, workdir=None, mode='update',alwaysUseLatest=True,timeout=20*60, retry=None,**kwargs): LoggingBuildStep.__init__(self, **kwargs) SVN.__init__(self, svnurl=svnurl, baseURL=baseURL, defaultBranch=defaultBranch, directory=directory, workdir=workdir, mode=mode, alwaysUseLatest=alwaysUseLatest, timeout=timeout, retry=retry,**kwargs) self.name = 'svn-update' self.description = ["updating", "branch %s%s"%(baseURL,defaultBranch)] self.descriptionDone = ["updated", "branch %s%s"%(baseURL,defaultBranch)]
def __init__(self, dbname='test',workdir=None, addonsdir=None, demo=True, lang='en_US',netport=8970, port=8869 ,**kwargs): LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(dbname=dbname,workdir=workdir, demo=demo, lang=lang, netport=netport,port=port, addonsdir=addonsdir) self.args = {'dbname': dbname,'workdir':workdir, 'demo':demo, 'lang':lang,'netport':netport, 'port' : port, 'addonsdir' : addonsdir} self.dbname = dbname # Compute defaults for descriptions: description = ["creating db"] self.description = description
def __init__(self, dbname='test',workdir=None,addonsdir=None,netport=8972, port=8869 ,**kwargs): LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(dbname=dbname,workdir=workdir,addonsdir=addonsdir,netport=netport, port=port, logfiles={}) self.args = {'dbname': dbname, 'modules':'', 'port' :port,'workdir':workdir,'netport':netport,'addonsdir':addonsdir,'logfiles':{}} self.dbname = dbname # Compute defaults for descriptions: description = ["checking quality"] self.description = description self.quality_stage = 'pass'
def __init__(self, timeout=5, **kwargs): """ @type timeout: int @param timeout: the number of seconds to delay """ LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(timeout=timeout) self.timeout = timeout self.description = ["remote", "delay", "%s secs" % timeout]
def __init__(self, workdir=WithProperties('%(repo_mode)s'), **kwargs): LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(workdir=workdir) self.args = {'workdir': workdir } # Compute defaults for descriptions: description = ["Performing bzr stats"] self.description = description self.build_result = SUCCESS
def __init__(self, workdir=None, **kwargs): LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(workdir=workdir) self.args = {'workdir':workdir} self.workdir = workdir # Compute defaults for descriptions: description = ["Reverting Branch"] self.description = description self.summaries = {}
def __init__(self, branch=None, workdir=None, **kwargs): LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(branch=branch, workdir=workdir) self.args = {'branch': branch,'workdir':workdir} # Compute defaults for descriptions: self.branch = branch description = ["Merging Branch"] self.description = description self.env_info = '' self.summaries = {}
def __init__(self, schedulerNames=[], updateSourceStamp=True, alwaysUseLatest=False, waitForFinish=False, set_properties={}, copy_properties=[], **kwargs): """ Trigger the given schedulers when this step is executed. @param schedulerNames: A list of scheduler names that should be triggered. Schedulers can be specified using WithProperties, if desired. @param updateSourceStamp: If True (the default), I will try to give the schedulers an absolute SourceStamp for their builds, so that a HEAD build will use the same revision even if more changes have occurred since my build's update step was run. If False, I will use the original SourceStamp unmodified. @param alwaysUseLatest: If False (the default), I will give the SourceStamp of the current build to the schedulers (as controled by updateSourceStamp). If True, I will give the schedulers an empty SourceStamp, corresponding to the latest revision. @param waitForFinish: If False (the default), this step will finish as soon as I've started the triggered schedulers. If True, I will wait until all of the triggered schedulers have finished their builds. @param set_properties: A dictionary of properties to set for any builds resulting from this trigger. These properties will override properties set in the Triggered scheduler's constructor. @param copy_properties: a list of property names to copy verbatim into any builds resulting from this trigger. """ assert schedulerNames, "You must specify a scheduler to trigger" self.schedulerNames = schedulerNames self.updateSourceStamp = updateSourceStamp self.alwaysUseLatest = alwaysUseLatest self.waitForFinish = waitForFinish self.set_properties = set_properties self.copy_properties = copy_properties self.running = False self.ended = False LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(schedulerNames=schedulerNames, updateSourceStamp=updateSourceStamp, alwaysUseLatest=alwaysUseLatest, waitForFinish=waitForFinish, set_properties=set_properties, copy_properties=copy_properties)
def __init__(self, workdir=None, addonsdir=None, **kwargs): LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(workdir=workdir, addonsdir=addonsdir) self.args = {'workdir': workdir, 'addonsdir':addonsdir} # Compute defaults for descriptions: description = ["copy", '"'+workdir+'"', "in", '"'+ addonsdir +'"'] descriptionDone = ["copy", '"'+workdir+'"' , "in", '"' + addonsdir +'"'] self.description = description self.descriptionDone = descriptionDone
def __init__(self, scheduler, **kwargs): if not "name" in kwargs: kwargs['name'] = 'trigger' #if not "description" in kwargs: # kwargs['description'] = kwargs['name'] LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(scheduler=scheduler) self.scheduler = scheduler self.running = False self.ended = False
def __init__( self, master, workdir, basedir, inipath, l10nbase, locale, tree, gather_stats=False, initial_module=None, **kwargs ): """ @type master: string @param master: name of the master @type workdir: string @param workdir: local directory (relative to the Builder's root) where the mozilla and the l10n trees reside @type basedir: string @param basdir: path to all local repository clones, relative to the workdir @type inipath: string @param inipath: path to the l10n.ini file, relative to the workdir @type l10nbase: string @param l10nbase: path to the localization dirs, relative to the workdir @type locale: string @param locale: Language code of the localization to be compared. @type tree: string @param tree: The tree identifier for this branch/product combo. @type gather_stats: bool @param gather_stats: whether or not to gather stats about untranslated strings. """ LoggingBuildStep.__init__(self, **kwargs) self.args = { "workdir": workdir, "basedir": basedir, "inipath": inipath, "l10nbase": l10nbase, "locale": locale, "tree": tree, "gather_stats": gather_stats, "initial_module": initial_module, } self.master = master
def __init__(self,workdir=None, addonsdir=None,dbname=False,port=8869, netport=8973, **kwargs): LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(workdir=workdir,addonsdir=addonsdir,dbname=dbname, port=port, netport=netport) self.args = {'addonsdir': addonsdir, 'workdir': workdir, 'dbname' : dbname, 'netport' : netport, 'port' : port, } self.name = 'install-translation' self.description = ["Installing Translation"] self.translation_lst = ''
def __init__(self, root, issue, patchset, email, password, workdir, timeout, server, **kwargs): LoggingBuildStep.__init__(self, **kwargs) self.args = {'root': root, 'issue': issue, 'patchset': patchset, 'email': email, 'password': password, 'workdir': workdir, 'timeout': timeout, 'server': server, }
def setProperty(self, name, value , source): if self.codebase != '': assert not isinstance(self.getProperty(name, None), str), \ "Sourcestep %s has a codebase, other sourcesteps don't" \ % self.name property_dict = self.getProperty(name, {}) property_dict[self.codebase] = value LoggingBuildStep.setProperty(self, name, property_dict, source) else: assert not isinstance(self.getProperty(name, None), dict), \ "Sourcestep %s does not have a codebase, other sourcesteps do" \ % self.name LoggingBuildStep.setProperty(self, name, value, source)
def __init__(self, workdir=WithProperties('%(repo_mode)s'), repo_mode=WithProperties('%(repo_mode)s'), **kwargs): LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(workdir=workdir, repo_mode=repo_mode) self.args = {'workdir': workdir, 'repo_mode': repo_mode } # Compute defaults for descriptions: description = ["Performing lint check"] self.description = description self.known_res = [] self.build_result = SUCCESS for kns in self.known_strs: self.known_res.append((re.compile(kns[0]), kns[1]))
def __init__(self, slave_name, *args, **kwargs): kwargs['haltOnFailure']=False if 'workdir' not in kwargs: kwargs['workdir'] = 'build' if 'env' not in kwargs: kwargs['env'] = {} if 'description' in kwargs and 'descriptionDone' not in kwargs: kwargs['descriptionDone'] = kwargs['description'] self.slave_name = slave_name self.arguments = kwargs.copy() LoggingBuildStep.__init__(self, *args, **kwargs)
def __init__(self, schedulerNames=[], updateSourceStamp=True, waitForFinish=False, set_properties={}, **kwargs): """ Trigger the given schedulers when this step is executed. @param schedulerNames: A list of scheduler names that should be triggered. Schedulers can be specified using WithProperties, if desired. @param updateSourceStamp: If True (the default), I will try to give the schedulers an absolute SourceStamp for their builds, so that a HEAD build will use the same revision even if more changes have occurred since my build's update step was run. If False, I will use the original SourceStamp unmodified. @param waitForFinish: If False (the default), this step will finish as soon as I've started the triggered schedulers. If True, I will wait until all of the triggered schedulers have finished their builds. @param set_properties: A dictionary of properties to set for any builds resulting from this trigger. To copy existing properties, use WithProperties. These properties will override properties set in the Triggered scheduler's constructor. """ assert schedulerNames, "You must specify a scheduler to trigger" self.schedulerNames = schedulerNames self.updateSourceStamp = updateSourceStamp self.waitForFinish = waitForFinish self.set_properties = set_properties self.running = False LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(schedulerNames=schedulerNames, updateSourceStamp=updateSourceStamp, waitForFinish=waitForFinish)
def getText(self, cmd, results): assert cmd.rc == results, "This should really be our own result" log.msg("called getText") text = ["no completion found for result %s" % results] if hasattr(cmd, 'completion'): log.msg("rate is %d, results is %s" % (cmd.completion, results)) text = ['%d%% translated' % cmd.completion] if False and cmd.missing > 0: text += ['missing: %d' % cmd.missing] return LoggingBuildStep.getText(self, cmd, results) + text
def testStopBuildWaitingForStepLocks(self): r = FakeRequest() b = Build([r]) b.setBuilder(Mock()) b.builder.botmaster = FakeMaster() slavebuilder = Mock() status = Mock() l = SlaveLock('lock') lock_access = l.access('counting') l.access = lambda mode: lock_access real_lock = b.builder.botmaster.getLockByID(l).getLock(slavebuilder) step = LoggingBuildStep(locks=[lock_access]) def factory(*args): return step b.setStepFactories([(factory, {})]) real_lock.claim(Mock(), l.access('counting')) gotLocks = [False] def acquireLocks(res=None): gotLocks[0] = True retval = LoggingBuildStep.acquireLocks(step, res) self.assert_(b.currentStep is step) b.stopBuild('stop it') return retval step.acquireLocks = acquireLocks step.setStepStatus = Mock() step.step_status = Mock() step.step_status.addLog().chunkSize = 10 step.step_status.getLogs.return_value = [] b.startBuild(status, None, slavebuilder) self.assertEqual(gotLocks, [True]) self.assert_(('stepStarted', (), {}) in step.step_status.method_calls) self.assertEqual(b.result, EXCEPTION)
def __init__(self, schedulerNames=[], sourceStamp=None, sourceStamps=None, updateSourceStamp=None, alwaysUseLatest=False, waitForFinish=False, set_properties={}, copy_properties=[], **kwargs): if not schedulerNames: config.error("You must specify a scheduler to trigger") if (sourceStamp or sourceStamps) and (updateSourceStamp is not None): config.error( "You can't specify both sourceStamps and updateSourceStamp") if (sourceStamp or sourceStamps) and alwaysUseLatest: config.error( "You can't specify both sourceStamps and alwaysUseLatest") if alwaysUseLatest and (updateSourceStamp is not None): config.error( "You can't specify both alwaysUseLatest and updateSourceStamp") self.schedulerNames = schedulerNames self.sourceStamps = sourceStamps or [] if sourceStamp: self.sourceStamps.append(sourceStamp) if updateSourceStamp is not None: self.updateSourceStamp = updateSourceStamp else: self.updateSourceStamp = not (alwaysUseLatest or self.sourceStamps) self.alwaysUseLatest = alwaysUseLatest self.waitForFinish = waitForFinish properties = {} properties.update(set_properties) for i in copy_properties: properties[i] = Property(i) self.set_properties = properties self.running = False self.ended = False LoggingBuildStep.__init__(self, **kwargs) # Scheduler name cache self._all_schedulers = None
def __init__(self, schedulerNames=[], sourceStamp=None, updateSourceStamp=None, alwaysUseLatest=False, waitForFinish=False, set_properties={}, copy_properties=[], **kwargs): if not schedulerNames: raise config.ConfigErrors( ["You must specify a scheduler to trigger"]) if sourceStamp and (updateSourceStamp is not None): raise config.ConfigErrors( ["You can't specify both sourceStamp and updateSourceStamp"]) if sourceStamp and alwaysUseLatest: raise config.ConfigErrors( ["You can't specify both sourceStamp and alwaysUseLatest"]) if alwaysUseLatest and (updateSourceStamp is not None): raise config.ConfigErrors([ "You can't specify both alwaysUseLatest and updateSourceStamp" ]) self.schedulerNames = schedulerNames self.sourceStamp = sourceStamp if updateSourceStamp is not None: self.updateSourceStamp = updateSourceStamp else: self.updateSourceStamp = not (alwaysUseLatest or sourceStamp) self.alwaysUseLatest = alwaysUseLatest self.waitForFinish = waitForFinish self.set_properties = set_properties self.copy_properties = copy_properties self.running = False self.ended = False LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(schedulerNames=schedulerNames, sourceStamp=sourceStamp, updateSourceStamp=updateSourceStamp, alwaysUseLatest=alwaysUseLatest, waitForFinish=waitForFinish, set_properties=set_properties, copy_properties=copy_properties)
def __init__(self, workdir=None, description=None, descriptionDone=None, command=None, usePTY="slave-config", **kwargs): # most of our arguments get passed through to the RemoteShellCommand # that we create, but first strip out the ones that we pass to # BuildStep (like haltOnFailure and friends), and a couple that we # consume ourselves. if description: self.description = description if isinstance(self.description, str): self.description = [self.description] if descriptionDone: self.descriptionDone = descriptionDone if isinstance(self.descriptionDone, str): self.descriptionDone = [self.descriptionDone] if command: self.setCommand(command) # pull out the ones that LoggingBuildStep wants, then upcall buildstep_kwargs = {} for k in kwargs.keys()[:]: if k in self.__class__.parms: buildstep_kwargs[k] = kwargs[k] del kwargs[k] LoggingBuildStep.__init__(self, **buildstep_kwargs) self.addFactoryArguments(workdir=workdir, description=description, descriptionDone=descriptionDone, command=command) # everything left over goes to the RemoteShellCommand kwargs['workdir'] = workdir # including a copy of 'workdir' kwargs['usePTY'] = usePTY self.remote_kwargs = kwargs # we need to stash the RemoteShellCommand's args too self.addFactoryArguments(**kwargs)
def updateSourceProperty(self, name, value, source=''): """ Update a property, indexing the proeprty by codebase if codebase is not ''. Source steps should generally use this instead of setProperty. """ # pick a decent source name if source == '': source = self.__class__.__name__ if self.codebase != '': assert not isinstance(self.getProperty(name, None), str), \ "Sourcestep %s has a codebase, other sourcesteps don't" \ % self.name property_dict = self.getProperty(name, {}) property_dict[self.codebase] = value LoggingBuildStep.setProperty(self, name, property_dict, source) else: assert not isinstance(self.getProperty(name, None), dict), \ "Sourcestep %s does not have a codebase, other sourcesteps do" \ % self.name LoggingBuildStep.setProperty(self, name, value, source)
def __init__(self, artifactServer, artifactServerDir, artifactBuilderName, workdir='', artifactServerPort=None, artifactDestination=None, artifactDirectory=None, artifact=None, usePowerShell=True, **kwargs): self.workdir = workdir self.artifact = artifact self.artifactBuilderName = artifactBuilderName self.artifactDirectory = artifactDirectory self.artifactServer = artifactServer self.artifactServerDir = artifactServerDir self.artifactServerPort = artifactServerPort self.artifactDestination = artifactDestination self.master = None self.usePowerShell = usePowerShell LoggingBuildStep.__init__(self, **kwargs)
def __init__(self, workdir=None, dbname=False, addonsdir=None, netport=None, port=None, ftp_port=None, force_modules=None, black_modules=None, test_mode='full', do_warnings=None, lang=None, debug=False, repo_mode=WithProperties('%(repo_mode)s'), **kwargs): LoggingBuildStep.__init__(self, **kwargs) if isinstance(black_modules, basestring): black_modules = black_modules.split(' ') if isinstance(force_modules, basestring): force_modules = force_modules.split(' ') self.addFactoryArguments(workdir=workdir, dbname=dbname, addonsdir=addonsdir, netport=netport, port=port, ftp_port=ftp_port, logfiles={}, force_modules=(force_modules or []), black_modules=(black_modules or []), do_warnings=do_warnings, lang=lang, repo_mode=repo_mode, debug=debug, test_mode=test_mode) self.args = {'port' :port, 'workdir':workdir, 'dbname': dbname, 'netport':netport, 'addonsdir':addonsdir, 'logfiles':{}, 'ftp_port': ftp_port, 'force_modules': (force_modules or []), 'black_modules': (black_modules or []), 'do_warnings': do_warnings, 'lang': lang, 'test_mode': test_mode, 'repo_mode': repo_mode, 'debug': debug } description = ["Performing OpenERP Test..."] self.description = description self.summaries = {} self.build_result = SUCCESS self.addLogObserver('stdio', BqiObserver()) self.progressMetrics += ('tests',)
def finished(self, results): if results == SUCCESS: self.step_status.setText([ "Downloaded artifacts from %s partitions" % self.partitionCount ]) LoggingBuildStep.finished(self, results)
def __init__(self, *args, **kwargs): LoggingBuildStep.__init__(self, name='check-retry', *args, **kwargs)
def setBuild(self, build): LoggingBuildStep.setBuild(self, build) # Set this here, so it gets rendered when we start the step self.slaveEnvironment = self.build.slaveEnvironment
def __init__(self, objdir="", **kwargs): LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(objdir=objdir) self.objdir = objdir
def __init__(self, schedulerNames=[], sourceStamp=None, updateSourceStamp=None, alwaysUseLatest=False, waitForFinish=False, set_properties={}, copy_properties=[], **kwargs): """ Trigger the given schedulers when this step is executed. @param schedulerNames: A list of scheduler names that should be triggered. Schedulers can be specified using WithProperties, if desired. @param sourceStamp: A dict containing the source stamp to use for the build. Keys must include branch, revision, repository and project. In addition, patch_body, patch_level, and patch_subdir can be specified. Only one of sourceStamp, updateSourceStamp and alwaysUseLatest can be specified. Any of these can be specified using WithProperties, if desired. @param updateSourceStamp: If True (the default), I will try to give the schedulers an absolute SourceStamp for their builds, so that a HEAD build will use the same revision even if more changes have occurred since my build's update step was run. If False, I will use the original SourceStamp unmodified. @param alwaysUseLatest: If False (the default), I will give the SourceStamp of the current build to the schedulers (as controled by updateSourceStamp). If True, I will give the schedulers an empty SourceStamp, corresponding to the latest revision. @param waitForFinish: If False (the default), this step will finish as soon as I've started the triggered schedulers. If True, I will wait until all of the triggered schedulers have finished their builds. @param set_properties: A dictionary of properties to set for any builds resulting from this trigger. These properties will override properties set in the Triggered scheduler's constructor. @param copy_properties: a list of property names to copy verbatim into any builds resulting from this trigger. """ assert schedulerNames, "You must specify a scheduler to trigger" if sourceStamp and updateSourceStamp: raise ValueError("You can't specify both sourceStamp and updateSourceStamp") if sourceStamp and alwaysUseLatest: raise ValueError("You can't specify both sourceStamp and alwaysUseLatest") if alwaysUseLatest and updateSourceStamp: raise ValueError("You can't specify both alwaysUseLatest and updateSourceStamp") self.schedulerNames = schedulerNames self.sourceStamp = sourceStamp self.updateSourceStamp = updateSourceStamp or not (alwaysUseLatest or sourceStamp) self.alwaysUseLatest = alwaysUseLatest self.waitForFinish = waitForFinish self.set_properties = set_properties self.copy_properties = copy_properties self.running = False self.ended = False LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(schedulerNames=schedulerNames, sourceStamp=sourceStamp, updateSourceStamp=updateSourceStamp, alwaysUseLatest=alwaysUseLatest, waitForFinish=waitForFinish, set_properties=set_properties, copy_properties=copy_properties)
def __init__(self, properties, *args, **kwargs): self.properties = properties LoggingBuildStep.__init__(self, name='putproperties', *args, **kwargs)
def setStepStatus(self, step_status): LoggingBuildStep.setStepStatus(self, step_status)
def __init__(self, base_url, *args, **kwargs): self.base_url = base_url LoggingBuildStep.__init__(self, name="buildURL2prop", haltOnFailure=True, *args, **kwargs)
def __init__(self, hideStepIf=True, locks=None, **kwargs): LoggingBuildStep.__init__(self, hideStepIf=hideStepIf, locks=locks, **kwargs)
def __init__(self, hideStepIf=True, **kwargs): self.releaseLockInstance = None LoggingBuildStep.__init__(self, hideStepIf=hideStepIf, **kwargs)
def __init__(self, handle, **kwargs): LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(handle=handle) self.handle = handle
def releaseLocks(self): if not self.resumeBuild: LoggingBuildStep.releaseLocks(self)
def acquireLocks(res=None): gotLocks[0] = True retval = LoggingBuildStep.acquireLocks(step, res) self.assert_(b.currentStep is step) b.stopBuild('stop it') return retval
def __init__(self, workdir=None, mode='update', alwaysUseLatest=False, timeout=20 * 60, retry=None, env=None, logEnviron=True, description=None, descriptionDone=None, **kwargs): """ @type workdir: string @param workdir: local directory (relative to the Builder's root) where the tree should be placed @type mode: string @param mode: the kind of VC operation that is desired: - 'update': specifies that the checkout/update should be performed directly into the workdir. Each build is performed in the same directory, allowing for incremental builds. This minimizes disk space, bandwidth, and CPU time. However, it may encounter problems if the build process does not handle dependencies properly (if you must sometimes do a 'clean build' to make sure everything gets compiled), or if source files are deleted but generated files can influence test behavior (e.g. python's .pyc files), or when source directories are deleted but generated files prevent CVS from removing them. When used with a patched checkout, from a previous buildbot try for instance, it will try to "revert" the changes first and will do a clobber if it is unable to get a clean checkout. The behavior is SCM-dependent. - 'copy': specifies that the source-controlled workspace should be maintained in a separate directory (called the 'copydir'), using checkout or update as necessary. For each build, a new workdir is created with a copy of the source tree (rm -rf workdir; cp -R -P -p copydir workdir). This doubles the disk space required, but keeps the bandwidth low (update instead of a full checkout). A full 'clean' build is performed each time. This avoids any generated-file build problems, but is still occasionally vulnerable to problems such as a CVS repository being manually rearranged (causing CVS errors on update) which are not an issue with a full checkout. - 'clobber': specifies that the working directory should be deleted each time, necessitating a full checkout for each build. This insures a clean build off a complete checkout, avoiding any of the problems described above, but is bandwidth intensive, as the whole source tree must be pulled down for each build. - 'export': is like 'clobber', except that e.g. the 'cvs export' command is used to create the working directory. This command removes all VC metadata files (the CVS/.svn/{arch} directories) from the tree, which is sometimes useful for creating source tarballs (to avoid including the metadata in the tar file). Not all VC systems support export. @type alwaysUseLatest: boolean @param alwaysUseLatest: whether to always update to the most recent available sources for this build. Normally the Source step asks its Build for a list of all Changes that are supposed to go into the build, then computes a 'source stamp' (revision number or timestamp) that will cause exactly that set of changes to be present in the checked out tree. This is turned into, e.g., 'cvs update -D timestamp', or 'svn update -r revnum'. If alwaysUseLatest=True, bypass this computation and always update to the latest available sources for each build. The source stamp helps avoid a race condition in which someone commits a change after the master has decided to start a build but before the slave finishes checking out the sources. At best this results in a build which contains more changes than the buildmaster thinks it has (possibly resulting in the wrong person taking the blame for any problems that result), at worst is can result in an incoherent set of sources (splitting a non-atomic commit) which may not build at all. @type retry: tuple of ints (delay, repeats) (or None) @param retry: if provided, VC update failures are re-attempted up to REPEATS times, with DELAY seconds between each attempt. Some users have slaves with poor connectivity to their VC repository, and they say that up to 80% of their build failures are due to transient network failures that could be handled by simply retrying a couple times. @type logEnviron: boolean @param logEnviron: If this option is true (the default), then the step's logfile will describe the environment variables on the slave. In situations where the environment is not relevant and is long, it may be easier to set logEnviron=False. """ LoggingBuildStep.__init__(self, **kwargs) self.addFactoryArguments(workdir=workdir, mode=mode, alwaysUseLatest=alwaysUseLatest, timeout=timeout, retry=retry, logEnviron=logEnviron, env=env, description=description, descriptionDone=descriptionDone) assert mode in ("update", "copy", "clobber", "export") if retry: delay, repeats = retry assert isinstance(repeats, int) assert repeats > 0 self.args = { 'mode': mode, 'timeout': timeout, 'retry': retry, 'patch': None, # set during .start } # This will get added to args later, after properties are rendered self.workdir = workdir self.sourcestamp = None # Codebase cannot be set yet self.codebase = '' self.alwaysUseLatest = alwaysUseLatest self.logEnviron = logEnviron self.env = env descriptions_for_mode = {"clobber": "checkout", "export": "exporting"} descriptionDones_for_mode = {"clobber": "checkout", "export": "export"} if description: self.description = description else: self.description = [descriptions_for_mode.get(mode, "updating")] if isinstance(self.description, str): self.description = [self.description] if descriptionDone: self.descriptionDone = descriptionDone else: self.descriptionDone = [ descriptionDones_for_mode.get(mode, "update") ] if isinstance(self.descriptionDone, str): self.descriptionDone = [self.descriptionDone]
def __init__(self, workdir=None, mode='update', alwaysUseLatest=False, timeout=20*60, retry=None, env=None, logEnviron=True, description=None, descriptionDone=None, descriptionSuffix=None, codebase='', **kwargs): """ @type workdir: string @param workdir: local directory (relative to the Builder's root) where the tree should be placed @type alwaysUseLatest: boolean @param alwaysUseLatest: whether to always update to the most recent available sources for this build. Normally the Source step asks its Build for a list of all Changes that are supposed to go into the build, then computes a 'source stamp' (revision number or timestamp) that will cause exactly that set of changes to be present in the checked out tree. This is turned into, e.g., 'cvs update -D timestamp', or 'svn update -r revnum'. If alwaysUseLatest=True, bypass this computation and always update to the latest available sources for each build. The source stamp helps avoid a race condition in which someone commits a change after the master has decided to start a build but before the slave finishes checking out the sources. At best this results in a build which contains more changes than the buildmaster thinks it has (possibly resulting in the wrong person taking the blame for any problems that result), at worst is can result in an incoherent set of sources (splitting a non-atomic commit) which may not build at all. @type logEnviron: boolean @param logEnviron: If this option is true (the default), then the step's logfile will describe the environment variables on the slave. In situations where the environment is not relevant and is long, it may be easier to set logEnviron=False. @type codebase: string @param codebase: Specifies which changes in a build are processed by the step. The default codebase value is ''. The codebase must correspond to a codebase assigned by the codebaseGenerator. If no codebaseGenerator is defined in the master then codebase doesn't need to be set, the default value will then match all changes. """ LoggingBuildStep.__init__(self, **kwargs) # This will get added to args later, after properties are rendered self.workdir = workdir self.sourcestamp = None self.codebase = codebase if self.codebase: self.name = ' '.join((self.name, self.codebase)) self.alwaysUseLatest = alwaysUseLatest self.logEnviron = logEnviron self.env = env self.timeout = timeout descriptions_for_mode = { "clobber": "checkout", "export": "exporting"} descriptionDones_for_mode = { "clobber": "checkout", "export": "export"} if description: self.description = description else: self.description = [ descriptions_for_mode.get(mode, "updating")] if isinstance(self.description, str): self.description = [self.description] if descriptionDone: self.descriptionDone = descriptionDone else: self.descriptionDone = [ descriptionDones_for_mode.get(mode, "update")] if isinstance(self.descriptionDone, str): self.descriptionDone = [self.descriptionDone] if descriptionSuffix: self.descriptionSuffix = descriptionSuffix else: self.descriptionSuffix = self.codebase or None # want None in lieu of '' if isinstance(self.descriptionSuffix, str): self.descriptionSuffix = [self.descriptionSuffix]
def setStepStatus(self, step_status): LoggingBuildStep.setStepStatus(self, step_status) # start doesn't set text soon enough to capture our description in # the stepStarted status notification. Set text here so it's included. self.step_status.setText(self.describe(False))