ALERT: Some images may not load properly within the Knowledge Base Article. If you see a broken image, please right-click and select 'Open image in a new tab'. We apologize for this inconvenience.

How to delete a changeset

book

Article ID: 57554

calendar_today

Updated On:

Products

CA Agile Central On Premise (Rally) CA Agile Central SaaS (Rally)

Issue/Introduction

Issue

A wrong artifact was referenced in the commit message and now this artifact has a? changeset associated with it. How to delete or unlink a changeset? There is no "Delete" option in the Changeset tabs of User Stories and Defects.
 

Resolution

Changesets can be created and deleted via Web Services API. There are no equivalent options in the UI. Editor rights are sufficient

In this example we create a new changeset using a curl command. It is more likely that the changeset that you would like to delete has been created by one of the CA Agile Central's source code integrations, but for the purposes of this article it makes no difference whether a changeset was created via a connector, custom app or by hitting the create endpoint directly.
In this example curl command uses Api Key for authentication.
curl --header "zsessionid:_abc123" -H "Content-Type: application/json" -d"{\"Changeset\":{\"Revision\":\"1\",\"SCMRepository\":\"/scmrepository/16953479942\",\"CommitTimestamp\":\"2014-12-17\",\"Message\":\"worked on DE4\",\"Artifacts\":{\"Artifact\":\"/defect/12365972343\"}}}" https://rally1.rallydev.com/slm/webservice/v2.0/changeset/create


Changeset is created successfully:

<Please see attached file for image>

User-added image
Now we are going to delete it. To delete a changeset we need to identify it by ObjectID. Here is an example of a WS API query:
(Message = "worked on DE4")

<Please see attached file for image>

User-added image


Now we can delete the changeset. Here is the command:
curl --header "zsessionid:_abc123" -H "Content-Type: application/json" -X DELETE https://rally1.rallydev.com/slm/webservice/v2.0/changeset/27157081517

The absence of WS API errors and curl errors indicates a success:
{"OperationResult": {"_rallyAPIMajor": "2", "_rallyAPIMinor": "0", "Errors": [],"Warnings": []}}

The changeset is gone:

<Please see attached file for image>

User-added image


Below is a Ruby code fragment example that bulk-deletes changesets returned by a query
(Message contains \"DE4\")

Warning: this code deletes data. Make sure that the query returns the changesets you intend to delete!
@rally = RallyAPI::RallyRestJson.new(config)


#find changesets that meet criteria
query = RallyAPI::RallyQuery.new()
query.type = "changeset"
query.fetch = "ObjectID,Message"
query.query_string = "(Message contains \"DE4\")"

results = @rally.find(query)
changesets_to_delete = [];
results.each do |c|
  puts "ObjectID: #{c["ObjectID"]}, Message: #{c["Message"]}"
  c.read
  changesets_to_delete << c
end

#delete changesets
changesets_to_delete.each do |c|
  puts "deleting... #{c["_ref"]}"
  c.delete
end

Here is a screenshot of Changesets to be deleted before the code is run:

<Please see attached file for image>

User-added image

and the output in the terminal as the code runs:

<Please see attached file for image>

User-added image

After the page in CA Agile Central is refreshed, the two changesets are gone:


<Please see attached file for image>

User-added image

The full code example is available in this github repo.
 

Environment

Release:
Component: ACPREM

Resolution

Please Update This Required Field

Attachments

1558695032228000057554_sktwi1f5rjvs16hzm.png get_app
1558695030342000057554_sktwi1f5rjvs16hzl.png get_app
1558695028515000057554_sktwi1f5rjvs16hzk.png get_app
1558695026790000057554_sktwi1f5rjvs16hzj.png get_app
1558695025208000057554_sktwi1f5rjvs16hzi.png get_app
1558695023325000057554_sktwi1f5rjvs16hzh.png get_app
1558695021625000057554_sktwi1f5rjvs16hzg.png get_app
1558695019752000057554_sktwi1f5rjvs16hzf.png get_app
1558695018093000057554_sktwi1f5rjvs16hze.png get_app
1558695016313000057554_sktwi1f5rjvs16hzd.png get_app
1558695014439000057554_sktwi1f5rjvs16hzc.png get_app
1558695012552000057554_sktwi1f5rjvs16hzb.png get_app