def main(jsonArgs):
  """
    Main function.

    :param jsonArgs: dict of pipeline-json and logLevel, defaults to empty
      dict to make the script work independently and via driver scripts.
      e.g. {"pipelineJson" : <PIPELINE_JSON_PATH>,
            "logLevel" : <LOG_LEVEL>}

    :param jsonArgs: dict of  pipeline-json and logLevel
      e.g. {"pipelineJson" : <PIPELINE_JSON_PATH>,
            "logLevel" : <LOG_LEVEL>}
  """
  try:
    pipelineConfig = addAndParseArgs(jsonArgs)

    htmitUser = getGithubUserName(pipelineConfig["htmitRemote"])
    amiName = (htmitUser + "-" + pipelineConfig["htmitBranch"])
    env = prepareEnv(pipelineConfig["buildWorkspace"], None, os.environ)

    preBuildSetup(env, pipelineConfig)

    builder.buildHtmIt(env, pipelineConfig, g_logger)
    g_logger.debug("HTM-IT built successfully!")

    deployTrack = getDeployTrack(pipelineConfig["htmitRemote"],
                                 pipelineConfig["htmitBranch"])

    pipelineConfig["pipelineParams"]["build"] = {
                              "htmItSha": pipelineConfig["htmItSha"],
                              "htm-itHome": env["HTM_IT_HOME"],
                              "deployTrack": deployTrack,
                              "htmItDeployTrack": htmitUser,
                              "amiName": amiName
                            }
    g_logger.debug(pipelineConfig["pipelineParams"])
    if pipelineConfig["pipelineJson"]:
      with open(pipelineConfig["pipelineJson"], 'w') as jsonFile:
        jsonFile.write(json.dumps(pipelineConfig["pipelineParams"],
                       ensure_ascii=False))
  except Exception:
    g_logger.exception("Unknown error occurred in build phase")
    raise
Beispiel #2
0
def main(jsonArgs):
    """
    Main function.

    :param jsonArgs: dict of pipeline-json and logLevel, defaults to empty
      dict to make the script work independently and via driver scripts.
      e.g. {"pipelineJson" : <PIPELINE_JSON_PATH>,
            "logLevel" : <LOG_LEVEL>}

    :param jsonArgs: dict of  pipeline-json and logLevel
      e.g. {"pipelineJson" : <PIPELINE_JSON_PATH>,
            "logLevel" : <LOG_LEVEL>}
  """
    try:
        pipelineConfig = addAndParseArgs(jsonArgs)

        htmitUser = getGithubUserName(pipelineConfig["htmitRemote"])
        amiName = htmitUser + "-" + pipelineConfig["htmitBranch"]
        env = prepareEnv(pipelineConfig["buildWorkspace"], None, os.environ)

        preBuildSetup(env, pipelineConfig)

        builder.buildHtmIt(env, pipelineConfig, g_logger)
        g_logger.debug("HTM-IT built successfully!")

        deployTrack = getDeployTrack(pipelineConfig["htmitRemote"], pipelineConfig["htmitBranch"])

        pipelineConfig["pipelineParams"]["build"] = {
            "htmItSha": pipelineConfig["htmItSha"],
            "htm-itHome": env["HTM_IT_HOME"],
            "deployTrack": deployTrack,
            "htmItDeployTrack": htmitUser,
            "amiName": amiName,
        }
        g_logger.debug(pipelineConfig["pipelineParams"])
        if pipelineConfig["pipelineJson"]:
            with open(pipelineConfig["pipelineJson"], "w") as jsonFile:
                jsonFile.write(json.dumps(pipelineConfig["pipelineParams"], ensure_ascii=False))
    except Exception:
        g_logger.exception("Unknown error occurred in build phase")
        raise
def getDeployTrack(htmitRemote, htmitBranch):
  """
    This method gives us the deployTrack, depending upon parameters
    (basically checks if production parameters or not).

    :param htmitRemote: URL for HTM-IT remote repository
    :param htmitBranch:  HTM-IT branch used for current build

    :returns: A `string` representing the deployment track
    e.g.
    1)
    htmitRemote: [email protected]:<user-name>/numenta-apps.git
    deployTrack: <user-name>-numenta
    2)
    htmitRemote: [email protected]:Numenta/numenta-apps.git
    deployTrack: numenta

    :rtype: string
  """
  if checkIfSaneProductionParams(htmitRemote, htmitBranch):
    return "numenta"
  else:
    return getGithubUserName(htmitRemote) + "-numenta"
Beispiel #4
0
def getDeployTrack(htmitRemote, htmitBranch):
    """
    This method gives us the deployTrack, depending upon parameters
    (basically checks if production parameters or not).

    :param htmitRemote: URL for HTM-IT remote repository
    :param htmitBranch:  HTM-IT branch used for current build

    :returns: A `string` representing the deployment track
    e.g.
    1)
    htmitRemote: [email protected]:<user-name>/numenta-apps.git
    deployTrack: <user-name>-numenta
    2)
    htmitRemote: [email protected]:Numenta/numenta-apps.git
    deployTrack: numenta

    :rtype: string
  """
    if checkIfSaneProductionParams(htmitRemote, htmitBranch):
        return "numenta"
    else:
        return getGithubUserName(htmitRemote) + "-numenta"