return deps if len(sys.argv) == 0: # Two args, initial build of modified repository if repository in repodata: repoconf = repodata[repository] if "Type" in repoconf: repotype = repoconf["Type"] if repotype != "none": build_triggered = True bot.Log( "Debug", "Adding primary build for %s / %s to the pipeline" % (repository, branch)) bot.AddJob(repotype, [repository, branch]) try: deps = get_deps(repository, True) except Exception as e: err = "Resolving dependencies for %s / %s: %s" % (repository, branch, e) bot.AddTask("fail", [err]) exit(0) if deps: build_triggered = True bot.Log( "Debug", "Starting builds for everything that depends on %s / %s" % (repository, branch)) bot.AddJob("gopherci", [repository, branch, "true"]) if len(sys.argv) == 1:
hasconfig = True try: os.stat(cfgconf) except FileNotFoundError: hasconfig = False except: bot.Log("Error", "Checking for %s: %s" % (cfgconf, sys.exc_info()[0])) exit(1) # First, see if we're doing a restore if hasconfig: try: os.stat(".restore") bot.AddTask("exec", [ "rm", "-f", ".restore" ]) bot.AddJob("restore", []) exit(0) except FileNotFoundError: pass exit(0) clone_url = os.getenv("GOPHER_CUSTOM_REPOSITORY") if len(clone_url) == 0: bot.Log("Warn", "GOPHER_CUSTOM_REPOSITORY not set, not bootstrapping") exit(0) clone_branch = os.getenv("GOPHER_CUSTOM_BRANCH") if not clone_url.startswith("http"): depkey = os.getenv("GOPHER_DEPLOY_KEY") if len(depkey) == 0:
if branch.endswith("/"): # illegal end char; assume args swapped repository, branch = branch, repository if repository.endswith("/"): repository = repository.rstrip("/") if repository in repodata: repoconf = repodata[repository] if "Type" in repoconf: repotype = repoconf["Type"] if repotype != "none": build_triggered = True bot.Log( "Debug", "Adding primary build for %s / %s to the pipeline" % (repository, branch)) bot.AddJob(repotype, ["build", repository, branch]) try: deps = get_deps(repository, True) except Exception as e: err = "Resolving dependencies for %s / %s: %s" % (repository, branch, e) bot.Log("Error", err) bot.AddTask("status", [err]) exit(0) if deps: build_triggered = True bot.Log( "Debug", "Starting builds for everything that depends on %s / %s" % (repository, branch)) bot.AddJob("gopherci", ["builddeps", repository, branch])