简体   繁体   中英

Building a release flow in VSTS for a micro service architecture

I am trying to set up a release flow for my micro service architecture project in Visual Studio Team Services. To make this work I need to extract artifacts for every single project/service in my solution. i can do this manually by setting up individual build steps for every service with hardcoded values. But what if i would like to make i more generic then that?

In my dream scenario I would be able to create a Task Group with the service name as an input and then just be able to send a list of services/projects to be deployed. I have figured out how to create the task group but not how to have a list as input to the build and not how to loop over a list of objects calling my task. Any suggestions? Any third party tools or should I spend my time looking at powershell scripts instead?

EDIT: I will try to clarify my what I want with some pseudo code:

BuildAndReleaseCode(solution, listOfServicesToBuild)
{
    NuGetRestore(solution);
    outputfolder = BuildSolution(solution);
    //Add testing
    for (service in listOfServicesToBuild)
    {
        CopyFilesAndPublishArtifact(sourceFolder, targetfolder)
        DeployArtifact(targetFolder, targetMachine)
    }
}

The general process:

  1. Create build definition(s) to build projects and publish artifact (Publish Artifact step) (a build definition with multiple Visual Studio Build steps or multiple build definitions for each project) You need to specify project/solution for Visual Studio Build.
  2. Queue build(s)
  3. Create a release definition
  4. Link one or more artifacts (build artifacts) to this release (Artifacts tab)
  5. Add necessary tasks and environments to deploy projects.
  6. Create release and start releasing to deploy

The release could be triggered when a new artifact version is available (Open Release Definition=>Triggers tab).

Also, the build could be triggered when check in or queue build at specific time. (Open build definition=>Triggers tab)

Update:

For Visual Studio Build step, wildcards can be used, for example, ***.sln for all sln files in all sub folders, so you don't need to specify project with hardcoded value.

If you want to build specific projects in the solution, you could specify /t parameter .

If these projects are in different solution and location, you can create a MSBuild project file which uses the MSBuild task to build projects.

On the other hand, you could custom build task to achieve that, you can refer to VSBuild code and these articles ( 1 or 2 ) to custom build task, after that, using this custom build task with projects list argument to build projects that you want.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM