1
votes

I would like to know if there is a mechanisim in Azure DevOps to reuse a definition for Azure DevOps Pipelines.

In my scenario I defined two Azure DevOps (Build) Pipelines to generate the artifacts of my web app; one for staging the other for production. The build definiton is the same in both cases except for two things:

  • a variable that set the build configuration for the ASP .NET Core (Staging or Release)
  • the branch that triggers the build (staging or master)

My goal is to avoid duplicated build definition that should be updated in both whenever somehting is updated in the project.

The build definition are in classic mode (no YAML files).

1
You shouldn't be generating different artifacts for different environments. How do you know that the "production" artifacts actually work unless you deploy and test them first? Best practice is to have a single artifact that is deployed through all environments.Daniel Mann
Maybe is not an strong argument but the thing is the staging artifacts are built without minyfing and other settings we want to check whereas the production is not.Julen
@Julen - that sounds like a minor nightmare. There should only ever be one process that generates release-able artifacts for a repository and it makes all of the artifacts (minified and not) at one time. You should strongly consider deploying the artifacts for production to the staging environment and only changing out for non-minified components when something is failing testing anyways and you need to debug it.StingyJack

1 Answers

2
votes

With classic you can create task groups and reuse those. You can select existing build steps and convert them to a task group and then reuse the task group across builds.

This is covered in the following document.

With yaml files you can use templates.