X-Git-Url: http://git.openwrt.org/?a=blobdiff_plain;ds=sidebyside;f=phase2%2Fmaster.cfg;h=98a92438ea2c0696facd525a9783b4466a8522b2;hb=dc5a2c0a7fc4ef5bfdff441c69b3b9c01f0c54b1;hp=246ef92e6e5a2401e1f41ce9c4e1319ebd5e8053;hpb=4a109203e1edf5a835023a4b7be47e24f8f530f0;p=buildbot.git diff --git a/phase2/master.cfg b/phase2/master.cfg index 246ef92..98a9243 100644 --- a/phase2/master.cfg +++ b/phase2/master.cfg @@ -11,6 +11,8 @@ from buildbot import locks ini = ConfigParser.ConfigParser() ini.read("./config.ini") +buildbot_url = ini.get("general", "buildbot_url") + # This is a sample buildmaster config file. It must be installed as # 'master.cfg' in your buildmaster's base directory. @@ -25,6 +27,11 @@ c = BuildmasterConfig = {} # slave name and password must be configured on the slave. from buildbot.buildslave import BuildSlave +slave_port = 9990 + +if ini.has_option("general", "port"): + slave_port = ini.getint("general", "port") + c['slaves'] = [] for section in ini.sections(): @@ -40,19 +47,51 @@ for section in ini.sections(): # 'slavePortnum' defines the TCP port to listen on for connections from slaves. # This must match the value configured into the buildslaves (with their # --master option) -c['slavePortnum'] = 9990 +c['slavePortnum'] = slave_port # coalesce builds c['mergeRequests'] = True ####### CHANGESOURCES -home_dir = ini.get("general", "homedir") +home_dir = os.path.abspath(ini.get("general", "homedir")) + +rsync_bin_url = ini.get("rsync", "binary_url") +rsync_bin_key = ini.get("rsync", "binary_password") + +rsync_src_url = None +rsync_src_key = None + +if ini.has_option("rsync", "source_url"): + rsync_src_url = ini.get("rsync", "source_url") + rsync_src_key = ini.get("rsync", "source_password") + +rsync_sdk_url = None +rsync_sdk_key = None +rsync_sdk_pat = "lede-sdk-*.tar.xz" + +if ini.has_option("rsync", "sdk_url"): + rsync_sdk_url = ini.get("rsync", "sdk_url") + +if ini.has_option("rsync", "sdk_password"): + rsync_sdk_key = ini.get("rsync", "sdk_password") + +if ini.has_option("rsync", "sdk_pattern"): + rsync_sdk_pat = ini.get("rsync", "sdk_pattern") + +gpg_keyid = None +gpg_comment = "Unattended build signature" +gpg_passfile = "/dev/null" -repo_url = ini.get("repo", "url") +if ini.has_option("gpg", "keyid"): + gpg_keyid = ini.get("gpg", "keyid") + +if ini.has_option("gpg", "comment"): + gpg_comment = ini.get("gpg", "comment") + +if ini.has_option("gpg", "passfile"): + gpg_passfile = ini.get("gpg", "passfile") -rsync_url = ini.get("rsync", "url") -rsync_key = ini.get("rsync", "password") # find arches arches = [ ] @@ -112,7 +151,10 @@ c['schedulers'].append(ForceScheduler( from buildbot.process.factory import BuildFactory from buildbot.steps.source import Git from buildbot.steps.shell import ShellCommand +from buildbot.steps.shell import SetProperty +from buildbot.steps.transfer import FileUpload from buildbot.steps.transfer import FileDownload +from buildbot.steps.master import MasterShellCommand from buildbot.process.properties import WithProperties c['builders'] = [] @@ -129,20 +171,27 @@ for arch in arches: factory = BuildFactory() + # find number of cores + factory.addStep(SetProperty( + name = "nproc", + property = "nproc", + description = "Finding number of CPUs", + command = ["nproc"])) + # prepare workspace factory.addStep(FileDownload(mastersrc="cleanup.sh", slavedest="cleanup.sh", mode=0755)) factory.addStep(ShellCommand( name = "cleanold", description = "Cleaning previous builds", - command = ["./cleanup.sh", WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "full"], + command = ["./cleanup.sh", buildbot_url, WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "full"], haltOnFailure = True, timeout = 2400)) factory.addStep(ShellCommand( name = "cleanup", description = "Cleaning work area", - command = ["./cleanup.sh", WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "single"], + command = ["./cleanup.sh", buildbot_url, WithProperties("%(slavename)s"), WithProperties("%(buildername)s"), "single"], haltOnFailure = True, timeout = 2400)) @@ -155,22 +204,31 @@ for arch in arches: factory.addStep(ShellCommand( name = "downloadsdk", description = "Downloading SDK archive", - command = ["rsync", "-va", "downloads.lede-project.org::downloads/snapshots/targets/%s/%s/LEDE-SDK-*.tar.bz2" %(ts[0], ts[1]), "sdk.tar.bz2"], - haltOnFailure = True)) + command = ["rsync", "-va", "%s/%s/%s/%s" %(rsync_sdk_url, ts[0], ts[1], rsync_sdk_pat), "sdk.archive"], + env={'RSYNC_PASSWORD': rsync_sdk_key}, + haltOnFailure = True, + logEnviron = False)) factory.addStep(ShellCommand( name = "unpacksdk", description = "Unpacking SDK archive", - command = ["tar", "--strip-components=1", "-C", "sdk/", "-vxjf", "sdk.tar.bz2"], + command = ["tar", "--strip-components=1", "-C", "sdk/", "-vxf", "sdk.archive"], haltOnFailure = True)) - factory.addStep(FileDownload(mastersrc=home_dir+'/key-build', slavedest="sdk/key-build", mode=0400)) + factory.addStep(FileDownload(mastersrc=home_dir+'/key-build', slavedest="sdk/key-build", mode=0600)) + factory.addStep(FileDownload(mastersrc=home_dir+'/key-build.pub', slavedest="sdk/key-build.pub", mode=0600)) factory.addStep(ShellCommand( name = "mkdldir", description = "Preparing download directory", command = ["sh", "-c", "mkdir -p $HOME/dl && rmdir ./sdk/dl && ln -sf $HOME/dl ./sdk/dl"])) + factory.addStep(ShellCommand( + name = "mkconf", + description = "Preparing SDK configuration", + workdir = "build/sdk", + command = ["sh", "-c", "rm -f .config && make defconfig"])) + factory.addStep(ShellCommand( name = "updatefeeds", description = "Updating feeds", @@ -187,14 +245,57 @@ for arch in arches: name = "compile", description = "Building packages", workdir = "build/sdk", - command = ["make", "-j4", "V=s", "IGNORE_ERRORS=n m y", "BUILD_LOG=1", "CONFIG_SIGNED_PACKAGES=y"])) + command = ["make", WithProperties("-j%(nproc:~4)s"), "V=s", "IGNORE_ERRORS=n m y", "BUILD_LOG=1", "CONFIG_SIGNED_PACKAGES=y"])) + + if gpg_keyid is not None: + factory.addStep(MasterShellCommand( + name = "signprepare", + description = "Preparing temporary signing directory", + command = ["mkdir", "-p", "%s/signing" %(home_dir)], + haltOnFailure = True + )) + + factory.addStep(ShellCommand( + name = "signpack", + description = "Packing files to sign", + workdir = "build/sdk", + command = "find bin/packages/%s/ -mindepth 2 -maxdepth 2 -type f -name Packages -print0 | xargs -0 tar -czf sign.tar.gz" %(arch[0]), + haltOnFailure = True + )) + + factory.addStep(FileUpload( + slavesrc = "sdk/sign.tar.gz", + masterdest = "%s/signing/%s.tar.gz" %(home_dir, arch[0]), + haltOnFailure = True + )) + + factory.addStep(MasterShellCommand( + name = "signfiles", + description = "Signing files", + command = ["%s/signall.sh" %(home_dir), "%s/signing/%s.tar.gz" %(home_dir, arch[0]), gpg_keyid, gpg_passfile, gpg_comment], + haltOnFailure = True + )) + + factory.addStep(FileDownload( + mastersrc = "%s/signing/%s.tar.gz" %(home_dir, arch[0]), + slavedest = "sdk/sign.tar.gz", + haltOnFailure = True + )) + + factory.addStep(ShellCommand( + name = "signunpack", + description = "Unpacking signed files", + workdir = "build/sdk", + command = ["tar", "-xzf", "sign.tar.gz"], + haltOnFailure = True + )) factory.addStep(ShellCommand( name = "uploadprepare", description = "Preparing package directory", workdir = "build/sdk", - command = ["rsync", "-av", "--include", "/%s/" %(arch[0]), "--exclude", "/*", "--exclude", "/%s/*" %(arch[0]), "bin/packages/", "%s/packages/" %(rsync_url)], - env={'RSYNC_PASSWORD': rsync_key}, + command = ["rsync", "-av", "--include", "/%s/" %(arch[0]), "--exclude", "/*", "--exclude", "/%s/*" %(arch[0]), "bin/packages/", "%s/packages/" %(rsync_bin_url)], + env={'RSYNC_PASSWORD': rsync_bin_key}, haltOnFailure = True, logEnviron = False )) @@ -203,8 +304,8 @@ for arch in arches: name = "packageupload", description = "Uploading package files", workdir = "build/sdk", - command = ["rsync", "--delete", "-avz", "bin/packages/%s/" %(arch[0]), "%s/packages/%s/" %(rsync_url, arch[0])], - env={'RSYNC_PASSWORD': rsync_key}, + command = ["rsync", "--delete", "--checksum", "--delay-updates", "--partial-dir=.~tmp~%s" %(arch[0]), "-avz", "bin/packages/%s/" %(arch[0]), "%s/packages/%s/" %(rsync_bin_url, arch[0])], + env={'RSYNC_PASSWORD': rsync_bin_key}, haltOnFailure = True, logEnviron = False )) @@ -213,8 +314,8 @@ for arch in arches: name = "logprepare", description = "Preparing log directory", workdir = "build/sdk", - command = ["rsync", "-av", "--include", "/%s/" %(arch[0]), "--exclude", "/*", "--exclude", "/%s/*" %(arch[0]), "bin/packages/", "%s/faillogs/" %(rsync_url)], - env={'RSYNC_PASSWORD': rsync_key}, + command = ["rsync", "-av", "--include", "/%s/" %(arch[0]), "--exclude", "/*", "--exclude", "/%s/*" %(arch[0]), "bin/packages/", "%s/faillogs/" %(rsync_bin_url)], + env={'RSYNC_PASSWORD': rsync_bin_key}, haltOnFailure = True, logEnviron = False )) @@ -239,12 +340,23 @@ for arch in arches: name = "logupload", description = "Uploading failure logs", workdir = "build/sdk", - command = ["rsync", "--delete", "-avz", "faillogs/", "%s/faillogs/%s/" %(rsync_url, arch[0])], - env={'RSYNC_PASSWORD': rsync_key}, + command = ["rsync", "--delete", "--delay-updates", "--partial-dir=.~tmp~%s" %(arch[0]), "-avz", "faillogs/", "%s/faillogs/%s/" %(rsync_bin_url, arch[0])], + env={'RSYNC_PASSWORD': rsync_bin_key}, haltOnFailure = False, logEnviron = False )) + if rsync_src_url is not None: + factory.addStep(ShellCommand( + name = "sourceupload", + description = "Uploading source archives", + workdir = "build/sdk", + command = ["rsync", "--checksum", "--delay-updates", "--partial-dir=.~tmp~%s" %(arch[0]), "-avz", "dl/", "%s/" %(rsync_src_url)], + env={'RSYNC_PASSWORD': rsync_src_key}, + haltOnFailure = False, + logEnviron = False + )) + from buildbot.config import BuilderConfig c['builders'].append(BuilderConfig(name=arch[0], slavenames=slaveNames, factory=factory)) @@ -267,7 +379,7 @@ if ini.has_option("status", "bind"): # change any of these to True to enable; see the manual for more # options auth=auth.BasicAuth([(ini.get("status", "user"), ini.get("status", "password"))]), - gracefulShutdown = False, + gracefulShutdown = 'auth', forceBuild = 'auth', # use this to test your slave once it is set up forceAllBuilds = 'auth', pingBuilder = False, @@ -294,7 +406,7 @@ c['titleURL'] = ini.get("general", "title_url") # with an externally-visible host name which the buildbot cannot figure out # without some help. -c['buildbotURL'] = ini.get("general", "buildbot_url") +c['buildbotURL'] = buildbot_url ####### DB URL @@ -303,4 +415,3 @@ c['db'] = { # this at its default for all but the largest installations. 'db_url' : "sqlite:///state.sqlite", } -