We have an on-premises, TFVC setup with Azure Devops 2019. I'm building a C++ library and have set-up a multi-configuration build (Debug, Release) which works fine. However, I'd like to run a set of unit tests only when the Release configuration is building. I've added a "Visual Studio Test" task which unfortunately is running under both configurations and takes way too long under the Debug configuration. Each test is run in isolation.
I'm not seeing any options to conditionally run the task (I can't edit YAML).
Is there a way to run a task in the pipeline only for a certain configuration?
Firstly, you must have the permissions to create, edit and delete the pipeline in the project. If you do not have the permissions, you need to contact the project administrators.
Suppose the variable for the configurations is
Configuration = Debug,Release
. To run a task in the pipeline only for a certain configuration:Configuration
variable in pipelineConfiguration
isDebug
.if
conditional to skip the Visual Studio Test task.In this way, when the
Configuration
isDebug
, the Visual Studio Test task will be skipped and hidden in the job run.condition
to skip the Visual Studio Test task.In this way, when the
Configuration
isDebug
, the Visual Studio Test task will be skipped but not hidden in the job run.