Run task only once in rolling deployment scenario

Hi,

We have a rolling deployment scenario, where we are deploying application and performing automatic DB migration. We would like to execute migration step only once, for the first machine on which rolling deployment starts. If it success, rest should move on.
Right now, step is executed for each machine, which is not a good solution.

B R
Piotr

Hi Piotr,

Thanks for reaching out. There’s no way to tell Octopus to just deploy to the first machine of a group of machines, and leave the rest. You need to be very specific when telling Octopus where do you want the deployment to take place.

The Octopus-way to do this would be to pick one machine, give it a specific role like FirstMigration and then scope the migration step only to that machine. This means of course that the step will always be executed on the same machine, and not in “the first one” like you requested.

Regards,
Dalmiro

FYI…Piotr, I built on this question with my suggestion below. Feel free to build on this idea if I didn’t capture your need properly. I think your question exposes an easy to implement feature that will make OD more robust and usable.