Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Gepetto
dashboard
Commits
035f6cad
Commit
035f6cad
authored
Feb 25, 2020
by
Guilhem Saurel
Browse files
gitlab hook: parse data
parent
d3a8d116
Pipeline
#8496
passed with stage
in 53 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
gh/views.py
View file @
035f6cad
...
...
@@ -110,7 +110,12 @@ def push(request: HttpRequest, rep: str) -> HttpResponse:
def
pipeline
(
request
:
HttpRequest
,
rep
:
str
)
->
HttpResponse
:
"""Something happened on a Gitlab pipeline. Tell Github if necessary."""
print
(
'pipeline'
)
pprint
(
loads
(
request
.
body
.
decode
()))
data
=
loads
(
request
.
body
.
decode
())
namespace
=
get_object_or_404
(
Namespace
,
slug
=
slugify
(
data
[
'project'
][
'namespace'
]))
project
=
get_object_or_404
(
Project
,
main_namespace
=
namespace
,
slug
=
slugify
(
data
[
'project'
][
'name'
]))
branch
,
commit
,
status
=
(
data
[
'object_attributes'
][
key
]
for
key
in
[
'ref'
,
'sha'
,
'status'
])
print
(
namespace
,
project
,
branch
,
commit
)
pprint
(
data
)
return
HttpResponse
(
rep
)
...
...
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