コード例 #1
0
import logging
from argh import arg

from pnc_cli import utils
from pnc_cli.swagger_client import RunningbuildrecordsApi

import cli_types
import pnc_cli.user_config as uc

running_api = RunningbuildrecordsApi(uc.user.get_api_client())


@arg("-p", "--page-size", help="Limit the amount of BuildRecords returned")
@arg("-s", "--sort", help="Sorting RSQL")
def list_running_builds(page_size=200, sort=""):
    """
    List all RunningBuilds
    """
    response = utils.checked_api_call(running_api,
                                      'get_all',
                                      page_size=page_size,
                                      sort=sort)
    if response:
        return utils.format_json_list(response.content)


@arg("id",
     help="ID of the RunningBuild to retrieve.",
     type=cli_types.existing_running_build)
def get_running_build(id):
    """
コード例 #2
0
def test_trigger(new_config):
    running_api = RunningbuildrecordsApi(uc.user.get_api_client())
    triggered_build = configs_api.trigger(id=new_config.id).content
    assert triggered_build is not None
    build_record = running_api.get_specific(id=triggered_build.id)
    assert build_record is not None
コード例 #3
0
versions_api = ProductversionsApi(api_client)
milestones_api = ProductmilestonesApi(api_client)
releases_api = ProductreleasesApi(api_client)

# Build Configuration Set Records
bcsr_api = BuildconfigsetrecordsApi(api_client)

# Build Records
records_api = BuildrecordsApi(api_client)
license_api = LicensesApi(api_client)

# Licenses API
licenses_api = LicensesApi(api_client)

# Running build records Api
running_api = RunningbuildrecordsApi(api_client)

bc_name_regex = "^[a-zA-Z0-9_.][a-zA-Z0-9_.-]*(?!\.git)+$"


# BuildConfiguration Types
def valid_bc_name(name_input):
    pattern = re.compile(bc_name_regex)
    if not pattern.match(name_input):
        raise argparse.ArgumentTypeError("name contains invalid characters")
    return name_input


def unique_bc_name(name_input):
    valid_bc_name(name_input)
    if common.get_id_by_name(configs_api, name_input):
コード例 #4
0
ファイル: pnc_api.py プロジェクト: vmarekrh/pnc-cli
 def running_builds(self):
     if not self._running_builds:
         self._running_builds = RunningbuildrecordsApi(
             self.user.get_api_client())
     return self._running_builds