This is an automated email from the ASF dual-hosted git repository.

jshao pushed a commit to branch branch-0.6
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/branch-0.6 by this push:
     new c8b1702ff [#4404] improvement: Add startup ASCII logo (#4495)
c8b1702ff is described below

commit c8b1702ff7f8199d9763762482716c9ee9b692eb
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Aug 13 09:21:20 2024 +0800

    [#4404] improvement: Add startup ASCII logo (#4495)
    
    ### What changes were proposed in this pull request?
    Add startup ASCII logo to start the service script.
    <img width="1240" alt="Screenshot 2024-08-08 at 11 26 45 PM"
    
src="https://github.com/user-attachments/assets/d3c90127-16d6-4a43-9a91-0d2b84a6cfe6";>
    
    ### Why are the changes needed?
    Fix: #4404
    
    ### Does this PR introduce _any_ user-facing change?
    Users will see the logo when `./bin/gravitino.sh start`.
    
    ### How was this patch tested?
    N/A
    
    Co-authored-by: Ziva Li <[email protected]>
---
 bin/common.sh                        | 17 +++++++++++++++++
 bin/gravitino-iceberg-rest-server.sh |  1 +
 bin/gravitino.sh                     |  1 +
 build.gradle.kts                     | 16 +++++++++++++++-
 conf/gravitino-env.sh.template       |  4 ++++
 5 files changed, 38 insertions(+), 1 deletion(-)

diff --git a/bin/common.sh b/bin/common.sh
index f06775080..a6f002ad9 100644
--- a/bin/common.sh
+++ b/bin/common.sh
@@ -105,3 +105,20 @@ if [[ -n "${JAVA_HOME}" ]]; then
 else
   export JAVA_RUNNER=java
 fi
+
+function printArt() {
+  local lineLength=70
+  local versionText="Version: ${GRAVITINO_VERSION}  "
+  local versionTextLength=${#versionText}
+  local paddingLength=$((lineLength - versionTextLength - 3))
+  local versionLine=$(printf "#%${paddingLength}s%s#" "" "$versionText")
+
+  echo "#####################################################################"
+  echo "#    ____   ____      _ ___     ___ ___  _____  ___  _   _   ___    #"
+  echo "#   / ___| |  _ \    / \ \ \   / / |_ _||_   _||_ _|| \ | | / _ \   #"
+  echo "#  | | __  | |_) |  / _ \ \ \ / /   | |   | |   | | |  \| || | | |  #"
+  echo "#  | |_| | |  _ <  / ___ \ \ V /    | |   | |   | | | |\  || |_| |  #"
+  echo "#   \____| |_| \_\/_/   \_\ \_/    |___|  |_|  |___||_| \_| \___/   #"
+  echo "$versionLine"
+  echo "#####################################################################"
+}
diff --git a/bin/gravitino-iceberg-rest-server.sh 
b/bin/gravitino-iceberg-rest-server.sh
index 9a6195c60..61f008012 100755
--- a/bin/gravitino-iceberg-rest-server.sh
+++ b/bin/gravitino-iceberg-rest-server.sh
@@ -47,6 +47,7 @@ function check_process_status() {
   if [[ -z "${pid}" ]]; then
     echo "GravitinoIcebergRESTServer is not running"
   else
+    printArt
     echo "GravitinoIcebergRESTServer is running[PID:$pid]"
   fi
 }
diff --git a/bin/gravitino.sh b/bin/gravitino.sh
index 51cda0041..a19d73d87 100755
--- a/bin/gravitino.sh
+++ b/bin/gravitino.sh
@@ -47,6 +47,7 @@ function check_process_status() {
   if [[ -z "${pid}" ]]; then
     echo "Gravitino Server is not running"
   else
+    printArt
     echo "Gravitino Server is running[PID:$pid]"
   fi
 }
diff --git a/build.gradle.kts b/build.gradle.kts
index dbfd8099c..6943c5f96 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -545,6 +545,13 @@ tasks {
         rename { fileName ->
           fileName.replace(".template", "")
         }
+        eachFile {
+          if (name == "gravitino-env.sh") {
+            filter { line ->
+              line.replace("GRAVITINO_VERSION_PLACEHOLDER", "$version")
+            }
+          }
+        }
         fileMode = 0b111101101
       }
       copy {
@@ -571,7 +578,7 @@ tasks {
     doLast {
       copy {
         from(projectDir.dir("conf")) {
-          include("${rootProject.name}-iceberg-rest-server.conf.template", 
"log4j2.properties.template")
+          include("${rootProject.name}-iceberg-rest-server.conf.template", 
"${rootProject.name}-env.sh.template", "log4j2.properties.template")
           into("${rootProject.name}-iceberg-rest-server/conf")
         }
         from(projectDir.dir("bin")) {
@@ -582,6 +589,13 @@ tasks {
         rename { fileName ->
           fileName.replace(".template", "")
         }
+        eachFile {
+          if (name == "gravitino-env.sh") {
+            filter { line ->
+              line.replace("GRAVITINO_VERSION_PLACEHOLDER", "$version")
+            }
+          }
+        }
         fileMode = 0b111101101
       }
 
diff --git a/conf/gravitino-env.sh.template b/conf/gravitino-env.sh.template
index 656ca176b..1d39e2e8f 100644
--- a/conf/gravitino-env.sh.template
+++ b/conf/gravitino-env.sh.template
@@ -17,6 +17,10 @@
 # under the License.
 #
 
+# In build.gradle.kts, we would automatic replace GRAVITINO_VERSION to the 
current version of Gravitino
+# when running `./gradlew compileDistribution` or `./gradlew 
compileIcebergRESTServer` command.
+GRAVITINO_VERSION=GRAVITINO_VERSION_PLACEHOLDER
+
 # Debug Gravitino server
 # export 
GRAVITINO_DEBUG_OPTS="-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000
 -Dlog4j2.debug=true"
 

Reply via email to