Users with admin privileges can delete data associated with a single project. The following data is removed:

  • All builds associated with the project. This consists of all builds that have at least one run that uses a run configuration associated with the project.
  • All run configurations associated with the project.
  • All prioritization data for violations that existed in the deleted runs. If a violation is found in a run that is later sent to DTP, default values for assignee, priority, action, risk/impact, due date, and reference number will be assigned to the violation.

The following is not deleted:

Enabling Project Deletion

The ability to delete a project is disabled by default. Open the <DTP_INSTALL>/bin/variables file and add the following command to JAVA_CONFIG_ARGS  (Linux) or DTP_JAVA_OPTS (Windows) to enable project deletion:

com.parasoft.sdm.storage.managers.admin.enable.delete.project.data=true

Deleting Data

This functionality is enabled via a DTP HTTP endpoint. You must have admin access to delete project data (see Configuring User Permissions and Groups). 

  1. Stop Data Collector (see Stopping DTP Services) to prevent new data from potentially being sent to the project.
  2. Make a POST request to the following endpoint to begin deleting data for the project:
    /grs/api/v1.5/admin/projects/deleteData
    This endpoint takes a JSON request payload in the following format: 

    {
        "project": "BasicProjectCleanup"
    }

    The request must have the header Content-Type: application/json, otherwise the server will reject the request.

    Example cURL command
    curl -u your_username:your_password -X POST -H 'Content-Type: application/json' -d '{"project":"Your Project"}' http://server_name:8080/grs/api/v1.5/admin/projects/deleteData
  3. The endpoint immediately returns information about the progress. The following is a sample response:

    Cleanup job id: 33
    Description: Deleting data for project: BasicProjectCleanup
    State: IN_PROGRESS
    Current status: Deleting data for project 'BasicProjectCleanup': starting.
    Last status update: 2017-06-27T11:40:08.645
    
    Log:
    
    2017-06-27T11:40:08.645 | Starting: Deleting data for project: BasicProjectCleanup
    2017-06-27T11:40:08.645 | Deleting data for project 'BasicProjectCleanup': starting. 

    The response is intended to be human-readable, but the format may change in future DTP releases. If a request to delete project data (or to delete a build) is already in progress, an error message will be returned as the response. You will need to try again later when other data is not being deleted.

    How Long Does it Take to Delete Project Data?

    The total time required to delete the project data depends on the number of builds, runs per build, and the size of data sent in each run. A project with 100 builds may take less than one minute; for other projects with the same number of builds, deleting the data may take 1 hour.

Monitoring the Request Status

You can make a GET request to the following endpoint to check the status of your project data deletion request: 

/grs/api/v1.5/admin/cleanupStatus

A job is finished when the response shows State: COMPLETED

Example Response
Cleanup job id: 33
Description: Deleting data for project: BasicProjectCleanup
State: COMPLETED
Current status: Deleting data done (successful) for project: BasicProjectCleanup
Last status update: 2017-06-27T11:40:08.889

Log:

2017-06-27T11:40:08.645 | Starting: Deleting data for project: BasicProjectCleanup
2017-06-27T11:40:08.645 | Deleting data for project 'BasicProjectCleanup': starting.
2017-06-27T11:40:08.678 | Deleting data for project 'BasicProjectCleanup'.  There are 2 builds to delete.
2017-06-27T11:40:08.678 | Deleting data for project 'BasicProjectCleanup'.  Deleting build [1/2]: 'BasicProjectCleanup-2' (build date 2017-03-04T22:00:00Z): starting.
2017-06-27T11:40:08.818 | Deleting data for project 'BasicProjectCleanup'.  Deleting build [1/2]: 'BasicProjectCleanup-2' (build date 2017-03-04T22:00:00Z): done.
2017-06-27T11:40:08.818 | Deleting data for project 'BasicProjectCleanup'.  Deleting build [2/2]: 'BasicProjectCleanup-1' (build date 2017-03-03T22:00:00Z): starting.
2017-06-27T11:40:08.886 | Deleting data for project 'BasicProjectCleanup'.  Deleting build [2/2]: 'BasicProjectCleanup-1' (build date 2017-03-03T22:00:00Z): done.
2017-06-27T11:40:08.889 | Deleting data for project 'BasicProjectCleanup'.  Deleted 1 run configuration(s).
2017-06-27T11:40:08.889 | Deleting data done (successful) for project: BasicProjectCleanup 

Each request is assigned a Cleanup job id, which  allows you to correlate the status with the call you made to delete the project data. When the data is deleted, the response will continue to show State: COMPLETED until a new request to delete a build or different project data is made. When the next request is made, it will be assigned a new job id.

Cancelling a Request Already in Progress

Make a POST request to the following endpoint to cancel a request to delete project data:

POST /grs/api/v1.5/admin/projects/cancelDataDeletion

You do not need to include a request payload. The job will stop as soon as the build currently being deleted is finsihed.

  • No labels