If you’re using Atlassian Crucible to do peer reviews, you may end up in a situation where you have many pending reviews not relevant anymore that you would like to close in one shot. Unlike JIRA, Crucible doesn’t offer a batch process feature, but you can use its REST API to automate this task. Here are two Windows batch that will take care of completing or closing all pending Crucible reviews in a given id range for a user.
- install the curl command line tool, from http://www.confusedbycode.com/curl/
- Ensure curl path is properly configured (try to run “curl” from a command prompt)
- create a batch file named “complete-crucible-reviews.bat” (or download it here) with the following content :
[code language=”bash”]
echo offIF “%~6″==”” GOTO help
FOR /L %%G IN (%5,1,%6) DO (
echo %4-%%G
curl -u %2:%3 %1/rest-service/reviews-v1/%4-%%G/complete -X POST -H “Content-Type:application/xml”
)GOTO end
:help
echo Completes all opened reviews for the specified user in a reviews id range
echo Usage: %0 ^^ ^ ^ ^ ^
echo Example : %0 http://crucible.mycompany.com:8060 mylogin mypassword MYPROJ 1 1000:end
[/code] - To batch-complete a set of Crucible reviews, just run the previous script with your parameters. Ex :
[code language=”bash”]
c:\complete-crucible-reviews.bat http://crucible.mycompany.com:8060 mylogin mypassword MYPROJ 1 1000
[/code] - If you wish to batch-close a set of Crucible reviews, use the following script (or download it here):
[code language=”bash”]
echo off
IF “%~6″==”” GOTO helpFOR /L %%G IN (%5,1,%6) DO (
echo %4-%%G
curl -u %2:%3 %1/rest-service/reviews-v1/%4-%%G/close -X POST -H “Content-Type:application/xml” –data “Crucible batch close”
)GOTO end
:help
echo Closes all opened reviews for the specified user in a reviews id range
echo Usage: %0 ^<crucible-url^> ^<username^> ^<password^> ^<review-prefix^> ^<first-review-id^> ^<last-review-id^>
echo Example : %0 http://crucible.mycompany.com:8060 mylogin mypassword MYPROJ 1 1000:end
[/code]