Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Alexey Mints
dpac_svn_jira
Commits
d01be4fe
Commit
d01be4fe
authored
Sep 08, 2022
by
Alexey Mints
📈
Browse files
Simplify and add token_auth
parent
1987ee71
Changes
3
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
d01be4fe
...
...
@@ -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).
svn_post_commit.fish
View file @
d01be4fe
#!/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
svnhook.py
View file @
d01be4fe
#!/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
=
et
ree
.
parse
(
sys
.
stdin
)
#pwd
=
g
et
pass.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
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment