0
votes

I was wondering if it's possible to set a build order/priority within a single commit in vsts.

The scenario I am having is this:

I have a solution (one repository) with multiple projects.

  • Publisher
  • Subscriber1
  • Subscriber2
  • Messages

Each of these (expect messages) have one build-definition with path-filter to each respective project (Continuous Integration), and the gets released (Continuous deployment trigger) and initialized there after.

The projects are not depended on each other, expect messages, that are used to communicate.

So if I make changes to the Publisher project and any Subscriber projects, then commit, I want to always build and release the Publisher project first.

Because the publisher needs to now if there are newly created messages the subscribers want to subscribe to.

Is such a thing possible?

2

2 Answers

1
votes

VSTS can’t specify the order for the CI builds triggered by the same code now.

I posted an user voice Specify queue builds order if there has multiple CI builds are triggered by the same code, you can vote and follow up.

For now, you can use below workarounds:

  1. Build for all projects even if there only have changes for a certain project (Publisher or Subscriber)

    If it’s ok for you to build all the projects even there has only changes for a project, you can define a build definition to build all the projects in it. And then use this build as CI build to replace the multiple CI builds.

  2. Set custom conditions for all the related tasks

    You still need to define all the tasks in one build definition, and add two variables publisher and subscriber with default value 0.

    And add a PowerShell task at the begin of your build to check which projects has been changed. If the Publisher project is changed, set publisher variable with value 1. If subscriber project is changed, set subscriber variable with value 1.

    Then use custom conditions for related projects. Such as in build Publisher project task, use the custom condition: and(succeeded(), eq(variables['publisher'], '1')).

    enter image description here

    Then the task only runs when the publisher variable is 1. You can also refer this post with the way to use custom conditions.

0
votes

A workaround is to set your priority build to be triggered by Continuous Integration and the others triggered in Rolling builds mode. The Rolling builds will wait for the CI before beginning