Repository: yetus Updated Branches: refs/heads/master 0c2f54ade -> d73c0e17c
YETUS-442. JIRA plugin will not fallback to normal patch if it fails to find a github pull Signed-off-by: Allen Wittenauer <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/d73c0e17 Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/d73c0e17 Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/d73c0e17 Branch: refs/heads/master Commit: d73c0e17ce8fd9e773c8a5b69536de41eeea7bba Parents: 0c2f54a Author: Casey J. Brotherton <[email protected]> Authored: Sat Aug 20 23:24:53 2016 -0500 Committer: Allen Wittenauer <[email protected]> Committed: Wed Aug 24 08:55:34 2016 -0700 ---------------------------------------------------------------------- precommit/test-patch.d/github.sh | 1 + precommit/test-patch.d/jira.sh | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/d73c0e17/precommit/test-patch.d/github.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/github.sh b/precommit/test-patch.d/github.sh index b4f5aa0..e4b1163 100755 --- a/precommit/test-patch.d/github.sh +++ b/precommit/test-patch.d/github.sh @@ -91,6 +91,7 @@ function github_jira_bridge # the JIRA issue has already been downloaded. So let's find the URL. # shellcheck disable=SC2016 urlfromjira=$(${AWK} "match(\$0,\"${GITHUB_BASE_URL}/[^ ]*patch\"){print substr(\$0,RSTART,RLENGTH)}" "${PATCH_DIR}/jira" | tail -1) + yetus_debug "github_jira_bridge: Checking url ${urlfromjira}" github_breakup_url "${urlfromjira}" github_locate_patch "${GITHUB_ISSUE}" "${fileloc}" } http://git-wip-us.apache.org/repos/asf/yetus/blob/d73c0e17/precommit/test-patch.d/jira.sh ---------------------------------------------------------------------- diff --git a/precommit/test-patch.d/jira.sh b/precommit/test-patch.d/jira.sh index 7da9280..37024e8 100755 --- a/precommit/test-patch.d/jira.sh +++ b/precommit/test-patch.d/jira.sh @@ -133,14 +133,21 @@ function jira_locate_patch fi # if github is configured and we see what looks like a URL, - # send this to the github plugin to process. + # check the github plugin to see if the URL is a patch or pull request + # before continuing further if [[ -n "${GITHUB_BASE_URL}" && $(${GREP} -c "${GITHUB_BASE_URL}"'[^ ]*patch' "${PATCH_DIR}/jira") != 0 ]]; then jira_determine_issue "${input}" - echo "${input} appears to be a Github PR. Switching Modes." github_jira_bridge "${fileloc}" - return $? - elif [[ $(${GREP} -c "${JIRA_STATUS_RE}" "${PATCH_DIR}/jira") == 0 ]]; then + if [[ $? -eq 0 ]]; then + echo "${input} appears to be a Github PR. Switching Modes." + return 0 + fi + yetus_debug "jira_locate_patch: ${input} seemed like a Github PR, but there was a failure." + fi + + # Not reached if there is a successful github plugin return + if [[ $(${GREP} -c "${JIRA_STATUS_RE}" "${PATCH_DIR}/jira") == 0 ]]; then if [[ ${ROBOT} == true ]]; then yetus_error "ERROR: ${input} issue status is not matched with \"${JIRA_STATUS_RE}\"." cleanup_and_exit 1
