[users at bb.net] Force Build Form Property

xpetrl xpetrl at aol.com
Mon Dec 2 22:40:58 UTC 2019


Dear List,

I'm getting crazy with a build form property.

How do I correctly check if the "force a make clean" in force build is 
checked?

Please look the the code below, mostly taken from tutorial 2.5.5. 
Schedulers.


options 	

{
   "force_build_clean": true,
   "pull_url": ""
}

	Force Build Form

[code]

c['schedulers'].append(schedulers.ForceScheduler(
     name="force-custom",
     buttonName="pushMe!",
     label="My nice Force form",
     builderNames=["lp1"],
     codebases=[
         util.CodebaseParameter(
             "",
             label="Main repository",
             # will generate a combo box branch=util.ChoiceStringParameter(
                 name="branch",
                 choices=["master","hest"],
                 default="master"),

             # will generate nothing in the form, but revision, repository, # and 
project are needed by buildbot scheduling system so we # need to pass a 
value ("") revision=util.FixedParameter(name="revision",default=""),
             repository=util.FixedParameter(name="repository",default=""),
             project=util.FixedParameter(name="project",default=""),
         ),
     ],
     # will generate a text input reason=util.StringParameter(name="reason",
                                label="reason:",
                                required=False,size=80),

     # in case you don't require authentication this will display # input for 
user to type his name username=util.UserNameParameter(label="your name:",
                                     size=80),
     # A completely customized property list. The name of the # property is 
the name of the parameter properties=[
         util.NestedParameter(name="options",label="Build Options",layout="vertical",fields=[
             util.StringParameter(name="pull_url",
                                  label="optionally give a public Git pull url:",
                                  default="",size=80),
             util.BooleanParameter(name="force_build_clean",
                                   label="force a make clean",
                                   default=False)
         ])
     ]))

[..]
What is the property?
step.getProperty('force_build_clean')
or
step.build.getProperty('force_build_clean'
How do I check that? Do I have to git a method todoStepIf ?
[...]

minimal_factory = util.BuildFactory()

doCleanIf = lambda step: step.getProperty('force_build_clean') or None
# or #doCleanIf = lambda step: 
step.build.getProperty('force_build_clean', True) # or
#def doCleanIf(step): # if (lambda step: 
step.build.getProperty('force_build_clean') or None): # return True # 
return False

minimal_factory.addStep(steps.ShellCommand(name='Force Clean', \
     command=['echo','force clean'], \
     workdir='build',haltOnFailure='True',doStepIf=doCleanIf))


Thanks!

-- 
xpetrl

-- 
xpetrl



More information about the users mailing list