I have over 1000 reviews in draft. I need to clean the reviews database in some smart way. How to delete reviews from Crucible??
Is it possible form GUI or do I have to do it on a database?
HOW?
Thanks in advance,
Blazej
Hi Blazej,
In this case you could delete review using crucible's REST API. Here's an example using curl command line you can try:
curl -u <username>:<password> http://localhost:8060/fisheye/rest-service/reviews-v1/<reviewID> -X DELETE -H "Content-Type:application/xml"
Replace the username, password, host url, reviewID accordingly. You can consult more information about reviews structure at crucible's database inside table cru_review. Also this procedure deletes one review so you can create a script to run it against more that one review to automati the process.
Also this procedure delete one review so you can create a script to run
it against more that one review to automati the process.
Cheers,
Leonardo.
Hi Leonardo,
Thanks for your answer. I tested the REST API method you mentioned. However, it seems that all the reviews must be put in Abandoned state beforehand. (which was quite an astonishing discovery...)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <error><code>IllegalArgument</code> <message> The review PermId:CR-5113 in the Draft is not deletable. </message> <stacktrace> java.lang.IllegalArgumentException: The review PermId:CR-5113 in the Draft is not deletable. at com.atlassian.crucible.spi.impl.DefaultReviewService.deleteReview(DefaultReviewService.java:1679)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ... </stacktrace> </error>
/rest-service/reviews-v1/{id}/transition
?action:deleteReview
The description I took from here is inconsitent with way this option should be executed:
/rest-service/reviews-v1/{id}/transition
?
action=
action:deleteReview
I think you should correct the description here.
I found the proper way of doing it here:
curl -k -u login:pass http://myCrucibleHost/rest-service/reviews-v1/CR-5113/transition?action=action:deleteReview -X POST -H "Content-Type:application/xml"
Performing the aciton both ways on an abandoned review works fine:
curl -k -u login:pass http://myCrucibleHost/rest-service/reviews-v1/CR-4894 -X DELETE -H "Content-Type:application/xml"
Best regards,
Blazej
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Leonardo,
I am still having issues with this.
As I am trying to change the state of a review to abandoned with:
curl -k -u user:pass "http://myCrucibleHost/rest-service/reviews-v1/CR-2197/transition?action=action:abandonReview" -X POST -H "Content-Type:application/xml" <?xml version="1.0" encoding="UTF-8" standalone="yes"?><error> <code>Authorization</code> <message> Crucible unauthorised action. </message><stacktrace>com.atlassian.crucible.spi.services.AuthorizationException: Crucible unauthorised action. at com.cenqua.crucible.model.managers.impl.DefaultReviewManager.changeState(DefaultReviewManager.java:967) at com.atlassian.crucible.spi.impl.DefaultReviewService$27.doInTransaction(DefaultReviewService.java:1703) at com.atlassian.crucible.spi.impl.DefaultReviewService$27.doInTransaction(DefaultReviewService.java:1694) at com.atlassian.fisheye.spi.impl.DefaultTxTemplate.execute(DefaultTxTemplate.java:123) at sun.reflect.GeneratedMethodAccessor1236.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source)
I am using administrator rights and still get this error.
How to be able to abandon a review??
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try the Crucible CLI (see other answer) and use -v to see what it is doing under the covers. I remember it being a royal pain for doing something one would think as being simple.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Blazej,
Here's some ideas that could help you:
1. Take a look into this and see a workaround which actually worked.
2. Make sure your users have permission to ABANDON reviews inside Crucible ADMIN at Permission Scheme and then try again.
3. Try to summarize and then delete:
curl -v -d "" -u youruser:pwd -H "Content-Type: application/xml" http://myCrucible/crucible/rest-service/reviews-v1/CR-2197/transition?action=action:summarizeReview curl -v -d "" -u youruser:pwd -H "Content-Type: application/xml" http://myCrucible/crucible/rest-service/reviews-v1/CR-2197/transition?action=action:closeReview
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
deleteReview action from the Crucible Command Line Interface can be used in combination with runFromSql to select the reviews you want to remove from the Crucible database. The deleteReview action makes sure the review is in the appropriate state to delete before running the delete (under the covers, the delete is done using the rest api like in Leonardo's answer).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Blazej,
It's possible to delete reviews from GUI. Please refer to this article to know how. I hope this can help you.
Cheers,
Leonardo.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Leonardo,
Thanks for quick answer - I knew about that option, however I'd like to make a massive delete of over one thousand reviews in draft mode. I really don't like to do it on a one-by-one basis.
How to delete all draft reviews with single operation? sql query? script?
Regards,
Blazej
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.