When using Azure Pipelines, I would like to execute a job (expanded from a template), based on the result of the previous job. Is there any way I can do that? What I’ve tried is the following:
- stage: deployDev
displayName: Deploy to Dev environment
jobs:
- ${{ if eq(stageDependencies.detectChanges.outputs['sourceChanges.infrastructureSourceChanges.filesUpdated'], True) }}:
- template: deploy-infrastructure.yaml
name: deployInfrastructure
parameters:
environment: "dev"
- ${{ if or(succeeded('deployInfrastructure'), skipped('deployInfrastructure')) }}:
- template: deploy-staging.yaml
parameters:
environment: "dev"
And this got me 2 errors:
- Unrecognized value: ‘succeeded’…
- Unrecognized value: ‘stageDependencies’….
What I’m interested in is:
- run deploy-infrastructure if the output from a previous stage says so;
- run deploy-staging if the first job either succeeded or was skipped