Ticket #735: List branches in repo
parent
611b8e354e
commit
4e3c0a88f0
|
@ -1,6 +1,7 @@
|
||||||
from flask import Flask, jsonify
|
from flask import Flask, jsonify
|
||||||
import os.path
|
import os.path
|
||||||
import os
|
import os
|
||||||
|
import git
|
||||||
|
|
||||||
|
|
||||||
repositories_base_path = "/opt/opengnsys/images"
|
repositories_base_path = "/opt/opengnsys/images"
|
||||||
|
@ -32,6 +33,24 @@ def get_repositories():
|
||||||
"repositories": repos
|
"repositories": repos
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
@app.route('/repositories/<repo>/branches')
|
||||||
|
def get_repository_branches(repo):
|
||||||
|
|
||||||
|
|
||||||
|
gitRepo = git.Repo(os.path.join(repositories_base_path, repo + ".git"))
|
||||||
|
|
||||||
|
branches = []
|
||||||
|
for branch in gitRepo.branches:
|
||||||
|
branches = branches + [branch.name]
|
||||||
|
|
||||||
|
|
||||||
|
return jsonify({
|
||||||
|
"branches": branches
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Define a route for health check
|
# Define a route for health check
|
||||||
@app.route('/health')
|
@app.route('/health')
|
||||||
def health_check():
|
def health_check():
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
click==8.0.4
|
click==8.0.4
|
||||||
dataclasses==0.8
|
dataclasses==0.8
|
||||||
Flask==2.0.3
|
Flask==2.0.3
|
||||||
|
gitdb==4.0.9
|
||||||
|
GitPython==3.1.20
|
||||||
importlib-metadata==4.8.3
|
importlib-metadata==4.8.3
|
||||||
itsdangerous==2.0.1
|
itsdangerous==2.0.1
|
||||||
Jinja2==3.0.3
|
Jinja2==3.0.3
|
||||||
MarkupSafe==2.0.1
|
MarkupSafe==2.0.1
|
||||||
pkg-resources==0.0.0
|
pkg-resources==0.0.0
|
||||||
|
smmap==5.0.0
|
||||||
typing-extensions==4.1.1
|
typing-extensions==4.1.1
|
||||||
Werkzeug==2.0.3
|
Werkzeug==2.0.3
|
||||||
zipp==3.6.0
|
zipp==3.6.0
|
||||||
|
|
Loading…
Reference in New Issue