I’m currently migrating an existing CI/CD pipeline build in Azure DevOps from the ‘classic’ build approach to YAML templates.
As part of the migration proces I’m configuring multiple stages where each stage represents a deployment to a specific environment(Development/Test/Acceptance/…) . It’s a typical setup where deployment to the next environment can only start after deployment to a previous environment was successful.
Here is how (a part of) the pipeline looked like:
- stage 'Development' | |
jobs: | |
- deployment: DeployExampleDev | |
displayName: "Deploy Example on development" | |
# removed other details | |
- stage: 'AcceptatieExtern' | |
jobs: | |
- deployment: DeployExampleAccExt | |
displayName: "Deploy Example on acceptatie-extern" | |
dependsOn: 'Development' | |
condition: succeeded() | |
# removed other details |
However when I checked if my pipeline was valid, I got the following error message:
Stage AcceptatieExtern must contain at least one job with no dependencies.
Did you notice my mistake? I accidently added the ‘dependsOn’ and ‘condition’ check at the ‘jobs’ level instead of the ‘stage’ level. To fix it, I moved them to the correct location:
- stage 'Development' | |
jobs: | |
- deployment: DeployExampleDev | |
displayName: "Deploy Example on development" | |
# removed other details | |
- stage: 'AcceptatieExtern' | |
dependsOn: 'Development' | |
condition: succeeded() | |
jobs: | |
- deployment: DeployExampleAccExt | |
displayName: "Deploy Example on acceptatie-extern" | |
# removed other details |