Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
gitlab-hook
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sofus Rose
gitlab-hook
Commits
dd5721b9
Verified
Commit
dd5721b9
authored
Jan 09, 2017
by
Sofus Rose
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added env notes - script todo. Script now has project-specific tokens.
parent
24e7df0a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
2 deletions
+8
-2
hook.py
hook.py
+3
-2
initEnv.sh
initEnv.sh
+5
-0
No files found.
hook.py
View file @
dd5721b9
...
...
@@ -10,7 +10,6 @@ import os, os.path
#For this to work,
github_user
=
open
(
'/opt/git-repos/github-user'
,
'r'
)
.
readlines
()[
0
]
.
rstrip
()
TOKEN
=
open
(
'/opt/git-repos/token'
,
'r'
)
.
readlines
()[
0
]
.
rstrip
()
app
=
Flask
(
__name__
)
...
...
@@ -21,8 +20,10 @@ def foo():
print
(
"New commit by: {}"
.
format
(
data
[
'commits'
][
0
][
'author'
][
'name'
]),
file
=
sys
.
stderr
)
print
(
"Header: "
,
request
.
headers
)
proj_name
=
data
[
'project'
][
'name'
]
TOKEN
=
open
(
'/opt/git-repos/token_{}'
.
format
(
proj_name
),
'r'
)
.
readlines
()[
0
]
.
rstrip
()
if
request
.
headers
[
'X-Gitlab-Token'
]
==
TOKEN
:
proj_name
=
data
[
'project'
][
'name'
]
github_link
=
'git@github.com:{0}/{1}.git'
.
format
(
github_user
,
proj_name
)
gitlab_link
=
data
[
'project'
][
'git_http_url'
]
repo_path
=
"/opt/git-repos/{}"
.
format
(
proj_name
)
...
...
initEnv.sh
0 → 100644
View file @
dd5721b9
# /opt/git-repos must exist and be rw by the user running the service.
# /opt/git-repos/github-user must exist and contain the string of the github user.
# The user running the service must have github pull/push permissions via ssh key.
# (I wouldn't run this on anything except LAN! Use commit signing.)
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