Azure / Azure/azure-cli

az pipelines create ignores --repository when it refers to a different project than --project

Open
#23,967 3 comments 0 reactions 0 assignees View on GitHub
act-platform-engineering-squad Auto-Assign customer-reported DevOps Pipelines Service Attention
Dominant language
Python
Stars
4.6k
Forks
3.5k
Avg merge
3d 2h
Merged PRs (30d)
60

Description

Attempting to create a pipeline in one project using a yaml file in a git repo in another project fails.

## Prerequisites

Two projects in the same organization with AzureDevOps git repos with the same name,
- sourceProject
- aRepo
- yaml pipeline file
- targetProject
- aRepo

## Steps to Reproduce

Note that `$yamlRepo` refers to a repo in sourceProject while `$project` refers to targetProject

Run

```
organization='https://dev.azure.com/org/'
project='targetProject'
yamlRepo=https://org@dev.azure.com/org/sourceProject/_git/aRepo

az pipelines create \
--name "$pipelineName" \
--folder-path "$pipelineFolder" \
--repository "$yamlRepo" \
--repository-type 'tfsgit' \
--branch "$yamlBranch" \
--description "$description" \
--organization "$organization" \
--project "$project" \
--yaml-path "$yamlPath" \
--skip-first-run true
```

and then

`az pipelines show --name $pipelineName --folder-path $pipelineFolder --project $project --query 'repository.url'`

## Expected

The URL output from the last command will match `$yamlRepo`

## Observed

The URL output from the last command points at aRepo in targetProject. Removing `--skip-first-run true` will cause `az pipeline create` to fail with a validation error when trying to first run the newly created pipeline.

## Environment
```
$ az --version
azure-cli 2.40.0

core 2.40.0
telemetry 1.0.8

Extensions:
azure-devops 0.25.0
interactive 0.4.5

Dependencies:
msal 1.18.0b1
azure-mgmt-resource 21.1.0b1

Python location '/usr/local/Cellar/azure-cli/2.40.0/libexec/bin/python'
Extensions directory '/Users/username/.azure/cliextensions'

Python (Darwin) 3.10.6 (main, Aug 30 2022, 05:09:33) [Clang 12.0.0 (clang-1200.0.32.29)]

Legal docs and information: aka.ms/AzureCliLegal

Your CLI is up-to-date.
```

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.