使用Azure Devops Services,我需要从task.json获取触发发布的azure devops用户id。
我有一个与Azure API管理服务的数据源绑定。这必须根据用户id获取Azure API管理标记。我尝试过不同的方法:
{
"target": "TEST",
"endpointId": "$(ConnectedServiceName)",
"endpointUrl": "{{endpoint.url}}/subscriptions/{{endpoint.subscriptionId}}/resourceGroups/$(ResourceGroupName)/providers/Microsoft.ApiManagement/service/$(APIM)/products?tags=**$(Release.RequestedForId)**&api-version=2019-12-01",
"resultSelector": "jsonpath:$.value[*]",
"resultTemplate": "{\"Value\" : \"{{{id}}}\", \"DisplayValue\" : \"{{{properties.displayName}}}\" }"
},我也尝试了{{Release.RequestedForId}},但它不起作用。
我看到了数据源绑定支持的不同资源:
tfs:teamfoundation -托管在TFS中的任何微服务(例如,构建、测试等)打包-打包服务tfs:feed - Feed服务tfs:rm -发布管理服务tfs:治理-治理服务tfs:ems -扩展管理服务
我只找到了tfs:feed和tfs:teamfoundation的示例。
有没有用户专区?除了Azure Devops服务REST API之外,还有其他信息吗?
中的示例很少,但没有针对用户请求的示例。
可以直接在task.json中获取当前上下文发布变量或azure devops用户id吗?
这将是一个巨大的帮助。
谢谢!
发布于 2020-04-22 16:13:39
你犯了一个小小的错误。请尝试使用Release.Deployment.RequestedFor of Release.Deployment.RequestedForId,而不是Release.RequestedForId
Release.Deployment.RequestedFor文档中写道:
触发(启动)当前正在进行的部署的身份的显示名称。在TFS 2015中不可用。
示例: Mateo Escobedo
Release.Deployment.RequestedForId文档中写道:
触发(启动)当前正在进行的部署的标识的ID。在TFS 2015中不可用。
示例: 2f435d07-769f-4e46-849d-10d1ab9ba6ab
你已经写好了这个here。
https://stackoverflow.com/questions/61355520
复制相似问题