Azure / Azure/azure-devops-cli-extension

[BUG]`az pipelines list --name` fails when name starts with a dot

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

Description

# Issue: `az pipelines list --name` fails when name starts with a dot

## Summary

The `--name` parameter in `az pipelines list` returns an empty array when the pipeline name starts with a dot (e.g., `.NET CI Pipeline`). Wildcard patterns starting with a dot also fail, but wildcards that don't start with a dot work correctly.

## Environment

- Azure CLI: 2.81.0
- Azure DevOps extension: 1.0.2
- OS: macOS (Darwin)
- Python: 3.13.10

## Steps to Reproduce

1. Have an existing pipeline named ".NET CI Pipeline" in Azure DevOps

2. List all pipelines (works correctly):
```bash
az pipelines list \
--organization https://dev.azure.com/ \
--project \
--output json
```

**Result:** Returns array with pipeline, confirming it exists:
```json
[
{
"id": 611,
"name": ".NET CI Pipeline",
...
}
]
```

3. List pipeline by exact name (fails):
```bash
az pipelines list \
--name ".NET CI Pipeline" \
--organization https://dev.azure.com/ \
--project \
--output json
```

**Result:** Returns empty array `[]`

4. List pipeline with wildcard starting with dot (fails):
```bash
az pipelines list \
--name ".NET*" \
--organization https://dev.azure.com/ \
--project \
--output json
```

**Result:** Returns empty array `[]`

5. List pipeline with wildcard NOT starting with dot (works):
```bash
az pipelines list \
--name "*NET*" \
--organization https://dev.azure.com/ \
--project \
--output json
```

**Result:** Returns the pipeline correctly:
```json
[
{
"id": 611,
"name": ".NET CI Pipeline",
...
}
]
```

## Expected Behavior

All of these patterns should find the pipeline:
- `--name ".NET CI Pipeline"` (exact match)
- `--name ".NET*"` (wildcard starting with dot)
- `--name "*NET*"` (wildcard not starting with dot)

## Actual Behavior

| Pattern | Expected | Actual |
|---------|----------|--------|
| `.NET CI Pipeline` | Found | Not found |
| `.NET*` | Found | Not found |
| `*NET*` | Found | **Found** |

The `--name` filter fails when the pattern starts with a dot (`.`).

## Root Cause Hypothesis

The leading dot in the name appears to be causing the filter to fail. This could be due to:
- The dot being interpreted as a special character (regex or glob)
- Escaping issues in the filter logic
- The API treating names starting with `.` differently

## Workaround

List all pipelines without the `--name` filter and filter locally:

```bash
az pipelines list \
--organization https://dev.azure.com/ \
--project \
--output json \
| jq '.[] | select(.name == ".NET CI Pipeline")'
```

Or use a wildcard that doesn't start with a dot:

```bash
az pipelines list \
--name "*NET*" \
--organization https://dev.azure.com/ \
--project \
--output json
```

## Impact

This issue affects tooling that relies on `az pipelines list --name` to look up pipeline IDs by name. The workaround requires either fetching all pipelines (inefficient for large organizations) or using less precise wildcard patterns.

## Related Commands

The `--pipeline-name` parameter in `az pipelines variable list` likely has the same issue, as it probably uses similar filtering logic internally.

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.