Azure / azure-devops-cli-extension

Azure DevOps Extension for Azure CLI
https://docs.microsoft.com/en-us/cli/azure/ext/azure-devops/?view=azure-cli-latest
MIT License
617 stars 239 forks source link

Cannot create a pipeline with yaml file from another Project #1018

Open jwikman opened 4 years ago

jwikman commented 4 years ago

Cannot create a pipeline with yaml file from a repo in another Project

Command Name az pipelines create Extension Name: azure-devops. Version: 0.18.0.

Errors:

request failed: Operation returned a 404 status code.

To Reproduce:

Steps to reproduce the behavior. Note that argument values have been redacted, as they may contain sensitive information.

The 404 error seems to come from a http GET to list repos, and it tries to list Repo1 in Project2 hence the 404 (file not found) error: GET https://dev.azure.com/[org]/[Project2]/_apis/git/repositories/[Repo1]

Expected Behavior

The pipeline should be created in Project2, but the yaml pipeline definition will stay in Repo1 in Project1. This is now only possible in the UI. Since I'm using the git clone url of the repo, all needed info is provided.

Environment Summary

Windows-10-10.0.18362-SP0
Python 3.6.6
Installer: MSI

azure-cli 2.7.0

Extensions:
azure-devops 0.18.0
jarpsimoes commented 3 years ago

Hi,

I've the same issue. How can I do a workaround to that?

Best regards,

jwikman commented 3 years ago

@jarpsimoes I worked around this by using DevOps API for this instead: https://docs.microsoft.com/en-us/rest/api/azure/devops/build/definitions/create?view=azure-devops-rest-5.1

tkellogg commented 3 years ago

I've gotten this problem when using a tfsgit repository type where the repository URL had a space in it. I fixed it by renaming the URL such that it doesn't have a space.

From "Repos":

  1. Click the "v" drop down button (your project name) at the top of the screen.
  2. Select "Manage Repositories"
  3. Find your repository
  4. Click "Rename" button and rename it without the space
ggirard07 commented 3 years ago

@jwikman How did you manage to use the API you linked to create a pipeline based on a YAML definition? I do not see any parts of the body to do so. There is also https://docs.microsoft.com/en-us/rest/api/azure/devops/pipelines/pipelines/create?view=azure-devops-rest-6.1, but doc seems broken as body is inconsistent and I was not successful either. Also tried to snif it from the UI, but as you said it is using neither of the documented APIs for it.

WimSchmitz commented 2 weeks ago

Hi, can confirm that this issue is still present.