mirror of
https://github.com/corda/corda.git
synced 2024-12-19 21:17:58 +00:00
NOTICK - Allow JIRA user name to be provided in an environment variable (#4202)
This commit is contained in:
parent
d4474e87e1
commit
7c4eaf2f01
@ -58,7 +58,9 @@ This will create a new sub-task under each of the test tickets for `<PRODUCT>` `
|
||||
|
||||
## Options
|
||||
|
||||
Each command described above has a set of additional options. More specifically, if you want to use a particular JIRA user instead of being prompted for a user name every time, you can specify `--user <USER>`. For verbose logging, you can supply `--verbose` or `-v`. And to auto-reply to the prompt of whether to proceed or not, provide `--yes` or `-y`.
|
||||
Each command described above has a set of additional options. More specifically, if you want to use a particular JIRA user instead of being prompted for a user name every time, you can specify `--user <USER>`. You can also provide the user name in the environment variable, `JIRA_USER`.
|
||||
|
||||
For verbose logging, you can supply `--verbose` or `-v`. And to auto-reply to the prompt of whether to proceed or not, provide `--yes` or `-y`.
|
||||
|
||||
There is also a useful dry-run option, `--dry-run` or `-d`, that lets you run through the command without creating any tickets or applying any changes to JIRA.
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
# {{{ Dependencies
|
||||
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import sys, os
|
||||
|
||||
try:
|
||||
from getpass import getpass
|
||||
@ -41,9 +41,13 @@ def confirm(message, auto_yes=False):
|
||||
# {{{ login(account, user, password, use_keyring) - Present user with login prompt and return the provided username and password. If use_keyring is true, use previously provided password (if any)
|
||||
def login(account, user=None, password=None, use_keyring=True):
|
||||
if not user:
|
||||
user = prompt('Username: ')
|
||||
user = u'{}@r3.com'.format(user) if '@' not in user else user
|
||||
if not user: return (None, None)
|
||||
if 'JIRA_USER' not in os.environ:
|
||||
user = prompt('Username: ')
|
||||
user = u'{}@r3.com'.format(user) if '@' not in user else user
|
||||
if not user: return (None, None)
|
||||
else:
|
||||
user = os.environ['JIRA_USER']
|
||||
print('Username: {}'.format(user))
|
||||
else:
|
||||
user = u'{}@r3.com'.format(user) if '@' not in user else user
|
||||
print('Username: {}'.format(user))
|
||||
|
@ -16,10 +16,10 @@ try:
|
||||
def red(message): return colored(message, 'red')
|
||||
def yellow(message): return colored(message, 'yellow')
|
||||
def faint(message): return colored(message, 'white', attrs=['dark'])
|
||||
def on_green(message): return colored(message, 'white', 'on_green')
|
||||
def on_red(message): return colored(message, 'white', 'on_red')
|
||||
def blue_on_white(message): return colored(message, 'blue', 'on_white')
|
||||
def yellow_on_white(message): return colored(message, 'yellow', 'on_white')
|
||||
def on_green(message): return colored(message, 'green')
|
||||
def on_red(message): return colored(message, 'red')
|
||||
def blue_on_white(message): return colored(message, 'blue')
|
||||
def yellow_on_white(message): return colored(message, 'yellow')
|
||||
except:
|
||||
def blue(message): return u'[{}]'.format(message)
|
||||
def green(message): return message
|
||||
@ -159,7 +159,10 @@ def create_version(args):
|
||||
jira.jira.create_version(name=version, project=project, description=version)
|
||||
print(u' {} - Created version for project {}'.format(green('SUCCESS'), blue(project)))
|
||||
except Exception as error:
|
||||
print(u' {} - Failed to version: {}'.format(red('FAIL'), error))
|
||||
if args.verbose:
|
||||
print(u' {} - Failed to version: {}'.format(red('FAIL'), error))
|
||||
else:
|
||||
print(u' {} - Failed to version: {}'.format(red('FAIL'), error.text))
|
||||
print()
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user