Created
August 25, 2015 01:01
-
-
Save anshumanbh/5ff9c4d55710c91c82bc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
unset http_proxy | |
unset https_proxy | |
virtualenv env | |
. env/bin/activate | |
export JIRA=jira.app.com | |
echo Authenticating to JIRA | |
curl -c data/cookies.txt -X POST -d @data/credentials.json -H "Content-Type: application/json" https://$JIRA/rest/auth/1/session | |
echo Creating an issue | |
issue=$(curl -b data/cookies.txt -d @data/data.json -H "Content-Type: application/json" -X POST https://$JIRA/rest/api/2/issue | grep -w key | sed 's/.*key":"//' | sed 's/",.*//') | |
echo Sending the XML and HTML reports as attachments to the JIRA ticket | |
xmlreport=`ls report*.xml` | |
htmlreport=`ls report*.html` | |
curl -b data/cookies.txt -X POST -H "X-Atlassian-Token: nocheck" -F "file=@$xmlreport" https://$JIRA/rest/api/2/issue/$issue/attachments | |
curl -b data/cookies.txt -X POST -H "X-Atlassian-Token: nocheck" -F "file=@$htmlreport" https://$JIRA/rest/api/2/issue/$issue/attachments | |
echo Destroying JIRA user session | |
curl -c data/cookies.txt -X DELETE -H "Content-Type: application/json" https://$JIRA/rest/auth/1/session |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment