Пример #1
0
def preBuildSetup(env, pipelineConfig):
  """
    Clone the Grok repo if needed and get it set to the right remote, branch,
    and SHA.  Once set, if the NuPIC parameters need to be revised, take care
    of that now, too.

    :param env: The environment variable which is set before building
    :param pipelineConfig: dict of the pipeline config values, e.g.:
      {
        "buildWorkspace": "/path/to/build/in",
        "grokRemote": "[email protected]:Numenta/numenta-apps.git",
        "grokBranch": "master",
        "grokSha": "HEAD",
        "nupicRemote": "[email protected]:numenta/nupic.git",
        "nupicBranch": "master",
        "nupicSha": "HEAD",
        "pipelineParams": "{dict of parameters}",
        "pipelineJson": "/path/to/json/file",
        "wheelFilePath": "/path/to/wheel/file"
      }

    :returns: The updated pipelineConfig dict
    :rtype: dict
  """
  log.printEnv(env, g_logger)

  # Clone Grok if needed, otherwise, setup remote
  with changeToWorkingDir(pipelineConfig["buildWorkspace"]):
    if not os.path.isdir(env["GROK_HOME"]):
      git.clone(pipelineConfig["grokRemote"], directory="products")

  with changeToWorkingDir(env["GROK_HOME"]):
    if pipelineConfig["grokSha"]:
      g_logger.debug("Resetting to %s" % pipelineConfig["grokSha"])
      git.resetHard(pipelineConfig["grokSha"])
    else:
      grokSha = git.getShaFromRemoteBranch(pipelineConfig["grokRemote"],
                                           pipelineConfig["grokBranch"])
      pipelineConfig["grokSha"] = grokSha
      g_logger.debug("Resetting to %s" % grokSha)
      git.resetHard(grokSha)

  wheelFilePath = downloadOrCreateNuPICWheel(env, pipelineConfig)
  pipelineConfig["wheelFilePath"] = wheelFilePath
def preBuildSetup(env, pipelineConfig):
  """
    Clone the HTM-IT repo if needed and get it set to the right remote, branch,
    and SHA.

    :param env: The environment variable which is set before building
    :param pipelineConfig: dict of the pipeline config values, e.g.:
      {
        "buildWorkspace": "/path/to/build/in",
        "htmitRemote": "[email protected]:Numenta/numenta-apps.git",
        "htmitBranch": "master",
        "htmItSha": "HEAD",
        "pipelineParams": "{dict of parameters}",
        "pipelineJson": "/path/to/json/file"
      }

    :returns: The updated pipelineConfig dict
    :rtype: dict
  """
  diagnostics.printEnv(env=env, logger=g_logger)

  # Clone HTM-IT if needed, otherwise, setup remote
  with changeToWorkingDir(pipelineConfig["buildWorkspace"]):
    if not os.path.isdir(env["HTM_IT_HOME"]):
      git.clone(gitURL=pipelineConfig["htmitRemote"],
                logger=g_logger)

  with changeToWorkingDir(env["HTM_IT_HOME"]):
    if pipelineConfig["htmItSha"]:
      g_logger.debug("Resetting to %s", pipelineConfig["htmItSha"])
      git.resetHard(sha=pipelineConfig["htmItSha"], logger=g_logger)
    else:
      htmItSha = git.getShaFromRemoteBranch(pipelineConfig["htmitRemote"],
                                           pipelineConfig["htmitBranch"],
                                           logger=g_logger)
      pipelineConfig["htmItSha"] = htmItSha
      g_logger.debug("Resetting to %s", htmItSha)
      git.resetHard(sha=htmItSha, logger=g_logger)
Пример #3
0
def preBuildSetup(env, pipelineConfig):
  """
    Clone the HTM-IT repo if needed and get it set to the right remote, branch,
    and SHA.

    :param env: The environment variable which is set before building
    :param pipelineConfig: dict of the pipeline config values, e.g.:
      {
        "buildWorkspace": "/path/to/build/in",
        "htm-itRemote": "[email protected]:Numenta/numenta-apps.git",
        "htm-itBranch": "master",
        "htm-itSha": "HEAD",
        "pipelineParams": "{dict of parameters}",
        "pipelineJson": "/path/to/json/file"
      }

    :returns: The updated pipelineConfig dict
    :rtype: dict
  """
  diagnostics.printEnv(env=env, logger=g_logger)

  # Clone HTM-IT if needed, otherwise, setup remote
  with changeToWorkingDir(pipelineConfig["buildWorkspace"]):
    if not os.path.isdir(env["HTM-IT_HOME"]):
      git.clone(gitURL=pipelineConfig["htm-itRemote"],
                logger=g_logger)

  with changeToWorkingDir(env["HTM-IT_HOME"]):
    if pipelineConfig["htm-itSha"]:
      g_logger.debug("Resetting to %s", pipelineConfig["htm-itSha"])
      git.resetHard(sha=pipelineConfig["htm-itSha"], logger=g_logger)
    else:
      htm-itSha = git.getShaFromRemoteBranch(pipelineConfig["htm-itRemote"],
                                           pipelineConfig["htm-itBranch"],
                                           logger=g_logger)
      pipelineConfig["htm-itSha"] = htm-itSha
      g_logger.debug("Resetting to %s", htm-itSha)
      git.resetHard(sha=htm-itSha, logger=g_logger)
Пример #4
0
def preBuildSetup(env, pipelineConfig):
  """
    Clone the Grok repo if needed and get it set to the right remote, branch,
    and SHA.

    :param env: The environment variable which is set before building
    :param pipelineConfig: dict of the pipeline config values, e.g.:
      {
        "buildWorkspace": "/path/to/build/in",
        "grokRemote": "[email protected]:Numenta/numenta-apps.git",
        "grokBranch": "master",
        "grokSha": "HEAD",
        "pipelineParams": "{dict of parameters}",
        "pipelineJson": "/path/to/json/file"
      }

    :returns: The updated pipelineConfig dict
    :rtype: dict
  """
  log.printEnv(env, g_logger)

  # Clone Grok if needed, otherwise, setup remote
  with changeToWorkingDir(pipelineConfig["buildWorkspace"]):
    if not os.path.isdir(env["GROK_HOME"]):
      git.clone(pipelineConfig["grokRemote"], directory="products")

  with changeToWorkingDir(env["GROK_HOME"]):
    if pipelineConfig["grokSha"]:
      g_logger.debug("Resetting to %s", pipelineConfig["grokSha"])
      git.resetHard(pipelineConfig["grokSha"])
    else:
      grokSha = git.getShaFromRemoteBranch(pipelineConfig["grokRemote"],
                                           pipelineConfig["grokBranch"])
      pipelineConfig["grokSha"] = grokSha
      g_logger.debug("Resetting to %s", grokSha)
      git.resetHard(grokSha)