HADOOP-12336. github_jira_bridge doesn't work (Kengo Seki)
Project: http://git-wip-us.apache.org/repos/asf/yetus/repo Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/30d8e147 Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/30d8e147 Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/30d8e147 Branch: refs/heads/master Commit: 30d8e1473ee412977d2a15a2fe7e5c63599a05b1 Parents: 3ee8491 Author: Allen Wittenauer <[email protected]> Authored: Wed Sep 2 18:06:10 2015 -0700 Committer: Allen Wittenauer <[email protected]> Committed: Wed Sep 2 18:06:10 2015 -0700 ---------------------------------------------------------------------- dev-support/test-patch.d/github.sh | 7 ++----- dev-support/test-patch.d/jira.sh | 8 +++++++- 2 files changed, 9 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/yetus/blob/30d8e147/dev-support/test-patch.d/github.sh ---------------------------------------------------------------------- diff --git a/dev-support/test-patch.d/github.sh b/dev-support/test-patch.d/github.sh index 36c7e51..f742062 100755 --- a/dev-support/test-patch.d/github.sh +++ b/dev-support/test-patch.d/github.sh @@ -89,12 +89,9 @@ function github_jira_bridge # we use this to prevent loops later on GITHUB_BRIDGED=true - # the JIRA issue has already been downloaded. So let's - # find the URL. This is currently hard-coded to github.com - # Sorry Github Enterprise users. :( - + # the JIRA issue has already been downloaded. So let's find the URL. # shellcheck disable=SC2016 - urlfromjira=$(${AWK} 'match($0,"https://github.com/.*patch"){print $1}' "${PATCH_DIR}/jira" | tail -1) + urlfromjira=$(${AWK} "match(\$0,\"${GITHUB_BASE_URL}/[^ ]*patch\"){print substr(\$0,RSTART,RLENGTH)}" "${PATCH_DIR}/jira" | tail -1) github_breakup_url "${urlfromjira}" github_locate_patch "${GITHUB_ISSUE}" "${fileloc}" } http://git-wip-us.apache.org/repos/asf/yetus/blob/30d8e147/dev-support/test-patch.d/jira.sh ---------------------------------------------------------------------- diff --git a/dev-support/test-patch.d/jira.sh b/dev-support/test-patch.d/jira.sh index ca9f2bd..fc649e7 100755 --- a/dev-support/test-patch.d/jira.sh +++ b/dev-support/test-patch.d/jira.sh @@ -64,15 +64,20 @@ function jira_determine_issue declare patchnamechunk declare maybeissue + if [[ -n ${JIRA_ISSUE} ]]; then + return 0 + fi + # shellcheck disable=SC2016 patchnamechunk=$(echo "${input}" | ${AWK} -F/ '{print $NF}') maybeissue=$(echo "${patchnamechunk}" | cut -f1,2 -d-) if [[ ${maybeissue} =~ ${JIRA_ISSUE_RE} ]]; then + # shellcheck disable=SC2034 ISSUE=${maybeissue} JIRA_ISSUE=${maybeissue} - add_footer_table "JIRA Issue" "${ISSUE}" + add_footer_table "JIRA Issue" "${JIRA_ISSUE}" return 0 fi @@ -123,6 +128,7 @@ function jira_locate_patch # send this to the github plugin to process. 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 $?
