Azure / azure-cli

Azure Command-Line Interface
MIT License
4.03k stars 3k forks source link

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

Open CMihalcik opened 2 years ago

CMihalcik commented 2 years ago

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,

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.
yonzhan commented 2 years ago

route to CXP team

ghost commented 2 years ago

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @v-anvashist, @V-hmusukula.

Issue Details
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. ```
Author: CMihalcik
Assignees: -
Labels: `Service Attention`, `customer-reported`, `DevOps`, `Pipelines`, `Auto-Assign`
Milestone: -