You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/10/26 06:53:37 UTC

[GitHub] [skywalking] wu-sheng commented on a change in pull request #8004: Add a GraphQL query to get OAP version, display OAP version in startup message and error logs

wu-sheng commented on a change in pull request #8004:
URL: https://github.com/apache/skywalking/pull/8004#discussion_r736204670



##########
File path: oap-server/server-core/src/main/java/org/apache/skywalking/oap/server/core/version/Version.java
##########
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.core.version;
+
+import java.io.IOException;
+import java.util.Properties;
+import lombok.Getter;
+import org.apache.logging.log4j.util.Strings;
+
+@Getter
+public enum Version {
+    CURRENT;
+
+    private final String buildVersion;
+    private final String buildTime;
+    private final String commitId;
+
+    private final Properties properties = new Properties();
+
+    Version() {
+        try {
+            properties.load(Version.class.getClassLoader()
+                                         .getResourceAsStream("version.properties"));
+            buildVersion = properties.getProperty("git.build.version");
+            buildTime = properties.getProperty("git.build.time");
+            commitId = properties.getProperty("git.commit.id");
+        } catch (IOException e) {
+            throw new ExceptionInInitializerError(e);
+        }
+    }
+
+    @Override
+    public String toString() {
+        return String.format(
+            "%s-%s (%s)",
+            buildVersion,
+            Strings.left(commitId, 7),
+            buildTime

Review comment:
       So, the version is always `version-commitid (timstamp)`, right?
   
   I have seen you changed `create_source_release.sh` to build a static file.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org