Step references task InvokeRESTAPI at version 1.152.1 which is not valid for the given job target

梦想与她 提交于 2020-01-25 10:40:28

问题


I have an Azure pipeline which needs to send a REST request to an endpoint. I am trying to use the built in task InvokeRESTAPI@1 to do this, but it errors when running on Azure DevOps.

Script:

---
trigger:
  batch: true
  branches:
    include:
      - master
pr:
  - master

stages:
  - stage: Run_Tests
    jobs:
      - job: RA001
        pool: windows-server
        steps:
          - task: InvokeRESTAPI@1
            displayName: "Run Test"
            inputs:
              connectionType: 'connectedServiceName'
              serviceConnection: 'myconnection'
              method: 'PUT'
              headers: |
                {
                "AccessKey":"$(system.MyKey)"
                }
              urlSuffix: '/api/v3/schedules/uniquenumber/runNow'
              waitForCompletion: 'false'

Returns:

Job RA001: Step references task 'InvokeRESTAPI' at version '1.152.1' which is not valid for the given job target.


回答1:


The InvokeRESTAPI@1 it's server job task (agentless job in the classic editor), not a regular task that can run on an agent.

You need to put it in server job in this way:

pool: server

More info you can find here.



来源:https://stackoverflow.com/questions/57294014/step-references-task-invokerestapi-at-version-1-152-1-which-is-not-valid-for-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!