John Hennesey
John Hennesey

Reputation: 375

Azure DevOps build from dynamic repo name

Anybody know if it is possible to pass in a repo name / base the build on a dynamic repo name? This would allow us to share the same build definition across different branches, cutting down on definitions when creating a feature branch, etc.

When using a TFVC repo we would store the different releases in the same repo but different paths. We could reuse the same build definition across different releases/FB's by altering the source path such as $/product/$(release)/......

It appears Git likes to have the repo hard-coded into the build (hence the dropdown - no way to plug in a variable.

While the question is targeted to On-prem Azure DevOps, if it is possible in the hosted environment it would be helpful to know.

enter image description here

Upvotes: 0

Views: 1277

Answers (3)

jessehouwing
jessehouwing

Reputation: 114741

I recommend using YAML build templates. By default these check out "self" and are stored in the repo. That way they work on forks, branches etc. Each branch can contain tweaks to the build process as well.

With the 'old' UI based builds this isn't possible.

Upvotes: 2

John Hennesey
John Hennesey

Reputation: 375

Looks like Task Groups solved the need (mostly). I was hoping to have one build definition that could be shared across multiple branches; while this appears to be possible on the hosted model, on prem is different.

I am able to clone a build (or use templates) to have an entry point into the repo/branch to get the sources, then pass off the work to a common task group. If I need to modify the build process for multiple branches, just modify the task group.

Upvotes: 0

Krzysztof Madej
Krzysztof Madej

Reputation: 40663

What you are looking for is actually two things:

  • templates - this allows you reuse definition accross different pipelines
  • triggers - this allows you to trigger pipeline when commit happens on different branches

Upvotes: 1

Related Questions