Home > Software engineering >  How to resolve Yaml syntax error 'did not find expected key' - Azure devops
How to resolve Yaml syntax error 'did not find expected key' - Azure devops

Time:07-29

I am not sure what is wrong with the below yml script created in Azure devops - the error seem to be associated with indentation, but I am not certain what it is. I have explored quite a bit regarding this.

Yml

jobs:
- job: Test
  displayName: 'Test Job'
  pool:
   name: 'macos-latest'
  steps:
   - bash: |
    # Install AVD files
       echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-19;google_apis;x86'
       echo "AVD system-image successfully downloaded and installed."
  displayName: 'Download and install emulator image'

Error:

Encountered error(s) while parsing pipeline YAML:
/azure-pipelines.yml: (Line: 9, Col: 8, Idx: 150) - (Line: 10, Col: 70, Idx: 318): While parsing a block mapping, did not find expected key.

If anyone could kindly point out what is wrong here, that is very much appreciated.

CodePudding user response:

The indentation of the # Install AVD files comment is off. Fixed:

jobs:
- job: Test
  displayName: 'Test Job'
  pool:
   name: 'macos-latest'
  steps:
   - bash: |
       # Install AVD files
       echo "y" | $ANDROID_HOME/tools/bin/sdkmanager --install 'system-images;android-19;google_apis;x86'
       echo "AVD system-image successfully downloaded and installed."
  displayName: 'Download and install emulator image'
  • Related