如何使用Azure DevOps REST Api获取非秘密的构建参数?

问题描述 投票:2回答:1

我有一个函数,该函数调用api以返回相应的构建选项。请注意:

C:\> $build = get-builds sharptop vNext_test_VL -Count 1 -Verbose -BuildStatus completed
VERBOSE: GET
http://tdc1tfsapp01.dayforce.com:8080/tfs/DefaultCollection/sharptop/_apis/build/definitions?name=vNext_test_VL&api-version=5.0 with
0-byte payload
VERBOSE: received 2245-byte response of content type application/json; charset=utf-8; api-version=5.0
VERBOSE: GET
http://tdc1tfsapp01.dayforce.com:8080/tfs/DefaultCollection/sharptop/_apis/build/builds?api-version=5.0&queryOrder=finishTimeDescendin
g&statusFilter=completed&maxBuildsPerDefinition=1&definitions=5963 with 0-byte payload
VERBOSE: received 5287-byte response of content type application/json; charset=utf-8; api-version=5.0
C:\> $build | ft buildNumber,result,parameters

buildNumber  result    parameters
-----------  ------    ----------
58.0.0.29010 succeeded


C:\>

((我用冗长的文字显示了请求)

但是返回的版本不包含任何参数,即使它们存在:enter image description here

所以,我们如何获得它们?

azure-devops azure-devops-rest-api
1个回答
0
投票

问题可能是虽然buildNumberresult都是简单的字符串,但parameters是一个具有多个值的对象,并且您的脚本在绘制它时无法处理它?

例如,这是我通过邮递员为我的一个建筑调用类似请求时得到的:

"buildNumber": "20191017.1",
"result": "failed",
"parameters": "{\"BuildConfiguration\":\"release\",\"BuildPlatform\":\"any cpu\",\"system.debug\":\"false\"}",
© www.soinside.com 2019 - 2024. All rights reserved.