How to remediate vmImage Error in YAML Pipeline

63 Views Asked by At

I am trying to set up my first pipeline in Azure DevOps. I set up a YAML pipeline which I want to run anytime someone commits a change to any branch; the yml file I wrote will run a python script which will send a notification to a teams channel with specified information. However, as I'm trying to "queue" my pipeline, I keep getting this error "Unexpected vmImage 'windows-latest,' so my pipeline won't run. I've checked the agent pool/agents and they appear to support windows (I've tried different variations of windows as found here). I'm stumped on what the issue is here, and how to fix it. This is my yml file:

trigger:
  branches:
    include:
      - '*'

jobs:
- job: RunPythonScript
  displayName: 'Run Python Script'
  pool:
    vmImage: 'windows-latest'  
  steps:
  - task: UsePythonVersion@0
    inputs:
      versionSpec: '3.x'

  - checkout: self 

  - script: |
      pip install -r requirements.txt  
      python -m pip install --upgrade pip
      pip install -r requirements.txt

      if git diff --name-only $(Build.SourceVersion) $(Build.SourceVersionPrevious) | grep -q '\.json$'; then
          python \\company.com\data\planning\PowerBI\Test Scripts\TeamsNotificationScript.py
      else
          echo "No changes to .json files. Skipping script."
      fi
    displayName: 'Run Python Script' 
  • I checked "agent pools" in Azure and their capabilities for each enabled agent (all Agent.OS values are Windows_NT), so should support 'windows-latest, 2019, 2016, etc.,' which I also tried.
  • I'm using the Default agent pool in DevOps and there are multiple agents enabled in the Default agent pool.
0

There are 0 best solutions below