示例#1
0
def _resolve_repository_as_id(repository, team_instance, project):
    if is_uuid(repository):
        return repository
    else:
        git_client = get_git_client(team_instance)
        repositories = git_client.get_repositories(project=project,
                                                   include_links=False,
                                                   include_all_urls=False)
        for found_repository in repositories:
            if found_repository.name.lower() == repository.lower():
                return found_repository.id
示例#2
0
def get_definition_id_from_name(name, client, project):
    definition_references = client.get_definitions(project=project, name=name)
    if len(definition_references) == 1:
        return definition_references[0].id
    elif len(definition_references) > 1:
        if is_uuid(project):
            project = definition_references[0].project.name
        message = 'Multiple definitions were found matching name "{name}" in project "{project}".  Try '\
                  + 'supplying the definition ID.'
        raise ValueError(message.format(name=name, project=project))
    else:
        raise ValueError(
            'There were no build definitions matching name "{name}" in project "{project}".'
            .format(name=name, project=project))
示例#3
0
def task_list(team_instance=None, task_id=None, detect=None):
    """List tasks.
    :param team_instance: VSTS account or TFS collection URL. Example: https://myaccount.visualstudio.com
    :type team_instance: str
    :param str task_id: The UUID of the task.
    :param detect: Automatically detect values for instance and project. Default is "on".
    :type detect: str
    :rtype: [TaskDefinition]
    """
    if task_id is not None and not is_uuid(task_id):
        raise ValueError("The --id argument must be a UUID.")
    team_instance = resolve_instance(detect=detect,
                                     team_instance=team_instance)
    client = get_task_agent_client(team_instance)
    definition_references = client.get_task_definitions(task_id=task_id)
    return definition_references