<div dir="ltr">This looks useful to me Consider the class below, I want to run a query and process the results returning success if some limit is true. Is this the correct way to write a custom build step to do this?<div><br></div><div><tt>class _GetDataFromVCS(steps.BuildStep):</tt><tt><br></tt><tt>    """</tt><tt><br></tt><tt>        Query VCS for data on the latest changes and process the output of the query</tt></div><div><tt>        return success if there are more than 50 changes<br></tt><tt>    """</tt><tt><br></tt><tt><br></tt><tt>    def __init__(self, prop, **kwargs):</tt><tt><br></tt><tt>        steps.BuildStep.__init__(self, **kwargs)</tt><tt><br></tt><tt>        <b><font color="#ff0000" size="4">#DO I need an __init__???</font></b></tt></div><div><tt><br></tt></div><div><tt><br></tt><tt>    @defer.inlineCallbacks</tt><tt><br></tt><tt>    def run(self):</tt></div><div><tt><font size="4" color="#ff0000">         # First query database for all peter's changes the output goes to STDOUT</font></tt></div><div><tt>        _vcs_db=props.getProperty("database_name")<br></tt><tt>        _vcs_query="select * from _vcs_db where change_user=peter"</tt></div><div><tt>         result=_vcs_db.execute(_vcs_query)</tt></div><div><tt>         stdout.write(result)</tt></div><div><tt>           <font size="4" color="#ff0000"># Parse the query results that go to STDOUT see if there are more than 50 changes</font></tt></div><div><tt>          for line in STDOUT:</tt></div><div><tt>            line_count=line_count+1</tt></div><div><tt>          if line_count>50:<br></tt><tt>              yield defer.returnValue(SUCCESS)</tt><br></div><div><tt>          else:</tt></div><div><tt>              yield defer.returnValue(FAIL)</tt></div><div><tt><br></tt></div><div><tt></tt></div><div><tt>How do I make use of the class in my master.cfg file? to create an instance of the _GetDataFromVCS do I just do</tt></div><div><tt><br></tt></div><div><tt><span style="font-family:Arial,Helvetica,sans-serif">vcs_step = </span>_GetDataFromVCS<span style="font-family:Arial,Helvetica,sans-serif">(</span><span style="font-family:Arial,Helvetica,sans-serif">description=step,</span><span style="font-family:Arial,Helvetica,sans-serif"> descriptionDone=step,</span><span style="font-family:Arial,Helvetica,sans-serif"> name=step,</span><span style="font-family:Arial,Helvetica,sans-serif"> haltOnFailure=True)</span><br style="font-family:Arial,Helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif">            f.addStep(</span>vcs_step<span style="font-family:Arial,Helvetica,sans-serif">)</span><br></tt></div><div><tt><span style="font-family:Arial,Helvetica,sans-serif"><br></span></tt></div><div><tt><span style="font-family:Arial,Helvetica,sans-serif">I don't have a "COMMAND" anywhere in my class, will this work?</span></tt></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Sep 26, 2019 at 2:43 PM Clément Hurlin <<a href="mailto:clement.hurlin@provenrun.com" target="_blank">clement.hurlin@provenrun.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF">
    <p>Dear Viraj,</p>
    <p>What do you want to do with your custom step ?</p>
    <p>Shooting in the dark, here are simple custom steps I have in my
      bots, to provide you examples:</p>
    <p><tt>class _ClearPropertyStep(steps.BuildStep):</tt><tt><br>
      </tt><tt>    """</tt><tt><br>
      </tt><tt>        Step that clears a property</tt><tt><br>
      </tt><tt>    """</tt><tt><br>
      </tt><tt><br>
      </tt><tt>    def __init__(self, prop, **kwargs):</tt><tt><br>
      </tt><tt>        steps.BuildStep.__init__(self, **kwargs)</tt><tt><br>
      </tt><tt>        assert prop is not None and len(prop) > 0</tt><tt><br>
      </tt><tt>        self.property = prop</tt><tt><br>
      </tt><tt><br>
      </tt><tt>    @defer.inlineCallbacks</tt><tt><br>
      </tt><tt>    def run(self):</tt><tt><br>
      </tt><tt>        print("Clearing property " + self.property)</tt><tt><br>
      </tt><tt>        self.setProperty(self.property, None,
        str(type(self)))</tt><tt><br>
      </tt><tt>        yield defer.returnValue(SUCCESS)</tt><br>
    </p>
    <p>Here's another one:</p>
    <p><tt>class _URLStep(steps.BuildStep):<br>
            """<br>
                Step whose only purpose is to show a description and an
        URL<br>
            """<br>
        <br>
            renderables = steps.BuildStep.renderables + [<br>
                'url_text',<br>
                'url',<br>
            ]<br>
        <br>
            def __init__(self, url_text, url, **kwargs):<br>
                steps.BuildStep.__init__(self, **kwargs)<br>
                assert url_text is not None<br>
                self.url_text = url_text<br>
                assert url is not None<br>
                self.url = url<br>
        <br>
            @defer.inlineCallbacks<br>
            def run(self):<br>
                print("Setting URL: " + str(self.url))<br>
                self.addURL(self.url_text, self.url)<br>
                yield defer.returnValue(SUCCESS)</tt><br>
    </p>
    <p>Best,</p>
    <p>Clément Hurlin<br>
    </p>
    <blockquote type="cite">
      
      <div dir="ltr">
        <div>Hi</div>
        <div><br>
        </div>
        <div>I got stuck in buildbot for configuring custom buildbot
          step. <br>
        </div>
        <div><br>
        </div>
        <div>Can you please help me with one of the example how we can
          create custom build step.</div>
        <div><br>
        </div>
        <div>Regards,</div>
        <div>Viraj Wadate</div>
      </div>
      <br>
      <fieldset class="gmail-m_4747729819541133229gmail-m_8607687133624978726mimeAttachmentHeader"></fieldset>
      <pre class="gmail-m_4747729819541133229gmail-m_8607687133624978726moz-quote-pre">_______________________________________________
users mailing list
<a class="gmail-m_4747729819541133229gmail-m_8607687133624978726moz-txt-link-abbreviated" href="mailto:users@buildbot.net" target="_blank">users@buildbot.net</a>
<a class="gmail-m_4747729819541133229gmail-m_8607687133624978726moz-txt-link-freetext" href="https://lists.buildbot.net/mailman/listinfo/users" target="_blank">https://lists.buildbot.net/mailman/listinfo/users</a></pre>
    </blockquote>
  </div>

_______________________________________________<br>
users mailing list<br>
<a href="mailto:users@buildbot.net" target="_blank">users@buildbot.net</a><br>
<a href="https://lists.buildbot.net/mailman/listinfo/users" rel="noreferrer" target="_blank">https://lists.buildbot.net/mailman/listinfo/users</a></blockquote></div>