0

With the script in this question's most upvoted answer: Triggering Azure DevOps builds based on changes to sub folders

I managed to skip the build process on all projects that weren't being modified on each commit, but their release still executes and fails because it doesn't find any artifact. Is there a way to also skip the release linked to a build from being executed if the build was skipped?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
deleb
  • 569
  • 4
  • 6

1 Answers1

1

Yes, you can add a custom condition to a release job that evaluates a variable.

For example, in one of my pipelines, I have an agentless job which checks that a build variable is not empty. There is a dummy wait task for 0 minutes in it.

The following job, which contains the actual release process, has a condition that tells it to run only if the previous one has completed successfully.

Fabo.sk
  • 116
  • 1
  • 10
  • Awesome, thanks!!! Could you show/explain how you created the variable evaluation? – deleb Apr 25 '19 at 22:11
  • When you are in the deployment process screen of the environment, where you add tasks, click on the three dots next to the name of the stage. Then you can create an agentless job. Then after clicking on the job, the very last option, under Additional options, is Run this job. Select Custom condition, and fill in the expression. I used something like ne(variables['BuildFolder'], ''). Don't forget to order the jobs properly. – Fabo.sk Apr 25 '19 at 22:21
  • I still couldn't make it work with your recommendations. Maybe I could have eventually, but found a better solution instead for my situation: https://stackoverflow.com/questions/53227343/triggering-azure-devops-builds-based-on-changes-to-sub-folders/55886028#55886028 I'll give you points for trying to help anyways!! :) – deleb Apr 28 '19 at 00:34