Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Ansible CI
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KSZK
Ansible
Ansible CI
Commits
3da701c5
Commit
3da701c5
authored
4 years ago
by
Robotka István Adrián
Browse files
Options
Downloads
Patches
Plain Diff
add mattermost integration
parent
985a57ee
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
git-sch-scripts/setup.py
+24
-1
24 additions, 1 deletion
git-sch-scripts/setup.py
with
24 additions
and
1 deletion
git-sch-scripts/setup.py
+
24
−
1
View file @
3da701c5
...
...
@@ -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
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment