Use Azure Devops Classic Pipelines Custom Condition to run only if AGENT_RELEASEDIRECTORY subdirectory contains files

Viewed 26

I am using Azure Classic Pipelines. My build pipeline produces an artifact. The artifact contains two subdirectories that may or may not contain files that I want to deploy via my release pipeline to a target server.

My release pipeline has two separate tasks to deploy the contents of the two subdirectories. When I run the release pipeline, If both subdirectories contain files, the release succeeds. However, I am getting a error if either of the subdirectories is null --but it's a false error because it's ok for one of the subdirectories to have a null value. I want to check the value of the AGENT_RELEASEDIRECTORY/subdirectory within each release tasks to skip the task if the subdirectory is null. I'm thinking I can use a custom condition within each task, but I am new to Azure Devops and am not sure what I need to do to get it to work nor am I that good with Azure's syntax.

Do I need to declare two variables on the variables tab to represent the value of each AGENT_RELEASEDIRECTORY/subdirectory...and will it even be able to evaluate to true/false? ... and if so, what needs to go in the Custom Condition field to get the task to run if the subdirectory has files?

0 Answers
Related