Files
spark/testing/post_to_jira.sh
T
2019-08-13 12:04:11 -04:00

35 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
function move_issue_to_sprint()
{
echo Moving issue to Sprint $1
curl -D- -u pedro.pinto+atlassian@bluetradesys.com:bodas -X PUT -d "{\"issueKeys\":[\"$1\"]}" -H "Content-Type: application/json" https://bluetradesys.atlassian.net/rest/agile/1.0/board/7/sprint/$qa_sprint_id/issues/add
}
function post_issue()
{
tmpfile=$(mktemp /tmp/post_to_jira.XXXXXX)
commit=`git show --summary | head -n 1 | awk '{print $2}'`
url="https://bitbucket.org/bluetradesys/spark/src/$commit/testing/manual/$test?at=master&fileviewer=file-view-default"
source jira_template.txt
echo pedro.pinto+atlassian@bluetradesys.com:$1
curl -D- -u pedro.pinto+atlassian@bluetradesys.com:$1 -X POST --data "$post_cmd" -H "Content-Type: application/json" https://bluetradesys.atlassian.net/rest/api/2/issue #2>/dev/null >$tmpfile
issue_id=`grep \"key\" $tmpfile | awk -F',' '{print $2}' | awk -F':' '{print $2}' | tr -d '"'`
echo "issue_id: $issue_id end_issue_id"
#move_issue_to_sprint $issue_id
}
source cycle_info.txt
# invoke with ./post_to_jira.sh <allocation_file> <ppinto_password>
# if authentication fails try to log out / log back in to jira using
# their web page
for assignment in $( cat $1); do
echo $assignment
IFS=: read -a fields <<<"$assignment"
tester=${fields[0]}
test=${fields[1]}
post_issue $2
sleep 5
done