As many of you know, to get the “required” & “reported” hours of a Tempo Timesheet Team (in JIRA), don’t exists a REST Web Service interface to get these values…
But, exist and “old” “hack”-trick to do this using the mystical “CURL” (in this example case calling cull in the bash shell, running the process inside the server ).
Very easy, see this groovy example code:
def sout = new StringBuilder(), serr = new StringBuilder() //def proc = "curl -D- -u user:pass -X GET https://jira.xxxx.com/secure/TempoTeamBoard%21timesheet.jspa?team=%1".execute() //IS NOT ELEGANT SEE USER/PASS IN CODE... BETTER INSIDE A SHELL SCRIPT def proc = "/bin/jira_tempo_capture_required_team_hours.sh teamid".execute() proc.consumeProcessOutput(sout, serr) proc.waitFor(); def texto = sout.toString(); position_ini = texto.indexOf(" <th>Required</th> "); position_end = texto.indexOf(" <td class=", position_ini); //capture required team hours... planning_hours = texto.substring(position_ini+21, position_end - 5).trim(); //removing <td> and</td> int i = 4; def res = ""; while ( i < planning_hours.length() -5 ) { res = res + planning_hours[i] i++ } int resullt = res.toInteger()
One thought on “How to get the required team hours from JIRA Tempo plugin with groovy”