mirror of
https://github.com/ansible/awx.git
synced 2026-03-03 09:48:51 -03:30
Allow saving github creds in user folder (#14435)
This commit is contained in:
@@ -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).
|
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)
|
Select the Generate new token => Generate new token (classic)
|
||||||
Fill in the note, select no scopes select "Generate token".
|
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`
|
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.
|
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
|
* AWX Mailing List
|
||||||
* #social:ansible.com IRC (@newsbot for inclusion in bullhorn)
|
* #social:ansible.com IRC (@newsbot for inclusion in bullhorn)
|
||||||
* #awx:ansible.com (no @newsbot in this room)
|
* #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`.
|
These messages are templated out for you in the output of `get_next_release.yml`.
|
||||||
|
|
||||||
|
|||||||
@@ -3,17 +3,15 @@
|
|||||||
missing_modules = []
|
missing_modules = []
|
||||||
try:
|
try:
|
||||||
import requests
|
import requests
|
||||||
except:
|
except ImportError:
|
||||||
missing_modules.append('requests')
|
missing_modules.append('requests')
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
|
||||||
import sys
|
import sys
|
||||||
import time
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import semantic_version
|
import semantic_version
|
||||||
except:
|
except ImportError:
|
||||||
missing_modules.append('semantic_version')
|
missing_modules.append('semantic_version')
|
||||||
|
|
||||||
if len(missing_modules) > 0:
|
if len(missing_modules) > 0:
|
||||||
@@ -55,7 +53,7 @@ def getNextReleases():
|
|||||||
try:
|
try:
|
||||||
if a_pr['html_url'] in pr_votes:
|
if a_pr['html_url'] in pr_votes:
|
||||||
continue
|
continue
|
||||||
except:
|
except KeyError:
|
||||||
print("Unable to check on PR")
|
print("Unable to check on PR")
|
||||||
print(json.dumps(a_pr, indent=4))
|
print(json.dumps(a_pr, indent=4))
|
||||||
sys.exit(255)
|
sys.exit(255)
|
||||||
@@ -133,14 +131,17 @@ def getNextReleases():
|
|||||||
# Load the users session information
|
# Load the users session information
|
||||||
#
|
#
|
||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
try:
|
|
||||||
print("Loading credentials")
|
print("Loading credentials")
|
||||||
with open(".github_creds", "r") as f:
|
CREDS_LOCATIONS = ('.github_creds', '~/.github_creds')
|
||||||
password = f.read().strip()
|
for creds_loc in CREDS_LOCATIONS:
|
||||||
session.headers.update({'Authorization': 'bearer {}'.format(password), 'Accept': 'application/vnd.github.v3+json'})
|
if os.path.exists(os.path.expanduser(creds_loc)):
|
||||||
except Exception:
|
with open(os.path.expanduser(creds_loc), "r") as f:
|
||||||
print("Failed to load credentials from ./.github_creds")
|
password = f.read().strip()
|
||||||
sys.exit(255)
|
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 = {
|
versions = {
|
||||||
'current': {},
|
'current': {},
|
||||||
|
|||||||
Reference in New Issue
Block a user