Neville Nazerane
Neville Nazerane

Reputation: 7019

Azure devops publicly reusable YAML

I was trying to set up a YAML that anyone can extend and reuse. I found a way to reuse pipelines across repositories using resources and 'repository' in the YAML file. It is something like this:

resources:
  repositories:
   - repository: templates
     type: git/github
     name: username/reponame
     endpoint: ???

This seems to work across repositories. However, it makes the endpoint property mandatory. This doesn't seem to make sense. The process of extending the YAML is read-only and the repository could be public-facing. Why would it be mandatory to specify an endpoint for authorization? Is there another way? Maybe to extend a YAML through the raw URL.

Upvotes: 0

Views: 97

Answers (1)

Leo Liu
Leo Liu

Reputation: 76870

The process of extending the YAML is read-only and the repository could be public-facing. Why would it be mandatory to specify an endpoint for authorization?

It depends on your repository type.

As the document Resources: repositories:

Type Pipelines support the following values for the repository type: git, github, githubenterprise, and bitbucket. The git type refers to Azure Repos Git repos.

And the state of the endpoint:

endpoint: string # name of the service connection to use (for types that aren't Azure Repos)

So, if the type of repository is Git, the endpoint property is not mandatory.

As test, following script yaml works fine:

resources:
  repositories:
  - repository: Testproject
    type: git
    name: MyTestProject/Testproject

But, if the type of repository is not git, like github, bitbucket, we need create a Service connections for authorization. So, we have to specify the endpoint: for authorization.

Hope this helps.

Upvotes: 1

Related Questions