I have a CI/CD pipeline for a solution with several projects. I check the changes and only build the projects which have been changed, as opposed of building all of them. I accomplish this using a condition at the build stage of each project. This is the relevant part:
- stage: S_BuildChannelUpdate
dependsOn: 'PreSteps'
jobs:
- job: 'BuildChannelUpdate'
variables:
BuildCondition: $[ stageDependencies.PreSteps.Check_changes.outputs['pwsh_script.BuildChannelUpdate'] ]
condition: eq(variables['BuildCondition'], True)
This works as I expect, the build steps are only executed if the conditions are met. So far so good. For the deployment part, I want to do it only if there is something new to be deployed. I.e. project was changed and the build was successful. Again, here is the relevant part:
- stage: 'S_ReleaseChannelUpdate'
dependsOn:
- PreSteps
- S_BuildChannelUpdate
jobs:
- deployment: 'ReleaseChannelUpdate'
variables:
ReleaseCondition: $[ stageDependencies.PreSteps.Check_changes.outputs['pwsh_script.BuildChannelUpdate'] ]
condition: eq(variables['ReleaseCondition'], True)
environment: 'dev'
strategy:
runOnce:
deploy:
steps:
The problem here is that I want to set an approval for the releases and the pipeline asks me to approve it before evaluating the condition. I would like to get the approval request only if the ReleaseCondition is True. I was also expecting that since the stage S_BuildChannelUpdate was skipped (condition not met), the stage S_ReleaseChannelUpdate will consider its dependencies not met.
Any suggestions?