[英]How to get current release context in azure devops extension api
[英]Azure Devops custom extension and current release context
使用 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 – Any micro service hosted within TFS (eg Build, Test etc.) tfs:packaging – Packaging service tfs:feed – Feed service tfs:rm – Release Management service tfs:governance - Governance service tfs:ems - Extension Management service
我找到了 tfs:feed 和 tfs:teamfoundation 的示例。
有没有供用户使用的部分? 除了 Azure Devops Services REST API 之外还有其他信息吗?
相当少的例子,但没有用户请求。
是否可以直接在 task.json 中获取当前上下文释放变量或 azure devops 用户 ID?
这将是一个巨大的帮助。
谢谢 !
你犯了一个小错误。 而不是Release.RequestedForId
请尝试Release.Deployment.RequestedFor
的Release.Deployment.RequestedForId
Release.Deployment.RequestedFor
的文档 说:
触发(启动)当前正在进行的部署的身份的显示名称。 在 TFS 2015 中不可用。
示例:马特奥·埃斯科贝多
Release.Deployment.RequestedForId
的文档说:
触发(启动)当前正在进行的部署的身份的 ID。 在 TFS 2015 中不可用。
示例:2f435d07-769f-4e46-849d-10d1ab9ba6ab
你有这个写在这里。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.