简体   繁体   English

无法在VSTS中保存/修改导入的内部版本定义

[英]Unable to save/modify imported build definition in VSTS

I am attempting to export a build from one project to another. 我正在尝试将构建从一个项目导出到另一个项目。 Projects are in different collections. 项目位于不同的集合中。 I have collection admin so perms should be good, but just to be sure I granted myself build and project admin. 我有collection admin,所以perms应该不错,但是请确保我已授予自己build和project admin。

I exported the build as json using the VSTS UI in the source project then imported in the target project. 我在源项目中使用VSTS UI将构建导出为json,然后导入到目标项目中。 All the tasks are present, but the parameters are grayed out. 存在所有任务,但参数显示为灰色。 I also cannot enable/disable tasks. 我也无法启用/禁用任务。 There are some parameters that need to be filled in such as build agent. 有一些参数需要填写,例如构建代理。 I was able to select the appropriate agent. 我能够选择合适的代理商。 I have no outstanding items at this point that the UI is indicating I would need to address prior to saving. 此时,我没有任何未完成的项目表明UI需要在保存之前解决。 The save, discard, queue options are all grayed out. 保存,丢弃,队列选项全部变灰。

I can add a new phase, but I can't add any tasks to that phase. 我可以添加一个新阶段,但是不能在该阶段添加任何任务。 I also tried bringing up the yaml and compared it to the yaml in the source project, no differences. 我还尝试提出yaml,并将其与源项目中的yaml进行比较,没有差异。

Why can't I save my imported build definition? 为什么我不能保存导入的构建定义?

Import succeeded after replacing all instances of the project and collection ids in the json I was attempting to import. 在替换我尝试导入的json中的所有项目实例和集合ID后,导入成功。 At the time of this post those changes must be completed manually. 在撰写本文时,这些更改必须手动完成。

UPDATE: 更新:

I tried just removing the offending properties rather than replacing them and that worked. 我尝试仅删除有问题的属性,而不是替换它们,这确实可行。 I created a simple script to clear out those properties: 我创建了一个简单的脚本来清除这些属性:

Param(
[parameter(Mandatory=$true)]
[alias("p")]
$path
)

$removeProperties = @("triggers","metrics","_links","authoredBy","queue","project")
$json = Get-Content -Path $path -Raw | ConvertFrom-Json

foreach ($property in $removeProperties) {
  $json.PSObject.Properties.Remove($property)
}

$json | ConvertTo-Json -Depth 100 | Set-Content -Path $path -Force

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM