Repository: yetus
Updated Branches:
  refs/heads/master ad2f57f08 -> 8829c2b41


YETUS-592. default user names based on project

Signed-off-by: stack <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/yetus/repo
Commit: http://git-wip-us.apache.org/repos/asf/yetus/commit/8829c2b4
Tree: http://git-wip-us.apache.org/repos/asf/yetus/tree/8829c2b4
Diff: http://git-wip-us.apache.org/repos/asf/yetus/diff/8829c2b4

Branch: refs/heads/master
Commit: 8829c2b410a4fcee610d63dd213f7270f2347b69
Parents: ad2f57f
Author: Allen Wittenauer <[email protected]>
Authored: Mon Dec 4 13:13:37 2017 -0800
Committer: Allen Wittenauer <[email protected]>
Committed: Tue Jan 16 12:42:57 2018 -0800

----------------------------------------------------------------------
 .../in-progress/precommit-bugsystems.md            |  6 ++++++
 precommit/test-patch.d/github.sh                   | 14 +++++++++++++-
 precommit/test-patch.d/jira.sh                     | 17 +++++++++++++++--
 3 files changed, 34 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/yetus/blob/8829c2b4/asf-site-src/source/documentation/in-progress/precommit-bugsystems.md
----------------------------------------------------------------------
diff --git 
a/asf-site-src/source/documentation/in-progress/precommit-bugsystems.md 
b/asf-site-src/source/documentation/in-progress/precommit-bugsystems.md
index 95bf1de..b298f8b 100644
--- a/asf-site-src/source/documentation/in-progress/precommit-bugsystems.md
+++ b/asf-site-src/source/documentation/in-progress/precommit-bugsystems.md
@@ -76,6 +76,9 @@ In order to comment on issues or, depending upon the security 
setup of the repo,
 
   * Username/password: `--github-user`/ GITHUB\_USER , `--github-password` / 
GITHUB\_PASSWD
 
+The default value for  GITHUB\_USER is the value of `--project` suffixed with 
QA.  For example,
+`--project=yetus` will set `GITHUB_USER=yetusqa`.
+
 Pull requests that are made off of a specific branch will switch the test repo 
to that branch, if permitted.  If the pull request references a JIRA issue that 
matches the given JIRA issue regexp in the Subject, the JIRA plug-in will also 
be invoked as needed.
 
 # JIRA Specific
@@ -85,3 +88,6 @@ JIRA support allows both patch downloads and summary writes.  
It also supports b
 JIRA issues are invoked by matching the command line option to a specific 
regular expression as given by the `--jira-issue-re` option or via the 
JIRA\_ISSUE\_RE personality variable.  By default, the plug-in uses 
https://issues.apache.org/jira as the JIRA instance to use.  However that may 
be overwritten via the `--jira-base-url` option or personalities may define via 
JIRA\_URL.
 
 In order to write information on the issue, JIRA requires username and 
password authentication using the `--jira-user`/`--jira-password` options or 
the JIRA\_USER and JIRA\_PASSWORD variables in a personality.
+
+The default value for JIRA\_USER is the value of `--project` suffixed with QA. 
 For example,
+`--project=yetus` will set `JIRA_USER=yetusqa`.
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/yetus/blob/8829c2b4/precommit/test-patch.d/github.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/github.sh b/precommit/test-patch.d/github.sh
index 18a0851..f2c2d10 100755
--- a/precommit/test-patch.d/github.sh
+++ b/precommit/test-patch.d/github.sh
@@ -42,20 +42,32 @@ GITHUB_ISSUE=""
 GITHUB_BRIDGED=false
 GITHUB_COMMITSHA=""
 
+# Simple function to set a default GitHub user after PROJECT_NAME has been set
+function github_set_github_user
+{
+  if [[ -n "${PROJECT_NAME}" && ! "${PROJECT_NAME}" = unknown ]]; then
+    GITHUB_USER=${GITHUB_USER:-"${PROJECT_NAME}qa"}
+  fi
+}
+
 function github_usage
 {
+  github_set_github_user
+
   yetus_add_option "--github-api-url=<url>" "The URL of the API for github 
(default: '${GITHUB_API_URL}')"
   yetus_add_option "--github-base-url=<url>" "The URL of the github server 
(default:'${GITHUB_BASE_URL}')"
   yetus_add_option "--github-password=<pw>" "Github password"
   yetus_add_option "--github-repo=<repo>" "github repo to use 
(default:'${GITHUB_REPO}')"
   yetus_add_option "--github-token=<token>" "The token to use to write to 
github"
-  yetus_add_option "--github-user=<user>" "Github user"
+  yetus_add_option "--github-user=<user>" "Github user [default: 
${GITHUB_USER}]"
 }
 
 function github_parse_args
 {
   declare i
 
+  github_set_github_user
+
   for i in "$@"; do
     case ${i} in
       --github-api-url=*)

http://git-wip-us.apache.org/repos/asf/yetus/blob/8829c2b4/precommit/test-patch.d/jira.sh
----------------------------------------------------------------------
diff --git a/precommit/test-patch.d/jira.sh b/precommit/test-patch.d/jira.sh
index aaeb714..e107cb5 100755
--- a/precommit/test-patch.d/jira.sh
+++ b/precommit/test-patch.d/jira.sh
@@ -31,19 +31,32 @@ JIRA_STATUS_RE='Patch Available'
 
 add_bugsystem jira
 
+# Simple function to set a default JIRA user after PROJECT_NAME has been set
+function jira_set_jira_user
+{
+  if [[ -n "${PROJECT_NAME}" && ! "${PROJECT_NAME}" = unknown ]]; then
+    JIRA_USER=${JIRA_USER:-"${PROJECT_NAME}qa"}
+  fi
+}
+
 function jira_usage
 {
+
+  jira_set_jira_user
+
   yetus_add_option "--jira-base-url=<url>" "The URL of the JIRA server 
(default:'${JIRA_URL}')"
   yetus_add_option "--jira-issue-re=<expr>" "Bash regular expression to use 
when trying to find a jira ref in the patch name (default: '${JIRA_ISSUE_RE}')"
-  yetus_add_option "--jira-password=<pw>" "The password for the 'jira' command"
+  yetus_add_option "--jira-password=<pw>" "The password for accessing JIRA"
   yetus_add_option "--jira-status-re=<expr>" "Grep regular expression 
representing the issue status whose patch is applicable to the codebase 
(default: '${JIRA_STATUS_RE}')"
-  yetus_add_option "--jira-user=<user>" "The user for the 'jira' command"
+  yetus_add_option "--jira-user=<user>" "The user to access JIRA command 
(default: ${JIRA_USER})"
 }
 
 function jira_parse_args
 {
   declare i
 
+  jira_set_jira_user
+
   for i in "$@"; do
     case ${i} in
       --jira-base-url=*)

Reply via email to