从正在运行的VSTS扩展中提取当前帐户和项目名称 [英] Extract current account and project name from within a running VSTS extension

查看:94
本文介绍了从正在运行的VSTS扩展中提取当前帐户和项目名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,


我需要从使用PowerShell实现的正在运行的VSTS扩展中提取有关VSTS中先前成功构建的一些信息。 Rest API听起来像我应该开始的地方:


https://www.visualstudio.com/en-us/docs/integrate/api/build/builds


我发现所有API调用都需要服务帐户名称,例如fabrikam.visualstudio.com和项目名称,例如"我的项目"。 


有没有办法让VSTS扩展从当前运行的构建中提取这些值?我需要从最近成功的构建中获得一些结果,以便进行一些比较并在屏幕上报告它们。


当扩展程序正在运行时,visualstudio.com中的当前URL可以看起来如下所示:


https://apicasystem.visualstudio.com/My%20First%20Project/_build/index?buildId=49&_a=summary


此URL包含我需要的所有内容:帐户名称,项目名称和当前内部版本号。  扩展程序在执行期间是否有办法获取此URL?


此外,我还需要对API调用进行身份验证,因此扩展程序可以获取当前登录的用户?我希望用户能够轻松使用扩展,而不是要求"明显"的参数。并且很容易像帐户名一样检索


欢迎提出任何指示。


感谢您的帮助,


Andras

解决方案


<感谢您在此处发帖。


我会要求您在研究时通过以下链接,并尽快回复您。


https://www.visualstudio.com/en -us / docs / integrate / extensions / develop / add-build-task


问候,


Hello,

I need to extract some information about the previous successful build in VSTS from within a running VSTS extension implemented with PowerShell. The Rest API sounds like the place where I should start:

https://www.visualstudio.com/en-us/docs/integrate/api/build/builds

I see that all API calls need the service account name, such as fabrikam.visualstudio.com and the project name like "My project". 

Is there a way for a VSTS extension to extract these values from the currently running build? I need to get some results from the most recent successful build in order to make some comparisons and report them on the screen.

While the extension is running the current URL in visualstudio.com can look like the following:

https://apicasystem.visualstudio.com/My%20First%20Project/_build/index?buildId=49&_a=summary

This URL contains pretty much everything I need: the account name, the project name and the current build number.  Is there a way for the extension to get to this URL during execution?

Also, I'll need to authenticate the API call, so can the extension get hold of the identity of the currently logged on user? I want to make it easy for the user to use the extension and not ask for parameters that should be "obvious" and easy to retrieve like the account name.

Any pointers are welcome.

Thanks for your help,

Andras

解决方案

Hi,

Thanks for posting here.

I would request you to go through the below link mean while am researching on it and get back to you soon with an update.

https://www.visualstudio.com/en-us/docs/integrate/extensions/develop/add-build-task

Regards,


这篇关于从正在运行的VSTS扩展中提取当前帐户和项目名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆