【问题标题】:Save Postman Response in Azure DevOps Pipeline in variable or file on the Repo将 Azure DevOps Pipeline 中的 Postman 响应保存在 Repo 上的变量或文件中
【发布时间】:2021-08-29 11:56:58
【问题描述】:

我正在尝试将 Azure DevOps Pipeline 中的 Postman 响应保存在 Repo 上的变量或文件中

例如,我想获取 pm.variables.get('someID'); 并将其保存到变量或将其保存到 repo 中的某个文件,然后我想运行另一个 powershell 或 bash 并对这个变量进行一些操作。

但我发现我不能将变量从邮递员传递给另一个任务

我试图做这样的事情:

在邮递员中我在“测试”中运行

var delete_id = pm.variables.get('newSiteId');

`log = "##vso[task.setvariable`

 `variable=siteid_delete;isoutput=true]"+delete_id`

但我遇到错误

 ##vso[task.setva' contains logging command keyword '##vso', but it's not a legal command. Please see the list of accepted commands: https://go.microsoft.com/fwlink/?LinkId=817296

【问题讨论】:

    标签: azure azure-devops postman azure-pipelines


    【解决方案1】:

    将 Azure DevOps Pipeline 中的 Postman 响应保存在 Repo 上的变量或文件中

    我担心邮递员无法做到这一点。

    这是因为 Logging Commands 用于 Azure devops 管道中的任务,例如 Powershell 而不是邮递员。这也是您收到错误“关键字'##vso',但它不是合法命令”的原因。给邮递员。

    另外,如果你想保存变量,然后想再次运行 powershell 或 bash 并对这个变量做一些操作,我们需要在任务中设置变量或使用 REST API 更新以前的变量。

    【讨论】:

    • 能否请您展示执行此操作的语法示例?
    猜你喜欢
    • 2021-02-15
    • 1970-01-01
    • 1970-01-01
    • 2018-03-30
    • 2022-10-25
    • 1970-01-01
    • 1970-01-01
    • 2021-01-03
    • 2022-01-05
    相关资源
    最近更新 更多