Ejemplo n.º 1
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)

        YOMPUser = getGithubUserName(pipelineConfig["YOMPRemote"])
        amiName = (YOMPUser + "-" + pipelineConfig["YOMPBranch"])
        env = prepareEnv(pipelineConfig["buildWorkspace"], None, os.environ)

        preBuildSetup(env, pipelineConfig)

        builder.buildYOMP(env, pipelineConfig, g_logger)
        g_logger.debug("YOMP built successfully!")

        deployTrack = getDeployTrack(pipelineConfig["YOMPRemote"],
                                     pipelineConfig["YOMPBranch"])

        pipelineConfig["pipelineParams"]["build"] = {
            "YOMPSha": pipelineConfig["YOMPSha"],
            "YOMPHome": env["YOMP_HOME"],
            "deployTrack": deployTrack,
            "YOMPDeployTrack": YOMPUser,
            "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
Ejemplo n.º 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)

    YOMPUser = getGithubUserName(pipelineConfig["YOMPRemote"])
    amiName = (YOMPUser + "-" + pipelineConfig["YOMPBranch"])
    env = prepareEnv(pipelineConfig["buildWorkspace"], None, os.environ)

    preBuildSetup(env, pipelineConfig)

    builder.buildYOMP(env, pipelineConfig, g_logger)
    g_logger.debug("YOMP built successfully!")

    deployTrack = getDeployTrack(pipelineConfig["YOMPRemote"],
                                 pipelineConfig["YOMPBranch"])

    pipelineConfig["pipelineParams"]["build"] = {
                              "YOMPSha": pipelineConfig["YOMPSha"],
                              "YOMPHome": env["YOMP_HOME"],
                              "deployTrack": deployTrack,
                              "YOMPDeployTrack": YOMPUser,
                              "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
Ejemplo n.º 3
0
def getDeployTrack(YOMPRemote, YOMPBranch):
    """
    This method gives us the deployTrack, depending upon parameters
    (basically checks if production parameters or not).

    :param YOMPRemote: URL for YOMP remote repository
    :param YOMPBranch:  YOMP branch used for current build

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

    :rtype: string
  """
    if checkIfSaneProductionParams(YOMPRemote, YOMPBranch):
        return "YOMPsolutions"
    else:
        return getGithubUserName(YOMPRemote) + "-numenta"
Ejemplo n.º 4
0
def getDeployTrack(YOMPRemote, YOMPBranch):
  """
    This method gives us the deployTrack, depending upon parameters
    (basically checks if production parameters or not).

    :param YOMPRemote: URL for YOMP remote repository
    :param YOMPBranch:  YOMP branch used for current build

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

    :rtype: string
  """
  if checkIfSaneProductionParams(YOMPRemote, YOMPBranch):
    return "YOMPsolutions"
  else:
    return getGithubUserName(YOMPRemote) + "-numenta"