0
votes

I am writing inline powershell scripts in several of my release pipelines across projects. There is a good scope of reusability of these scripts. What is the best practice to put these scripts under revision control and share it across multiple projects? Is it possible to put it under a common Azure Repo project and do a git checkout from that project in my release pipeline in other projects?

2
Have you checked task group? Is it helpful?Cece Dong - MSFT
@CeceDong-MSFT: I am looking at something that works cross project. E.g. some way if I can pull out common scripts from another git repo in AzDo.Chubsdad
You can export a task group and import it to other team projects.Cece Dong - MSFT
The problem is when I make a bug fix. Then I have to manually reimport the task group repeatedly in other projects. Too error prone.!Chubsdad
How about using YAML build as templates as @4c74356b41 mentioned? Does your last query "Is it possible to put it under a common Azure Repo project and do a git checkout from that project in my release pipeline in other projects?" means you want to make the common project containing the script as the artifact in release pipeline?Cece Dong - MSFT

2 Answers

0
votes

nothing you can do for inline really, unless you are using YAML builds. For YAML builds you can use templates. Since you are asking about scripts - step templates would be a way to go in your case (most likely).

0
votes

Update:

For your last query, making the common project containing the script as the artifact in release pipeline can be achieved, in release pipeline, you can use artifacts produced from continuous integration systems such as Azure Pipelines, Jenkins, or TeamCity, or use artifacts store in version control systems such as Git or TFVC.

enter image description here


You can consider using task group. A task group allows you to encapsulate a sequence of tasks, already defined in a build or a release pipeline, into a single reusable task that can be added to a build or release pipeline, just like any other task.

But task group is not able to be used across projects. You can export the task group and import to other team projects. Also, you can check the history of the task group:

enter image description here