Reputation: 31
Can we set pre deployment conditions in deploy stage YAML ?
I have two stages in my YAML pipeline Azure DevOps (we restrict team to use classic pipelines). I want to know whether we have possibility to set Pre-Deployment Approvals in YAMl for Deploy Stage?
Upvotes: 3
Views: 5156
Reputation: 1538
To clarify the answers which together provide all the information but miss bits of info each:
as is indicated by the official MS doc extract provided by @GeralexGR.
in order to effectively create a manual approval on your stage.
Upvotes: 2
Reputation: 35544
Can we set pre deployment conditions in deploy stage YAML ?
Yes. You can define the approval in Environment(Pipelines -> Environment).
Here are the steps:
Create Environment.
Navigate to Environment -> Approvals and checks. Then you can add the Approvals in the environment.
For example:
- stage: Deploy
displayName: 'Deploy Web App'
dependsOn: Build
condition: succeeded()
jobs:
- deployment: DeploymentJob
environment: envname
strategy:
runOnce:
deploy:
steps:
xxxx
For more detailed info, you can refer to this doc: Create and target an environment
Upvotes: 3
Reputation: 3592
Do you mean in the release pipeline? You can set your pre-deployment approvals on your release pipelines using gates or an approval from a user.
Configuration of pre-deployment approvals.
If you mean deployment approvals on the build pipeline, you could configure a logic for the build run (specific branch, conditions to evaluate variables and booleans before the run)
As stated in the documentation:
Approvals and other checks are not defined in the yaml file. Users modifying the pipeline yaml file cannot modify the checks performed before start of a stage. Administrators of resources manage checks using the web interface of Azure Pipelines.
Upvotes: -1