[Buildbot-devel] conditional buildStep based on results from previous step(s)?

Mike Winter (miwinter) miwinter at cisco.com
Wed Mar 6 23:30:03 UTC 2013


FYI this is the last doStepIf I wrote using  properties. There were a lot
of reruns of single-cells or small-cells...


def checkForSkipOrRun(step):
  props = step.build.getProperties()
  twlog.msg('checkForSkipOrRun: step: %s' % (step.name))

  if props.has_key('NO_ACME') and isinstance(step,ACME):
      return False

  keys = ['NO_%s' % step.name, 'NO%s' % step.name, 'no%s' % step.name]
  if props.has_key(keys[0]) or props.has_key(keys[1]) or
props.has_key(keys[2]):
      return False

  if props.has_key('ONE_STEP'):
      return step.name == props['ONE_STEP']

  if props.has_key('SOME_STEPS_SUBSTR'):
      return step.name.find(props['SOME_STEPS_SUBSTR']) != -1

  # force-build page doesnt like some properties, ie regex !
  #if props.has_key('SOME_STEPS_REGEX'):
  #    p =re.compile(props['SOME_STEPS_REGEX'])
  #    return p.search( step.name) != None
    
  
  return True




On 3/6/13 3:23:22PM, "Stephan Koledin" <skoledin at gmail.com> wrote:

>Hi Mike-
>
>Thanks for the input. I've made-do in my current setup with a variation
>on a solution I finally found at:
>http://bb10.com/python-buildbot-devel/2010-05/msg00122.html -- that at
>least got me on the right track to accessing the all build info via the
>step object fed in from doStepIf.
>
>In my current simple setup, just using a static index works fine, but
>the better way by far is to grab the the result you're interested in
>based on step.getName() as in your example. I'll probably end up
>implementing something similar to make the overall setup more flexible.
>
>I think I have enough to figure out how to do what I need in a separate
>function that I can then call easily with doStepIf.
>
>Thanks.
>-Stephan
>
>On 3/6/2013 2:44 PM, Mike Winter (miwinter) wrote:
>> I did something like this for tracking cell-failures and assigning
>>owners,
>> but the solution was made against 7.12 and we never upgraded to v8.
>>
>> Here is the real-heart of the code:
>>
>> for step in build.steps:
>>    key = generate_problem_key(name, step.getName())
>>    #key = "%s-%s" % (name, step.getName())
>>
>>    (step_result, text2) = step.getResults()
>>    if step_result != SUCCESS and step_result != SKIPPED:
>>      failures = self.readFailuresLog(step)
>>
>>
>> HTH
>> Mike
>>
>>
>> On 3/6/13 12:46:17PM, "Stephan Koledin" <skoledin at gmail.com> wrote:
>>
>>> Hello-
>>>
>>> I'd like to make some of my buildSteps conditional (perhaps via
>>>doStepIf
>>> ?) on the status/result of the previous buildStep. For example if
>>>step#2
>>> fails, I'd like to skip step#3. Additionally, if step#3 is skipped,
>>> step#4-6 should also be skipped.
>>>
>>> Is this a matter of setting/getting a build Property within some
>>> customized ShellCommand-based classes, or is there a better/cleaner way
>>> to accomplish this out of the box?
>>>
>>> Sorry if this has already been covered in the list or documentation. If
>>> so, any pointers in the right direction would be much appreciated. I
>>> searched extensively, but couldn't really find anything specific to
>>>this
>>> situation.
>>>
>>> Thanks.
>>> -Stephan
>>>
>>> 
>>>------------------------------------------------------------------------
>>>--
>>> ----
>>> Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester
>>> Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the
>>> endpoint security space. For insight on selecting the right partner to
>>> tackle endpoint security challenges, access the full report.
>>> http://p.sf.net/sfu/symantec-dev2dev
>>> _______________________________________________
>>> Buildbot-devel mailing list
>>> Buildbot-devel at lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/buildbot-devel
>>
>





More information about the devel mailing list