0

I am creating CI/CD pipelines in VSTS using GIT repository.

I need to use the same steps from UI while creating build definition and release configuration for projects so i want to get off this repeating manual steps and create some automation around it so I don't have to do the same steps every time.

Can anyone tell me how it is possible using scripts or any other things?

jessehouwing
  • 106,458
  • 22
  • 256
  • 341

1 Answers1

1

To create build definitions you have two options:

  1. Use the new YAML builds, which allows you to specify the whole build in a YAML file instead of UI elements.

  2. Use the Build Definition REST API create the definition locally in json form and submit it to VSTS in a single transaction. There is a nice PowerShell library called "VSTeam" which wraps the REST API functions in powershell cmd-lets.

Another thing to look at would be the use of Task Groups, these allow you to abstract away a sequence of tasks and turn those into a single reusable task.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • Is it also possible to create build definition using scripts like Powershell. I dont have experience in .net coding – kapil singh Sep 28 '18 at 10:04
  • You can call the REST apis from powershell. https://blogs.msdn.microsoft.com/premier_developer/2018/04/21/using-vsts-api-with-powershell-to-scaffold-team-projects/ – jessehouwing Sep 28 '18 at 11:37
  • Or use this module that already wraps some of these APIs in ready to use powershell functions: https://github.com/DarqueWarrior/vsteam – jessehouwing Sep 28 '18 at 11:37
  • 1
    First, for Build Definitions, now called Build Pipelines, learn to use "Task Groups". I've learned about these and have greatly benefited from using the "fix once and apply everywhere" feature. Second, MS is working on turning Release Pipelines into YAML, but it is a future feature and not here yet. I am building my own solution described here: https://stackoverflow.com/questions/52323065/azure-devops-yaml-release-pipelines/52558053#52558053 – Antebios Oct 02 '18 at 19:28