I have both server side (web api using c#) and client side (angular) code in same branch. I have created separate stage for both server side and client side code to build, and one more stage to deploy. If I check in code in either of client side or server side the all the 3 stages run. To avoid this I am looking for ways to add conditions at stage level so that if there are server side changes then only Server stage will run, if the checked in code has only client side code then only Client stage will run. I don't understand how I can check which files are checked in. I found similar kind of questions while searching but the solutions are given using git. I have my code in azure-repos. Is there any way so that I can check based on folder if there are changes and further use it in conditions in stage. Something like this:
stages:
- stage: 'Server'
condition:
- stage: 'Client'
condition:
Thanks in advance.
I am posting the solution that worked for me. I have 3 stages Server, Client and Deploy. I have separated the stages in two pipelines on same branch. Now I have Server and Deploy stage in one and Client and Deploy stage in another pipeline. Additionally I have used the following code in server side(Web Api) pipeline
paths:
exclude:
- folder Path for Client side /*
stages:
- stage: 'Server'
# steps for building server side code
- stage: 'Deploy'
# steps for Deploying server side code
and the following code in client side pipeline
paths:
include:
- folder Path for Client side/*
stages:
- stage: 'Client'
# steps for building client side code
- stage: 'Deploy'
# steps for Deploying client side code
Now it triggers respective pipeline and deploys respective builds.