Skip to content

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

@CMihalcik

Description

@CMihalcik

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions