diff --git a/docs/source/config-file.rst b/docs/source/config-file.rst index df1b08a..63e0c4f 100644 --- a/docs/source/config-file.rst +++ b/docs/source/config-file.rst @@ -12,7 +12,7 @@ The config file is made up of multiple parts 'mailing-list': 'demo_email@demo.com' -* Mailing list is used to alert users when there is a failure. A failure email with the traceback will be sent to the email address. +* Mailing list is used to alert users when there is a failure. A failure email with the traceback will be sent to the email address. .. code-block:: python @@ -75,7 +75,7 @@ The config file is made up of multiple parts 'server': 'https://some_jira_server_somewhere.com', 'verify': True, }, - 'basic_auth': ('YOU_USERNAME', 'YOUR_PASSWORD'), + 'token_auth': 'YOUR_API_TOKEN', }, }, diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index 1bb1ec1..f008152 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -1,34 +1,36 @@ Quick Start ============ -Want to quickly get started working with Sync2Jira? Follow these steps: +Want to quickly get started working with Sync2Jira? Follow these steps: 1. **First open up** :code:`fedmsg.d/sync2jira.py` 2. Enter your GitHub token which you can get `here `_ .. code-block:: python - + 'github_token': 'YOUR_TOKEN', 3. Enter relevent JIRA information .. code-block:: python - + 'default_jira_instance': 'example', + # This should be the username of the account corresponding with `token_auth` below. + 'jira_username': 'your-bot-account', 'jira': { 'example': { 'options': { 'server': 'https://some_jira_server_somewhere.com', 'verify': True, }, - 'basic_auth': ('YOU_USERNAME', 'YOUR_PASSWORD'), + 'token_auth': 'YOUR_TOKEN', }, }, - + .. note:: You might have to set verify to False 4. Add your upstream repos to the `map` section .. code-block:: python - + 'map': { 'pagure': { 'Demo_project': {'project': 'FACTORY', 'component': 'gitbz', @@ -40,7 +42,7 @@ Want to quickly get started working with Sync2Jira? Follow these steps: 'updates': [...], 'sync': [..]}, }, }, - + .. note:: You can learn more about what can go into the updates list `here `_ 5. Finally you can tweak the config files optional settings to your liking @@ -52,19 +54,19 @@ Want to quickly get started working with Sync2Jira? Follow these steps: 'initialize': True, # Don't actually make changes to JIRA... 'testing': True, - + 'filters': { 'github': { # Only sync multi-type tickets from bodhi. 'fedora-infra/bodhi': {'state': 'open', 'milestone': 4, }, }, } -6. Now that you're done with the config file you can install sync2jira and run - .. code-block:: shell +6. Now that you're done with the config file you can install sync2jira and run + .. code-block:: shell python setup.py install >> .... >> Finished processing dependencies for sync2jira==1.7 sync2jira - .. note:: You might have to add `config['validate_signatures'] = False`. + .. note:: You might have to add `config['validate_signatures'] = False`. You can find out more under the `main `_. diff --git a/fedmsg.d/sync2jira.py b/fedmsg.d/sync2jira.py index 86c1cf2..b33c9f7 100644 --- a/fedmsg.d/sync2jira.py +++ b/fedmsg.d/sync2jira.py @@ -43,13 +43,14 @@ 'legacy_matching': False, 'default_jira_instance': 'example', + 'jira_username': 'your-bot-account', 'jira': { 'example': { 'options': { 'server': 'https://some_jira_server_somewhere.com', 'verify': True, }, - 'basic_auth': ('YOU_USERNAME', 'YOUR_PASSWORD'), + 'token_auth': 'YOUR_TOKEN', }, }, diff --git a/sync2jira/downstream_issue.py b/sync2jira/downstream_issue.py index 133066e..0c75281 100644 --- a/sync2jira/downstream_issue.py +++ b/sync2jira/downstream_issue.py @@ -318,7 +318,7 @@ def find_username(issue, config): if not jira_instance: log.error("No jira_instance for issue and there is no default in the config") raise Exception - return config['sync2jira']['jira'][jira_instance]['basic_auth'][0] + return config['sync2jira']['jira_username'] def check_comments_for_duplicate(client, result, username): diff --git a/tests/integration_tests/integration_test.py b/tests/integration_tests/integration_test.py index 2f54d7e..7cb3f25 100644 --- a/tests/integration_tests/integration_test.py +++ b/tests/integration_tests/integration_test.py @@ -17,8 +17,7 @@ # Global Variables URL = os.environ['JIRA_STAGE_URL'] -USERNAME = os.environ['JIRA_USER'] -PASSWORD = os.environ['JIRA_PASS'] +TOKEN = os.environ['JIRA_TOKEN'] log = logging.getLogger(__name__) hdlr = logging.FileHandler('integration_test.log') formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s') @@ -143,7 +142,7 @@ def get_jira_client(): 'server': URL, 'verify': False, }, - 'basic_auth': (USERNAME, PASSWORD), + 'token_auth': TOKEN, }) diff --git a/tests/integration_tests/runtime_config.py b/tests/integration_tests/runtime_config.py index cc19d56..6737ada 100644 --- a/tests/integration_tests/runtime_config.py +++ b/tests/integration_tests/runtime_config.py @@ -8,10 +8,7 @@ 'server': os.environ['JIRA_STAGE_URL'], 'verify': True, }, - 'basic_auth': ( - os.environ['JIRA_USER'], - os.environ['JIRA_PASS'], - ), + 'token_auth': os.environ['JIRA_TOKEN'], }, }, 'github_token': os.environ['SYNC2JIRA_GITHUB_TOKEN'], diff --git a/tests/test_downstream_issue.py b/tests/test_downstream_issue.py index 5eceb2e..c05777a 100644 --- a/tests/test_downstream_issue.py +++ b/tests/test_downstream_issue.py @@ -29,9 +29,10 @@ def setUp(self): self.mock_config = { 'sync2jira': { 'default_jira_instance': 'another_jira_instance', + 'jira_username': 'mock_user', 'jira': { 'mock_jira_instance': {'mock_jira': 'mock_jira'}, - 'another_jira_instance': {'basic_auth': ['mock_user'], + 'another_jira_instance': {'token_auth': 'mock_token', 'options': {'server': 'mock_server'}} }, 'testing': {}, diff --git a/tests/test_downstream_pr.py b/tests/test_downstream_pr.py index 7e88273..82b6d0b 100644 --- a/tests/test_downstream_pr.py +++ b/tests/test_downstream_pr.py @@ -34,9 +34,10 @@ def setUp(self): self.mock_config = { 'sync2jira': { 'default_jira_instance': 'another_jira_instance', + 'jira_username': 'mock_user', 'jira': { 'mock_jira_instance': {'mock_jira': 'mock_jira'}, - 'another_jira_instance': {'basic_auth': ['mock_user'], + 'another_jira_instance': {'token_auth': 'mock_token', 'options': {'server': 'mock_server'}} }, 'testing': False,