Reputation: 1975
I want to use environments to deploy code to different environments. When i ommit the variables it works ok but soon as i put variables in it gives these errors?
Unexpected value 'environment' Unexpected value 'strategy'
stage: Development
condition: and(succeeded('Build'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- deployment :
variables:
- name: appname
value: testapp
displayName: deploy Development
pool:
vmImage: 'ubuntu-latest'
environment: 'development'
strategy:
# Default deployment strategy, more coming...
runOnce:
deploy:
steps:
- checkout: self
- script: echo Development Environment
- template: templates/release.yml #Run Release Template
Upvotes: 0
Views: 912
Reputation: 35099
From your YAML sample, it should be missing an indent from displayname field, thus causing a problem with the yaml format.
You can refer to the sample below:
stages:
- stage: Development
condition: and(succeeded('Build'), eq(variables['Build.SourceBranch'], 'refs/heads/master'))
jobs:
- deployment :
variables:
- name: appname
value: testapp
displayName: deploy Development
pool:
vmImage: 'ubuntu-latest'
environment: 'development'
strategy:
# Default deployment strategy, more coming...
runOnce:
deploy:
steps:
- checkout: self
Upvotes: 1