Created
November 14, 2017 20:56
-
-
Save askb/e72c21c944524b0e5db33e5dbce418cb to your computer and use it in GitHub Desktop.
exit: : numeric argument required
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 -x | |
function bugid_to_jira_task() { | |
local jira_url="${1}" | |
local project="${2}" | |
local bug_id="${3}" | |
local resp=$(curl -sS --stderr -w {%http_code} --H "Accept: application/json" "${jira_url}/rest/api/2/search\?jql\=project\=${project}%20and%20\\"External%20issue%20ID\\"\~${bug_id}") | |
echo "$resp" | |
local issue_id=$(echo "$resp"| jq -r '.issues[].key') | |
echo "$issue_id" | |
local status=$(echo "$resp" | awk 'END {print $NF}') | |
if [ "$status" != "201" ]; then | |
echo "ERROR: Failed to run. Aborting..." | |
echo "$resp" | |
exit "$status" | |
fi | |
return $? | |
} | |
JIRA_URL="https://jira.opendaylight.org" | |
buglist=("9228", "2942") | |
buglist=(${buglist//,/ }) | |
projectlist=("odlparent", "controller") | |
projectlist=(${projectlist//,/ }) | |
if hash parallel 2>/dev/null; then | |
export -f bugid_to_jira_task | |
parallel --verbose -vv --jobs 200% --xapply "bugid_to_jira_task ${JIRA_URL} {1} {2}" ::: ${projectlist[*]} ::: ${buglist[*]} | |
fi |
Author
askb
commented
Nov 15, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment