Skip to content

Commit

Permalink
Remove references to basic_auth
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphbean committed Dec 17, 2021
1 parent 6ce07da commit 13b80c1
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 24 deletions.
4 changes: 2 additions & 2 deletions docs/source/config-file.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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',
},
},
Expand Down
24 changes: 13 additions & 11 deletions docs/source/quickstart.rst
Original file line number Diff line number Diff line change
@@ -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 <https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line>`_
.. 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',
Expand All @@ -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 <config-file.html>`_

5. Finally you can tweak the config files optional settings to your liking
Expand All @@ -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 <main.html#main-anchor>`_.
3 changes: 2 additions & 1 deletion fedmsg.d/sync2jira.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
},

Expand Down
2 changes: 1 addition & 1 deletion sync2jira/downstream_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
5 changes: 2 additions & 3 deletions tests/integration_tests/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -143,7 +142,7 @@ def get_jira_client():
'server': URL,
'verify': False,
},
'basic_auth': (USERNAME, PASSWORD),
'token_auth': TOKEN,
})


Expand Down
5 changes: 1 addition & 4 deletions tests/integration_tests/runtime_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
3 changes: 2 additions & 1 deletion tests/test_downstream_issue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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': {},
Expand Down
3 changes: 2 additions & 1 deletion tests/test_downstream_pr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 13b80c1

Please sign in to comment.