Skip to content
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

Merged
merged 12 commits into from
Oct 19, 2019
4 changes: 2 additions & 2 deletions app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def create_app():

# development api
with app.app_context():
from app.api.server_version import server_version_route
from app.api.server_version import info_route
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to last

from app.api.admin_statistics_api.events import event_statistics
from app.api.auth import auth_routes
from app.api.attendees import attendee_misc_routes
Expand All @@ -159,7 +159,7 @@ def create_app():
app.register_blueprint(import_routes)
app.register_blueprint(celery_routes)
app.register_blueprint(auth_routes)
app.register_blueprint(server_version_route)
app.register_blueprint(info_route)
Copy link
Member

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

Copy link
Contributor Author

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Member

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

app.register_blueprint(event_statistics)
app.register_blueprint(user_misc_routes)
app.register_blueprint(attendee_misc_routes)
Expand Down
12 changes: 7 additions & 5 deletions app/api/server_version.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
from flask import jsonify, Blueprint
from datetime import datetime
iamareebjamal marked this conversation as resolved.
Show resolved Hide resolved

SERVER_VERSION = '2.2.3-SNAPSHOT'
iamareebjamal marked this conversation as resolved.
Show resolved Hide resolved
iamareebjamal marked this conversation as resolved.
Show resolved Hide resolved

SERVER_VERSION = '1.0'

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}
Copy link
Member

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

Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

vx pipeline?

Copy link
Member

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

Copy link
Member

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

iamareebjamal marked this conversation as resolved.
Show resolved Hide resolved


class ServerVersion:

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

iamareebjamal marked this conversation as resolved.
Show resolved Hide resolved

@staticmethod
@server_version_route.route('/server_version')
@info_route.route('/info')
def version():
return jsonify(server_version=SERVER_VERSION)
return jsonify(build=_build)