ltdconveyor/keeper/build.py
def register_build(host, keeper_token, product, git_refs):
    """Register a new build for a product on LSST the Docs.

    Wraps ``POST /products/{product}/builds/``.

    Parameters
    ----------
    host : `str`
        Hostname of LTD Keeper API server.
    keeper_token : `str`
        Auth token (`ltdconveyor.keeper.get_keeper_token`).
    product : `str`
        Name of the product in the LTD Keeper service.
    git_refs : `list` of `str`
        List of Git refs that correspond to the version of the build. Git refs
        can be tags or branches.

    Returns
    -------
    build_info : `dict`
        LTD Keeper build resource.

    Raises
    ------
    ltdconveyor.keeper.KeeperError
        Raised if there is an error communicating with the LTD Keeper API.
    """
    data = {
        'git_refs': git_refs
    }

    endpoint_url = uritemplate.expand(
        urljoin(host, '/products/{p}/builds/'),
        p=product)

    r = requests.post(
        endpoint_url,
        auth=(keeper_token, ''),
        json=data)

    if r.status_code != 201:
        raise KeeperError(r.json())
    build_info = r.json()
    return build_info
def register_build(host, keeper_token, product, git_refs):
    """Register a new build for a product on LSST the Docs.

    Wraps ``POST /products/{product}/builds/``.

    Parameters
    ----------
    host : `str`
        Hostname of LTD Keeper API server.
    keeper_token : `str`
        Auth token (`ltdconveyor.keeper.get_keeper_token`).
    product : `str`
        Name of the product in the LTD Keeper service.
    git_refs : `list` of `str`
        List of Git refs that correspond to the version of the build. Git refs
        can be tags or branches.

    Returns
    -------
    build_info : `dict`
        LTD Keeper build resource.

    Raises
    ------
    ltdconveyor.keeper.KeeperError
        Raised if there is an error communicating with the LTD Keeper API.
    """
    data = {
        'git_refs': git_refs
    }

    endpoint_url = uritemplate.expand(
        urljoin(host, '/products/{p}/builds/'),
        p=product)

    r = requests.post(
        endpoint_url,
        auth=(keeper_token, ''),
        json=data)

    if r.status_code != 201:
        raise KeeperError(r.json())
    build_info = r.json()
    return build_info
Register a new build for a product on LSST the Docs.

    Wraps ``POST /products/{product}/builds/``.

    Parameters
    ----------
    host : `str`
        Hostname of LTD Keeper API server.
    keeper_token : `str`
        Auth token (`ltdconveyor.keeper.get_keeper_token`).
    product : `str`
        Name of the product in the LTD Keeper service.
    git_refs : `list` of `str`
        List of Git refs that correspond to the version of the build. Git refs
        can be tags or branches.

    Returns
    -------
    build_info : `dict`
        LTD Keeper build resource.

    Raises
    ------
    ltdconveyor.keeper.KeeperError
        Raised if there is an error communicating with the LTD Keeper API.