mirror of
https://github.com/ansible/awx.git
synced 2026-01-09 15:02:07 -03:30
Allow saving github creds in user folder (#14435)
This commit is contained in:
parent
56230ba5d1
commit
8feeb5f1fa
@ -15,7 +15,7 @@ There are two methods you can use to get the next release version. The manual wa
|
||||
Log into your github account, under your user icon go to Settings => Developer Settings => Personal Access Tokens => Tokens (classic).
|
||||
Select the Generate new token => Generate new token (classic)
|
||||
Fill in the note, select no scopes select "Generate token".
|
||||
Copy the token and create a file in your awx repo called `.github_creds`. Enter the token in this file.
|
||||
Copy the token and create a file at `~/.github_creds` or in your awx repo as `.github_creds`. Enter the token in this file.
|
||||
Run `./tools/scripts/get_next_release.py`
|
||||
This will use your token to go query for the PRs in the release and scan their bodies to select X/Y/Z and suggest new versions and spit out notifications.
|
||||
|
||||
@ -149,7 +149,7 @@ Send notifications to the following groups:
|
||||
* AWX Mailing List
|
||||
* #social:ansible.com IRC (@newsbot for inclusion in bullhorn)
|
||||
* #awx:ansible.com (no @newsbot in this room)
|
||||
* #ansible-controller slack channel
|
||||
* #ansible-controller slack channel
|
||||
|
||||
These messages are templated out for you in the output of `get_next_release.yml`.
|
||||
|
||||
|
||||
@ -3,17 +3,15 @@
|
||||
missing_modules = []
|
||||
try:
|
||||
import requests
|
||||
except:
|
||||
except ImportError:
|
||||
missing_modules.append('requests')
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import time
|
||||
|
||||
try:
|
||||
import semantic_version
|
||||
except:
|
||||
except ImportError:
|
||||
missing_modules.append('semantic_version')
|
||||
|
||||
if len(missing_modules) > 0:
|
||||
@ -55,7 +53,7 @@ def getNextReleases():
|
||||
try:
|
||||
if a_pr['html_url'] in pr_votes:
|
||||
continue
|
||||
except:
|
||||
except KeyError:
|
||||
print("Unable to check on PR")
|
||||
print(json.dumps(a_pr, indent=4))
|
||||
sys.exit(255)
|
||||
@ -133,14 +131,17 @@ def getNextReleases():
|
||||
# Load the users session information
|
||||
#
|
||||
session = requests.Session()
|
||||
try:
|
||||
print("Loading credentials")
|
||||
with open(".github_creds", "r") as f:
|
||||
password = f.read().strip()
|
||||
session.headers.update({'Authorization': 'bearer {}'.format(password), 'Accept': 'application/vnd.github.v3+json'})
|
||||
except Exception:
|
||||
print("Failed to load credentials from ./.github_creds")
|
||||
sys.exit(255)
|
||||
|
||||
print("Loading credentials")
|
||||
CREDS_LOCATIONS = ('.github_creds', '~/.github_creds')
|
||||
for creds_loc in CREDS_LOCATIONS:
|
||||
if os.path.exists(os.path.expanduser(creds_loc)):
|
||||
with open(os.path.expanduser(creds_loc), "r") as f:
|
||||
password = f.read().strip()
|
||||
session.headers.update({'Authorization': 'bearer {}'.format(password), 'Accept': 'application/vnd.github.v3+json'})
|
||||
break
|
||||
else:
|
||||
raise Exception(f'Could not location github token in locations {CREDS_LOCATIONS}')
|
||||
|
||||
versions = {
|
||||
'current': {},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user