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

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

Open CMihalcik opened this issue 3 years ago • 2 comments

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://[email protected]/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.

CMihalcik avatar Sep 22 '22 03:09 CMihalcik

route to CXP team

yonzhan avatar Sep 22 '22 05:09 yonzhan

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://[email protected]/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: -

ghost avatar Sep 22 '22 05:09 ghost