builders: Add Build Steps to get worker information
PATCH 1/1 builders: Add Build Steps to get worker information
BUG#9917: https://bugzilla.yoctoproject.org/show_bug.cgi?id=9917
autobuilder: Add ability to get worker information
BUILBOT: http://docs.buildbot.net/current/manual/configuration/buildsteps.html#setpropertyfromcommand
Signed-off-by Aaron Chan <[email protected]>
--- builders.py | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
builders.py +34 -0
@@ -133,6 +133,32 @@ def get_buildlogs(maxsteps): logfiles["step" + str(i) + str(j)] = "build/command.log." + str(i) + str(j) return logfiles +def get_lsbrelease(rc, stdout, stderr): + strdict={} + lstr = [ l.strip() for l in stdout.split('\n') ] + del lstr[-1] + for lsbStr in lstr: + lsbStr=list(lsbStr.split(':\t')) + for i in lsbStr: + if lsbStr.index(i) == 0: + strdict['worker_' + i.strip().lower().replace(' ', '_')]="" + else: + strdict["worker_" + lsbStr[0].strip().lower().replace(' ','_')]=i + return strdict + +def get_uname(rc, stdout, stderr): + strdict={'worker_kernel_release': '', 'worker_hardware_platform': '', 'worker_operating_system': ''} + uname=stdout.split(' ') + for i in uname: + if uname.index(i) == 0: + strdict['worker_kernel_release'] = i + elif uname.index(i) == 1: + strdict['worker_hardware_platform'] = i + elif uname.index(i) == 2: + strdict['worker_operating_system'] = i + else: continue + return strdict + def create_builder_factory(): f = util.BuildFactory()
@@ -151,6 +177,14 @@ def create_builder_factory(): haltOnFailure=True, name='Fetch yocto-autobuilder-helper')) f.addStep(steps.SetProperties(properties=ensure_props_set)) + f.addStep(steps.SetPropertyFromCommand( + command="lsb_release -irc", + extract_fn=get_lsbrelease, + name='Retrieve worker information_1')) + f.addStep(steps.SetPropertyFromCommand( + command="uname -rio", + extract_fn=get_uname, + name='Retrieve worker information_2')) f.addStep(WriteLayerInfo(name='Write main layerinfo.json', haltOnFailure=True)) f.addStep(steps.ShellCommand( command=[util.Interpolate("%(prop:builddir)s/yocto-autobuilder-helper/scripts/shared-repo-unpack"),
Signature · 1 line
2.17.1
Bug #9917 has been update to "Review In Progress"
https://bugzilla.yoctoproject.org/show_bug.cgi?id=9917