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 Answers
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).
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.
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:
task group
? Is it helpful? – Cece Dong - MSFT