Rally Python API将变更集关联到工件

时间:2014-05-23 15:00:03

标签: python api rally

我试图通过使用Rally提供的python api将我创建的虚拟变更集关联到现有工件。

请参阅以下代码,任何帮助表示赞赏!

由于

user = rally.getUserInfo(name='Dummy Name').pop(0)

artifactName = "FirstDefect"
artifact = rally.get('Artifact', query='Name = %s' % artifactName, instance=True)


#print artifact.details()
changeset_fields = {
    "Name"              : "Testing Python API - test3",
    "Message"           : "Generating a change set",
    "Author"            :   user.ref,
    "SCMRepository"     : "https://rally1.rallydev.com/slm/webservice/v2.0/scmrepository/19191682647",
    "Revision"          :   "4",
    "CommitTimestamp"   : "2014-05-23T9:15Z",
    "Artifacts"         : artifact.ref
}

try:
    rally.put('Changeset', changeset_fields)
except Exception, details:
    sys.stderr.write('ERROR: %s \n' % details)
    sys.exit(1)

1 个答案:

答案 0 :(得分:0)

我没有特定于python的示例,但这里是浏览器REST客户端中创建变更集的有效负载:

{"changeset":{
    "Message":"1234 abcd",
    "Artifacts":{"Artifact":"/defect/14537223513"},
    "SCMRepository":"/scmrepository/5960544988",
    "Revision":"1",
    "CommitTimestamp":"2013-10-08"
}}

请注意这个结论:

"Artifacts":{"Artifact":"/defect/14537223513"}