Conditions not evaluating as expected

Hi Andy,

The BuildCompleted state is only set at the end of the build. It is not set after a stage completes.

Looking at your screenshot, I can see that one condition you have used is $Configuration.LastFinishedBuild.State$ Equals 'BuildCompleted'. This cannot be used to test whether any builds are running, as the last finished build is always finished and its state will either be BuildCompleted, BuildFailed, BuildError, BuildStoppedByUser, BuildDiscarded or StagePendingPromotion.

The expression $Configuration.LastBuild.State$ is also not useful as this refers to the last build started in the configuration and this can point to the current build. We don’t have an expression which refers to the previous build.

The only fail-safe way to limit the number of builds that run concurrently per configuration is to use a shared resource lock. If this is too much to maintain, maybe you can use a Quota List shared resource with a label for each configuration?

Why do you need to prevent multiple builds running for all of your configurations?