Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
tools.gitlab_webhook_receiver
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
osp
tools.gitlab_webhook_receiver
Commits
507bdd42
Commit
507bdd42
authored
May 17, 2019
by
svilayphiou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adapted the script to welcome a change on other branches than 'master'
parent
d422f77a
Pipeline
#400
failed with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
2 deletions
+4
-2
app.py
app.py
+4
-2
No files found.
app.py
View file @
507bdd42
...
...
@@ -15,11 +15,13 @@ def index():
if
request
.
headers
.
get
(
'X-Gitlab-Event'
)
==
'Push Hook'
:
print
(
"push hook"
)
data
=
json
.
load
(
request
.
body
)
print
(
data
)
#
print(data)
repo
=
data
.
get
(
"repository"
)
git_http_url
=
repo
.
get
(
"git_http_url"
)
project
=
data
.
get
(
"project"
)
print
(
project
)
branch
=
project
.
get
(
"default_branch"
)
#ns = data.get("namespace")
ns
=
"osp"
...
...
@@ -28,7 +30,7 @@ def index():
if
os
.
path
.
isdir
(
repo_local_path
):
print
(
"repo exists. Pulling"
)
cmd
=
"git fetch origin
master:master"
cmd
=
"git fetch origin
%s:%s"
%
(
branch
,
branch
)
subprocess
.
Popen
(
shlex
.
split
(
cmd
),
cwd
=
repo_local_path
)
else
:
print
(
"repo don't exist. Cloning"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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