azure-devops-cli-extension icon indicating copy to clipboard operation
azure-devops-cli-extension copied to clipboard

[Feature Request] Extend `--detect` to use environment variables available when running in Azure Pipelines

Open jessehouwing opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. Azure Pipelines must be one of the key platforms on which az devops is employed. Azure Pipelines sets a number of environment variables that point to the current repository.

It would be nice if --detect would be able to leverage these variables

Describe the solution you'd like

Azure pipelines always sets these two variables:

      --organization $env:SYSTEM_COLLECTIONURI `
      --project $env:SYSTEM_TEAMPROJECT

When using --detect to automatically detect the organization or project, it should pick up these variables.

Why?

  • it's faster than reading the git remote data
  • it's available by default on Azure Pipelines
  • It works in pipelines that have: -checkout: none

Why not?

  • There are cases where people check out a different repo than the one that owns the pipeline (e.g. - checkout: https://github.com/something/something.git). Those workflows would break if they relied on --detect and the environment variables would take precedence.

Additional context Add any other context or screenshots about the feature request here.

jessehouwing avatar Sep 29 '23 07:09 jessehouwing