New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add endpoint for server version #6524
feat: Add endpoint for server version #6524
Conversation
app/api/server_version.py
Outdated
@staticmethod | ||
@server_version_route.route('/server_version') | ||
def version(): | ||
return jsonify(server_version = SERVER_VERSION) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected spaces around keyword / parameter equals
app/api/server_version.py
Outdated
|
||
server_version_route = Blueprint('server_version', __name__, url_prefix='/v1') | ||
|
||
class ServerVersion: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
app/api/server_version.py
Outdated
@@ -0,0 +1,13 @@ | |||
from flask import jsonify, Blueprint | |||
|
|||
from app.api.bootstrap import api_v1 as app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'app.api.bootstrap.api_v1 as app' imported but unused
app/__init__.py
Outdated
@@ -48,6 +48,7 @@ | |||
from app.views.redis_store import redis_store | |||
from app.views.celery_ import celery | |||
from app.templates.flask_ext.jinja.filters import init_filters | |||
from app.api.server_version import ServerVersion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'app.api.server_version.ServerVersion' imported but unused
Codecov Report
@@ Coverage Diff @@
## development #6524 +/- ##
===============================================
+ Coverage 64.9% 65.15% +0.24%
===============================================
Files 294 296 +2
Lines 15199 15292 +93
===============================================
+ Hits 9865 9963 +98
+ Misses 5334 5329 -5
Continue to review full report at Codecov.
|
@prateekj117 @iamareebjamal Please review. |
app/api/server_version.py
Outdated
|
||
class ServerVersion: | ||
@staticmethod | ||
@server_version_route.route('/server_version') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make it /info
This JSON should be the output
{
"build": {
"version": "2.2.3-SNAPSHOT",
"time": "2019-10-15T07:26:58.080Z"
}
}
I have made the changes, @iamareebjamal please review. The output json is of the following format:
|
app/api/server_version.py
Outdated
|
||
server_version_route = Blueprint('server_version', __name__, url_prefix='/v1') | ||
info_route = Blueprint('info', __name__, url_prefix='/v1') | ||
_build = {'time': str(datetime.now()), 'version': SERVER_VERSION} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time should be the time of release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it'll be a little bit complex for you, ignore the time field
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iamareebjamal sure no issues. Although if you give me some hint about the vx pipeline I can try to figure out something.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
vx pipeline?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simplest solution is to invoke git to find last commit time
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we need to finalize the release today, so let it be and do it in a future release
app/__init__.py
Outdated
@@ -133,6 +133,7 @@ def create_app(): | |||
|
|||
# development api | |||
with app.app_context(): | |||
from app.api.server_version import info_route |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to last
ec039f8
app/__init__.py
Outdated
@@ -167,6 +167,8 @@ def create_app(): | |||
app.register_blueprint(admin_blueprint) | |||
app.register_blueprint(alipay_blueprint) | |||
app.register_blueprint(admin_misc_routes) | |||
app.register_blueprint(import_routes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Revert this to where it was
app/__init__.py
Outdated
app.register_blueprint(celery_routes) | ||
app.register_blueprint(auth_routes) | ||
app.register_blueprint(event_statistics) | ||
app.register_blueprint(info_route) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still at the wrong place
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have moved the /info_route
and /import_route
to its original place. Do you want me to put /info_route
end?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
info_route had no original place as it's a new route and should be placed in the end
@iamareebjamal @prateekj117 This is the first Open Source PR I have ever done in my life. Thanks guys for being so patient. You guys are awesome. |
Fixes #6470
Short description of what this resolves:
Added an API which shows the current version of the server
Changes proposed in this pull request:
Checklist
development
branch.