[SPARK-25287][INFRA] Add up-front check for JIRA_USERNAME and JIRA_PASSWORD

## What changes were proposed in this pull request?

Add an up-front check that `JIRA_USERNAME` and `JIRA_PASSWORD` have been set. If they haven't, ask user if they want to continue. This prevents the JIRA state update from failing at the very end of the process because user forgot to set these environment variables.

## How was this patch tested?

I ran the script with environment vars set, and unset, to verify it works as specified.

Please review http://spark.apache.org/contributing.html before opening a pull request.

Closes #22294 from erikerlandson/spark-25287.

Authored-by: Erik Erlandson <eerlands@redhat.com>
Signed-off-by: Erik Erlandson <eerlands@redhat.com>
This commit is contained in:
Erik Erlandson 2018-08-30 15:08:12 -07:00
parent d6d1224ffa
commit bb3e6ed921

View file

@ -438,6 +438,10 @@ def main():
os.chdir(SPARK_HOME)
original_head = get_current_ref()
# Check this up front to avoid failing the JIRA update at the very end
if not JIRA_USERNAME or not JIRA_PASSWORD:
continue_maybe("The env-vars JIRA_USERNAME and/or JIRA_PASSWORD are not set. Continue?")
branches = get_json("%s/branches" % GITHUB_API_BASE)
branch_names = filter(lambda x: x.startswith("branch-"), [x['name'] for x in branches])
# Assumes branch names can be sorted lexicographically