Use token for github Authentication

* Move from user/passwd to token based auth for
  github api access
* Github password based authentication will be deprecated soon
  https://developer.github.com/changes/2020-02-14-deprecating-password-auth/

Change-Id: Ic5af5bcf6ceb9828f2df7cca97e73c713dc79c1e
Closes: #373
This commit is contained in:
Sirajudeen 2020-10-22 14:30:28 +00:00
parent 6d6d837060
commit c33f5f5104
4 changed files with 18 additions and 21 deletions

View File

@ -27,8 +27,7 @@
executable: pip3
- name: Run python script
script: >
update_github_issues.py "{{ github_credentials.username }}" \
"{{ github_credentials.password }}" \
update_github_issues.py "{{ github_credentials.token }}" \
"{{ zuul.message | b64decode }}" \
"{{ zuul.change_url }}"
args:

View File

@ -15,10 +15,9 @@ import sys
import github
GH_USER = sys.argv[1]
GH_PW = sys.argv[2]
ZUUL_MESSAGE = sys.argv[3]
GERRIT_URL = sys.argv[4]
GH_TOKEN = sys.argv[1]
ZUUL_MESSAGE = sys.argv[2]
GERRIT_URL = sys.argv[3]
REPO_NAME = 'airshipit/airshipctl'
PROCESS_LABELS = ['wip', 'ready for review', 'triage', 'blocked']
@ -65,7 +64,7 @@ def remove_duplicated_issue_numbers(issue_dict: dict) -> dict:
if __name__ == '__main__':
issue_number_dict = parse_issue_number(ZUUL_MESSAGE)
issue_number_dict = remove_duplicated_issue_numbers(issue_number_dict)
gh = github.Github(GH_USER, GH_PW)
gh = github.Github(GH_TOKEN)
repo = gh.get_repo(REPO_NAME)
for key, issue_list in issue_number_dict.items():
for issue_number in issue_list:

View File

@ -44,7 +44,7 @@
nodeset: airship-airshipctl-single-node
secrets:
- name: github_credentials
secret: airship_airshipctl_airshipit_github_username_password
secret: airship_airshipctl_airshipit_github_token
- job:
name: airship-airshipctl-build-image

View File

@ -59,20 +59,19 @@
595F3m2UtgR6QKN5xbJJmWp7ipihdRvQ1eVl5GCjG7MBi27YvILp4cIWg+MO1I=
- secret:
name: airship_airshipctl_airshipit_github_username_password
name: airship_airshipctl_airshipit_github_token
data:
username: airshipbot
password: !encrypted/pkcs1-oaep
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