所有TFS构建定义都按名称进行过滤,并且源设置参数为null [英] all TFS build definitions filter by name and those have source settings parameters as null

查看:76
本文介绍了所有TFS构建定义都按名称进行过滤,并且源设置参数为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

$baseUrl = https://tfs.myTFS.net/tfs
$targetCollection = DefaultCollection
$targetProject = MMD

 
# Get an overview of all build definitions in this team project
$definitionsOverviewUrl = $baseUrl/$targetCollection/$targetProject/_apis/build/Definitions
$definitionsOverviewResponse = Invoke-WebRequest -UseDefaultCredentials -Uri $definitionsOverviewUrl
$definitionsOverview = (ConvertFrom-Json $definitionsOverviewResponse.Content).value
 
# Process all builds that have MMD in their name
foreach($definitionEntry in ($definitionsOverview | Where-Object { $_.name -like '*MMD_*' }))
{
    $definitionUrl = $definitionEntry.url
    $response = Invoke-WebRequest $buildDefinitionUrl -UseDefaultCredentials
    $buildDefinition = [Newtonsoft.Json.JsonConvert]::DeserializeObject($response.Content)
 
 #check whether source settings are null or not 
	if($buildDefinition.variables.source.settings)
    {
        Write-Output checking buildDefinition.variables.source.settings
		# i am not getting all build definition source setting value 
    }
	
    
}#courtesy: https://blogs.infosupport.com/modifying-tfs2015-build-definitions-using-powershell/

我有很多在TFS中构建def,我想比较一个txt文件中的所有名称与TFS中的实际存在,如果这些名称存在 

那么我想检查源设置参数是null还是还没有 进程参数为null或存在示例: - repo  drop location或任何键值是否为null,在上面的脚本中我没有得到输出中源设置的正确值我期望
分支就像功能一样\ MMD_3434\giman或者如果它为null则为空白 

I have many build def in TFS, I want to compare all names from one  txt file with actual exists in TFS  and if those are exists 
then I want to check source setting parameter is null or not also  process parameter as null or exists example:- repo  drop location or any key value is null or not, in above script I am not gettign correct value of source settings in output I expect branch like feature\MMD_3434\giman or if its null then blank 




推荐答案

您好xmangogo,

Hi xmangogo,

感谢您在此发帖。

其中您使用的TFS版本?请注意,如果您在使用TFS 2015时未指定API版本,它将默认检索vNext构建定义的信息。

Which version of TFS do you use? Please note that it will retrieve the vNext build definitions’ information as default if you don’t specify the API version when using TFS 2015.

根据您的屏幕截图,它应该是Xaml构建。

According to your screenshot, it should be Xaml build.

所以,请尝试将api版本指定为 api-version = 1.0,
它将检索Xaml构建定义信息,
如下所示:

So, please try to specify the api version as ?api-version = 1.0, it will retrieve the Xaml build definition information, something as below:

 


definitionsOverviewUrl =
definitionsOverviewUrl =


baseUrl /
baseUrl/


这篇关于所有TFS构建定义都按名称进行过滤,并且源设置参数为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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