Commit d01be4fe authored by Alexey Mints's avatar Alexey Mints 📈
Browse files

Simplify and add token_auth

parent 1987ee71
......@@ -4,4 +4,6 @@ Post-commit hook for SVN to post a comment to the proper Jira.
I do not know how to make it automatic, so have to be run after SVN commit, but it's still an improvement
Bash version pending
\ No newline at end of file
You'll need to get an access token here:
https://issues.cosmos.esa.int/gaia/secure/ViewProfile.jspa?selectedTab=com.atlassian.pats.pats-plugin:jira-user-personal-access-tokens
and place it into the script (or invent some more protected way of storing it).
#!/usr/bin/fish
svn log -r (string trim (svn info | grep -i "Last Changed Rev" | cut -d : -f 2 )) --xml | python3 svnhook.py
\ No newline at end of file
#!/usr/bin/bash
svn log -r head --xml | python3 svnhook.py
\ No newline at end of file
#!/usr/bin/env python3
import sys
import keyring
#import keyring
#import getpass
#python jira from https://github.com/pycontribs/jira
from jira import JIRA
from lxml import etree
tree = etree.parse(sys.stdin)
#pwd = getpass.getpass('Jira password:')
jira = JIRA(server='https://issues.cosmos.esa.int/gaia',
basic_auth=('amints', keyring.get_password('py_jira', 'amints')))
token_auth='******PLACE TOKEN HERE******')
#basic_auth=('amints', pwd))
#keyring.get_password('py_jira', 'amints')))
def issue_exists(name):
query = jira.search_issues('id = %s' % name)
return len(query) > 0
tree = etree.parse(sys.stdin)
revision = tree.find('logentry').attrib['revision']
comment = tree.find('logentry/msg').text
print(revision, comment)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment