Exemplo n.º 1
0
def nexus(ctx, nexus_repo_url, deploy_dir, snapshot):
    """Deploy a Maven repository to a specified Nexus repository.

    This script takes a local Maven repository and deploys it to a Nexus
    repository.

    Example Repository:

        https://nexus.example.org/content/repositories/release
    """
    log.debug("nexus_repo_url={}, deploy_dir={}, snapshot={}".format(nexus_repo_url, deploy_dir, snapshot))
    try:
        deploy_sys.deploy_nexus(nexus_repo_url, deploy_dir, snapshot)
    except IOError as e:
        deploy_sys._log_error_and_exit(str(e))
    except HTTPError as e:
        deploy_sys._log_error_and_exit(str(e))
Exemplo n.º 2
0
def archives(ctx, nexus_url, nexus_path, workspace, pattern):
    """Archive files to a Nexus site repository.

    Provides 2 ways to archive files:

        \b
        1) globstar pattern provided by the user.
        2) $WORKSPACE/archives directory provided by the user.

    To use this command the Nexus server must have a site repository configured
    with the name "logs" as this is a hardcoded log path.
    """
    if not pattern:
        pattern = None

    try:
        deploy_sys.deploy_archives(nexus_url, nexus_path, workspace, pattern)
    except HTTPError as e:
        log.error(str(e))
        sys.exit(1)
    except OSError as e:
        deploy_sys._log_error_and_exit(str(e))

    log.info('Archives upload complete.')
Exemplo n.º 3
0
def test_log_and_exit():
    """Test exit."""
    with pytest.raises(SystemExit) as excinfo:
        deploy_sys._log_error_and_exit("testmsg")
    assert excinfo.type == SystemExit