步骤引用版本 1.152.1 的任务 InvokeRESTAPI,这对给定的作业目标无效 [英] Step references task InvokeRESTAPI at version 1.152.1 which is not valid for the given job target
问题描述
我有一个 Azure 管道,需要向端点发送 REST 请求.我正在尝试使用内置任务 InvokeRESTAPI@1
来执行此操作,但在 Azure DevOps 上运行时出错.
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.
脚本:
---
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'
返回:
作业 RA001:步骤引用版本1.152.1"的任务InvokeRESTAPI"这对给定的作业目标无效.
Job RA001: Step references task 'InvokeRESTAPI' at version '1.152.1' which is not valid for the given job target.
推荐答案
InvokeRESTAPI@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.
这篇关于步骤引用版本 1.152.1 的任务 InvokeRESTAPI,这对给定的作业目标无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!