Skip to content
Snippets Groups Projects
Commit 3da701c5 authored by Robotka István Adrián's avatar Robotka István Adrián
Browse files

add mattermost integration

parent 985a57ee
No related branches found
No related tags found
No related merge requests found
......@@ -36,6 +36,7 @@ def repo_action(project_meta):
# print(project_meta)
setup_project(project_meta)
add_youtrack(project_meta)
add_mattermost(project_meta)
check_tags(project_meta)
......@@ -79,18 +80,31 @@ def add_youtrack(project_meta):
update_project(project_meta, data, postfix)
def add_mattermost(project_meta):
postfix = '/services/mattermost'
mm = 'https://mattermost.kszk.bme.hu/hooks'
data = {
'webhook': mm + '/c57a1tbduj8k9rsh71jd1gufey',
'notify_only_broken_pipelines': True,
'merge_requests_events': True,
'tag_push_events': True
}
update_project(project_meta, data, postfix)
def check_tags(project_meta):
path = 'projects/'
path += str(project_meta['id'])
path += '/protected_tags'
tags = request(path)
# unprotect_tags(path, tags)
if len(tags) == 0:
protect_tags(path)
def protect_tags(path):
data = {
'name': 'v*',
'name': '1.*',
'create_access_level': '40'
}
r = requests.post(url=get_url(path), data=data)
......@@ -100,4 +114,13 @@ def protect_tags(path):
print("ERROR protecting tag")
def unprotect_tags(path, tags):
path += '/' + tags[0]['name']
r = requests.delete(url=get_url(path))
if r.ok:
print("tag deleted")
else:
print("ERROR deleting tag")
iterate_group(1604)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment