需要创建Azure DevOps GitHub Artifact。我正在使用.Net客户端库,并尝试了以下代码。
var artifactMetaData = new ArtifactMetadata { Alias = "ArtiAlias", InstanceReference = new BuildVersion { Id = "32q42324QQe1" } };
我在这里引用的ID是Git Repo的提交ID。
我可以使用上面的代码成功创建Build Artifacts,但它没有创建GitHub Artifacts。
任何帮助将不胜感激。
能够使用Postman检查REST API调用,并与REST API对象相同(在请求正文中)创建ArtifactMetaData
对象。然后问题解决了。
REST API请求正文,
{
"alias": "MyRepo",
"instanceReference": {
"id": "r32283026ewec1c63b0842a58w2aa0a690a58265",
"name": "r3228302",
"sourceBranch": "feature/my-feature-branch",
"commitMessage": "My commit message"
}
}
我创建的C#对象,
var artifactMetadata = new ArtifactMetadata
{
Alias = "MyRepo",
InstanceReference = new BuildVersion
{
Id = "r32283026ewec1c63b0842a58w2aa0a690a58265",
Name = "r3228302",
SourceBranch = "feature/my-feature-branch",
CommitMessage = "My commit message"
}
};,