我想将所有Rally数据(用户素材,任务,缺陷)从一个工作区复制到同一订阅下的其他工作区。
基本上要求是 -
Workspace A Workspace B
A1 X1
B1 Y1
C1 Z1
我希望实现这样的目标 -
Workspace A Workspace B
A1 X1
B1 Y1
C1 Z1
A1
B1
C1
我正在寻找Ruby或Python API的解决方案,它可能会deepcopy
方法,以便我可以保留所有历史记录。
复制中有类似深度复制应用的解决方案 - Want to copy Rally stories from one project to another 但这对我们没有帮助,因为我们想从另一个工作区复制数据。
答案 0 :(得分:0)
可以通过Python Rally API实现
import sys
from pyral import Rally, rallyWorkset
options = [arg for arg in sys.argv[1:] if arg.startswith('--')]
args = [arg for arg in sys.argv[1:] if arg not in options]
server = "rally1.rallydev.com"
apikey = "<Your API Key>"
workspace = "<Source workspace>"
project = "<Source Project>"
rally = Rally(server,apikey=apikey, workspace=workspace, project=project)
rally.enableLogging('mypyral.log')
# Fetch the data for source user story
response = rally.get('UserStory', fetch=True, query='FormattedID = US1234')
for rec in response:
# Switch to target workspace
rally.setWorkspace("<Target workspace Name>")
rally.setProject("<Target Project Name>")
print(rec.oid, rec.Name, rec.Attachments)
rec = { "ObjectID": rec.oid, "Name": rec.Name, "Attachments": rec.Attachments }
try:
userstory = rally.create('UserStory', rec)
except (RallyRESTException, ex):
sys.stderr.write('ERROR: %s \n' % details)
sys.exit(1)
print("UserStory created, ObjectID: %s FormattedID: %s" % (userstory.oid, userstory.FormattedID))
您可以将要复制的所有必填字段添加到目标工作区。
rec = { "ObjectID": rec.oid, "Name": rec.Name, "Attachments": rec.Attachments }