1

I want to copy all the Rally data (user stories, tasks, defects) from one workspace to other workspace under the same subscription.

Basically the requirement is -

Workspace A               Workspace B 
A1                        X1 
B1                        Y1 
C1                        Z1

I want to achieve something like this -

Workspace A               Workspace B 
A1                        X1 
B1                        Y1 
C1                        Z1
                          A1
                          B1
                          C1

I am looking for a solution in Ruby OR Python API which can probably do deepcopy method so that I can retain all the history.

There are solution like deepcopy app in copy - Want to copy Rally stories from one project to another but that did not help us as we want to copy the data from another workspace.

Community
  • 1
  • 1
Darshan Deshmukh
  • 353
  • 1
  • 4
  • 15

1 Answers1

0

It can be achieved via Python Rally APIs

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))

You can add all the required fields you want to copy to target workspace.

rec = { "ObjectID": rec.oid, "Name": rec.Name, "Attachments": rec.Attachments }
vpd
  • 234
  • 2
  • 10