Ticket #2164 (closed support-request: fixed)

Opened 18 months ago

Last modified 16 months ago

Triggering a Nightly Build only if Continuous build status is success

Reported by: mariamarcano Owned by:
Priority: major Milestone:
Version: 0.8.3p1 Keywords:
Cc:

Description

Hello,

I want to add the following logic on the builds, I want to trigger a Nightly Build only if the continuous one is successful

I am looking at scheduler documentation and I found the Dependent scheduler, but that doesn’t work in my case since the nightly build will get trigger right away after the continuous one finishes.

Continuous build is separated from the nightly and I don’t want to run the continuous build again, just check if last status is success then trigger the nightly

Thank you

Change History

comment:1 follow-up: ↓ 2 Changed 18 months ago by dustin

That will require a custom scheduler -- you could probably subclass the Nightly scheduler?

comment:2 in reply to: ↑ 1 Changed 18 months ago by mariamarcano

Replying to dustin:

That will require a custom scheduler -- you could probably subclass the Nightly scheduler?

Dustin

I came up with the following, which seems to work fine, it requires adding it to master.cfg I am not an expert on Buildbot or the code so I will appreciate your feedback

class DependentNightly(Nightly):

    relatedBuilderNames = []
        
    def __init__(self, relatedBuilderNames = [], **kwargs):
        Nightly.__init__(self, **kwargs)
        self.relatedBuilderNames = relatedBuilderNames

    def startBuild(self):
        startBuild = True
        for builderName in  self.relatedBuilderNames:
            builder_status = self.master.status.getBuilder(builderName)
            lastBuild = builder_status.getLastFinishedBuild()
            startBuild = startBuild & (lastBuild.getResults() != FAILURE)

        if (startBuild):      
            return Nightly.startBuild(self)
        else:
            log.msg(("Nightly Scheduler <%s>: skipping build " +
                         "- Check related builders that could be failing: <%s> ") % (self.name, ", ".join(self.relatedBuilderNames)))
            return defer.succeed(None)


c['schedulers'] = []

c['schedulers'].append(DependentNightly(name="full-daily", 
                               branch='branches/Maria/AutomatedTest-xUNIT',
                               onlyIfChanged=False,
                               relatedBuilderNames=["continuous-debug", "continuous-release"],
                               hour=[15], minute=17,
                               builderNames=["full-dbupgrade"]
                             ))

comment:3 Changed 18 months ago by jaredgrubb

Two comments: you need to add "self.addFactoryArguments(relatedBuilderNames=relatedBuilderNames)" to your init function. Also the "&" operator should be "and" (the & is bitwise-and, which can give funky results if the arguments deviate from 0/1/True/False).

comment:4 Changed 16 months ago by dustin

  • Status changed from new to closed
  • Resolution set to fixed

Please re-open with any further questions.

Note: See TracTickets for help on using tickets.