Azure / Azure/azure-devops-cli-extension

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

Open
#1,368 0 comments 3 reactions 0 assignees View on GitHub
Feature
Dominant language
Python
Stars
682
Forks
278
Avg merge
3d 23h
Merged PRs (30d)
3

Description

**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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.