From d8e4310c2244320e67a5c3a5f3d9f2666a41e057 Mon Sep 17 00:00:00 2001 From: Jerrico Gamis Date: Wed, 20 Dec 2023 13:39:41 +1100 Subject: [PATCH] Fix getting of branch name --- app/root.py | 2 +- generate-server-info.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/root.py b/app/root.py index f2d72fe..5b5c3ad 100644 --- a/app/root.py +++ b/app/root.py @@ -2,9 +2,9 @@ import json from flask import Blueprint +from flask import jsonify bp = Blueprint('/', __name__, url_prefix='/') -from flask import jsonify @bp.route('/', methods=['GET']) diff --git a/generate-server-info.sh b/generate-server-info.sh index 4fcdb82..d641758 100755 --- a/generate-server-info.sh +++ b/generate-server-info.sh @@ -1,5 +1,5 @@ #!/bin/bash -BRANCH_NAME=$(git branch | awk '{ print $2 }') +BRANCH=$(git rev-parse --abbrev-ref HEAD) COMMIT_ID=$(git rev-parse HEAD) -echo "{ \"version\":\"${COMMIT_ID}\", \"branch\":\"${BRANCH_NAME}\", \"name\":\"flask-app-example\"}" > server_info.json +echo "{ \"version\":\"${COMMIT_ID}\", \"branch\":\"${BRANCH}\", \"name\":\"flask-app-example\"}" > server_info.json echo "Wrote server_info.json" \ No newline at end of file