if repository in repodata: repoconf = repodata[repository] if "CloneURL" not in repoconf: bot.Say("No 'clone_url' specified for '%s' in repositories.yaml" % repository) exit() clone_url = repoconf["CloneURL"] if "KeepHistory" not in repoconf: keep_history = 7 else: keep_history = repoconf["KeepHistory"] repobranch = "%s/%s" % (repository, branch) if not bot.Exclusive(repobranch, False): bot.Log("Warn", "Build of '%s' already in progress, exiting" % repobranch) if len(bot.user) > 0: bot.Say( "localbuild of '%s' already in progress, not starting a new build" % repobranch) exit() bot.ExtendNamespace(repobranch, keep_history) if not clone_url.startswith("http"): match = re.match(r"ssh://(?:.*@)?([^:/]*)(?::([^/]*)/)?", clone_url) if match: bot.AddTask("ssh-init", []) scanhost = match.group(1) if match.group(2):
bot = Robot() clone_url = os.getenv("GOPHER_CUSTOM_REPOSITORY") clone_branch = os.getenv("GOPHER_CUSTOM_BRANCH") cfgdir = os.getenv("GOPHER_CONFIGDIR") if not clone_url: bot.Say("GOPHER_CUSTOM_REPOSITORY not set") exit() if not cfgdir: bot.Say("GOPHER_CONFIGDIR not set") bot.Log("Error", "GOPHER_CONFIGDIR not set in updatecfg.py") exit() if not bot.Exclusive("updatecfg", False): bot.Say("Configuration update already in progress") bot.Log("Warn", "Configuration update already in progress, exiting") exit() bot.FailTask("status", [ "Updating configuration failed, check history for 'updatecfg'"]) if not clone_url.startswith("http"): match = re.match(r"ssh://(?:.*@)?([^:/]*)(?::([^/]*)/)?", clone_url) if match: bot.AddTask("ssh-init", []) scanhost = match.group(1) if match.group(2): scanhost = "%s:%s" % ( scanhost, match.group(2) ) bot.AddTask("ssh-scan", [ scanhost ]) else:
if repository in repodata: repoconf = repodata[repository] clone_url = repoconf["CloneURL"] if len(clone_url) == 0: bot.Say("No 'clone_url' specified for '%s' in repositories.yaml" % repository) exit(1) keep_history = repoconf["KeepLogs"] if keep_history == None: keep_history = -1 # Protect the repository directory with Exclusive if not bot.Exclusive(repository, False): bot.Log("Warn", "Build of '%s' already in progress, exiting" % repository) if len(bot.user) > 0: bot.Say( "build for '%s' already in progress, not starting a new build for branch '%s'" % (repository, branch)) exit() repobranch = "%s/%s" % (repository, branch) bot.ExtendNamespace(repobranch, keep_history) bot.AddTask("start-build", []) bot.AddTask("git-init", [clone_url]) # Start with a clean jobdir bot.AddTask("cleanup", [repository]) bot.AddTask("git-clone", [clone_url, branch, repository, "true"])