Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inau
Manage
Activity
Members
Labels
Plan
Issues
5
Issue boards
Milestones
Wiki
Code
Merge requests
2
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs
util
inau
Commits
9ae956fb
Commit
9ae956fb
authored
3 years ago
by
Alessio Igor Bogani
Browse files
Options
Downloads
Patches
Plain Diff
Use SSH for retrieve repositories
parent
6e597e85
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
inau-dispatcher.py
+5
-6
5 additions, 6 deletions
inau-dispatcher.py
with
5 additions
and
6 deletions
inau-dispatcher.py
+
5
−
6
View file @
9ae956fb
...
...
@@ -2,6 +2,7 @@
from
http.server
import
BaseHTTPRequestHandler
,
HTTPServer
from
http
import
HTTPStatus
import
ssl
from
sqlalchemy
import
create_engine
from
sqlalchemy.orm
import
sessionmaker
,
exc
from
multiprocessing
import
Process
,
Queue
...
...
@@ -313,9 +314,9 @@ class Server(BaseHTTPRequestHandler):
for
r
in
session
.
query
(
db
.
Repositories
).
filter
(
db
.
Repositories
.
name
==
post_json
[
'
project
'
][
'
path_with_namespace
'
]).
all
():
if
r
.
name
==
"
cs/ds/makefiles
"
and
self
.
headers
[
'
X-Gitlab-Event
'
]
==
'
Push Hook
'
and
post_json
[
'
event_name
'
]
==
'
push
'
:
job
=
Update
(
repository_name
=
r
.
name
,
repository_url
=
post_json
[
'
project
'
][
'
http
_url
'
],
build_tag
=
post_json
[
'
ref
'
])
job
=
Update
(
repository_name
=
r
.
name
,
repository_url
=
post_json
[
'
project
'
][
'
ssh
_url
'
],
build_tag
=
post_json
[
'
ref
'
])
elif
self
.
headers
[
'
X-Gitlab-Event
'
]
==
'
Tag Push Hook
'
and
post_json
[
'
event_name
'
]
==
'
tag_push
'
:
job
=
Store
(
repository_name
=
r
.
name
,
repository_url
=
post_json
[
'
project
'
][
'
http
_url
'
],
build_tag
=
post_json
[
'
ref
'
],
job
=
Store
(
repository_name
=
r
.
name
,
repository_url
=
post_json
[
'
project
'
][
'
ssh
_url
'
],
build_tag
=
post_json
[
'
ref
'
],
repository_id
=
r
.
id
,
repository_type
=
r
.
type
,
emails
=
[
post_json
[
'
commits
'
][
0
][
'
author
'
][
'
email
'
],
post_json
[
'
user_email
'
]])
else
:
continue
...
...
@@ -325,10 +326,6 @@ class Server(BaseHTTPRequestHandler):
key
=
lambda
x
:
x
.
queue
.
qsize
()))
allbuilders
[
r
.
platform_id
][
idx
].
queue
.
put
(
job
)
# TODO Enable protected_tags
# req = requests.post('https://gitlab.elettra.eu/api/v4/projects/' + urllib.parse.quote(rn, safe='')
# + '/protected_tags?name=' + post_json['ref'] + '&create_access_level=40')
self
.
send_response
(
HTTPStatus
.
OK
.
value
)
self
.
end_headers
()
...
...
@@ -346,6 +343,8 @@ def run(address, port, server_class=HTTPServer, handler_class=Server):
logger
.
info
(
'
Starting...
'
)
server_address
=
(
address
,
port
)
httpd
=
server_class
(
server_address
,
handler_class
)
# httpd.socket = ssl.wrap_socket (httpd.socket, keyfile="/etc/ssl/private/inau_elettra_eu.key",
# certfile="/etc/ssl/certs/inau_elettra_eu.crt", server_side=True)
try
:
httpd
.
serve_forever
()
except
KeyboardInterrupt
:
...
...
This diff is collapsed.
Click to expand it.
Preview
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!
Save comment
Cancel
Please
register
or
sign in
to comment