Reputation: 845
Could not find a question about this, and just spent 1 day figuring this out, so as community service:
Trying to create new Pipeline in a private Azure Devops project always results in the following error: No template with an identifier of 'xamarinandroid' could be found
.
My repository has nothing to do with Xamarin. There are no options to choose from and I cannot finish pipeline creation.
How can I create a new Pipeline?
Upvotes: 10
Views: 2140
Reputation: 1042
Since it started to happen about a week ago, there are few other options that potentially would work as a workarounds, until the UI gets fixed.
What you could do is to delete your .sln file, in order to NOT confuse the UI, afterwards create your pipelines through the UI as you would do regularly, than set it up, and simply revert the changes in your repo to get back your .sln file just before running the build.
Get another azure-pipelines.yml file from another repo temporarily, overriding the current one, and see afterwards if the UI will work for you in that case as usual.
Use az pipelines as part of the azure-devops extension.
az pipelines create --name 'NewBuild' --description 'PipelineForYourProject' --repository SampleRepoName --branch main --repository-type tfsgit
As more details around the last approach are available at the link below: https://learn.microsoft.com/en-us/cli/azure/pipelines?view=azure-cli-latest#az-pipelines-create
Upvotes: 1
Reputation: 845
Until MS fixes the problem, you can use devops REST API to create the pipeline, but official documentation is lacking important details about the request body.
The following works via command line
{
"folder": null,
"name": "pipeline-name",
"configuration": {
"type": "yaml",
"path": "/my-pipelines/my-pipeline-file.yaml",
"repository": {
"id": "d862c503-f545-47bc-913b-575c48f99864",
"name": "repo-name-exactly",
"type": "azureReposGit"
}
}
}
where repository.id
is a guid you see on browser url when navigating into Project Settings -> Repositories -> select your repo
export AT={paste token}
http POST https://dev.azure.com/{organization}/{project}/_apis/pipelines\?api-version\=7.1 Authorization:"Bearer $AT" < create-pipeline.json
And you have a pipeline that you can edit in DevOps. This works only for Azure DevOps Git repositories.
Edit If you put a valid azure-pipelines.yml
at the root of the repo before creating a pipeline, DevOps will pick that up automatically and I get past the error. (I am just used to placing my pipelines in a infra-related folder) (suggested by @DankoValkov)
Upvotes: 4
Reputation: 513
One of the quotes in the community discuss linked in a comment on the main post mentions that you can use the classic pipeline editor. Just tested and can confirm that works.
Upvotes: 0
Reputation: 700
for people using the restclient extension in vscode (I'm not 100% certain but I thing there is also one for visual studio), here is an example of an *.http file to create a pipeline based on the answer by tonsteri
@token=your-actual-personal-access-token
@organization=your-organization
@project=your-project
@repositoryName=your-repository-name
@repositoryId=the-id-of-the-repository
### Create Pipeline and organize into folder /Publish or set to null
POST https://dev.azure.com/{{organization}}/{{project}}/_apis/pipelines/?api-version=7.1
content-type: application/json
Authorization: Bearer {{token}}
{
"folder": "/Publish",
"name": "the-name-of-the-pipeline",
"configuration": {
"type": "yaml",
"path": "the-path-to-the-pipeline-yml-file",
"repository": {
"id": "{{repositoryId}}",
"name": "{{repositoryName}}",
"type": "azureReposGit"
}
}
}
copy, save as *.http file in vscode and then you should be able to click on the "Send Request"
Upvotes: 1