Skip to content

[Feature Request] Auto detect organization/project should first check config before querying GIT remotes #1499

@Styxxy

Description

@Styxxy

Is your feature request related to a problem? Please describe.
The auto detect of organization/project (if set to true, which is default) will always first try to query the git remote, instead of using the defaults configured with az devops configure --defaults organization=... project=....

I am running into this issue when running the azure devops cli in Azure Pipelines and using a managed identity (that doesn't have permissions necessary on Azure Repos).

Describe the solution you'd like
It would make much more sense that first the defaults from the config is used instead of querying git remotes + api calls.

Additional context
view source common/services.py

    if organization is None:
        if should_detect(detect):
            git_info = get_vsts_info_from_current_remote_url()
            organization = git_info.uri
            vsts_tracking_data.properties[ORG_PICKED_FROM_GIT] = organization is not None
            if project is None:
                project = git_info.project
                vsts_tracking_data.properties[PROJECT_PICKED_FROM_GIT] = project is not None
                if repo is None:
                    repo = git_info.repo
                    vsts_tracking_data.properties[REPO_PICKED_FROM_GIT] = repo is not None
        if organization is None:
            organization = _resolve_instance_from_config(organization)
            vsts_tracking_data.properties[ORG_PICKED_FROM_CONFIG] = organization is not None
        else:
            orgFromConfig = _resolve_instance_from_config(organization)
            vsts_tracking_data.properties[ORG_IGNORED_FROM_CONFIG] = orgFromConfig is not None
        if project is None:
            project = _resolve_project_from_config(project, project_required)
            vsts_tracking_data.properties[PROJECT_PICKED_FROM_CONFIG] = organization is not None
        else:
            projectFromConfig = _resolve_project_from_config(project, False)
            vsts_tracking_data.properties[PROJECT_IGNORED_FROM_CONFIG] = projectFromConfig is not None

Metadata

Metadata

Assignees

No one assigned

    Labels

    FeatureFeature Work required.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions