对给定的作业目标无效

对给定的作业目标无效

本文介绍了步骤引用任务InvokeRESTAPI(版本1.152.1)对给定的作业目标无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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'

返回:

推荐答案

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.

这篇关于步骤引用任务InvokeRESTAPI(版本1.152.1)对给定的作业目标无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-24 15:54