I asked the following question at the beginning of the year:
Multiple separate triggers in azure-pipelines.yml
Basically, my setup is my "microservices" are subdirectories in a monorepo. I wanted separate triggers for each of those subdirectories based on if there were changes in them. I was trying to avoid a polyrepo and it sounded like this answer was the solution. Otherwise, anytime there was a change anywhere in the project, everything would be triggered to rebuild and redeploy.
I started running into issues with it so I disabled it. The two primary issues where:
- It seemed like when the pipeline would fail, either at the CI or CD stage, and I'd go to manually trigger it, it wouldn't find changes for some reason and wouldn't run. I'd have to modify the
azure-pipeline.yaml
by commenting out the task checking for changes and then run. Or I'd have to make some small change, recommit, retrigger, etc. - Sometimes I did just want to manually trigger the subdirectory and its associated pipeline, and I'd have to do the preceding.
So I disabled it and have just been stopping the pipeline from rebuilding and redeploying everything when it is triggered, and manually running on the subdirectories I wanted.
How can I implement this functionality in my azure-pipeline.yaml
?
- Only run on a subdirectory if there is a change.
- Run when there is a manual trigger even if no changes.
trigger:
branches:
include:
- staging
- master
paths:
include:
- admin/*
- client/*
- api/*
- azure-pipelines.yml