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 2022/11/26 15:54:15 UTC

[GitHub] [skywalking-java] nisiyong commented on a diff in pull request #397: Report the agent version to OAP

nisiyong commented on code in PR #397:
URL: https://github.com/apache/skywalking-java/pull/397#discussion_r1032803631


##########
apm-sniffer/apm-agent-core/src/main/java/org/apache/skywalking/apm/agent/core/version/Version.java:
##########
@@ -0,0 +1,51 @@
+/*
+ * 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.apm.agent.core.version;
+
+import lombok.Getter;
+
+import java.io.IOException;
+import java.util.Properties;
+
+@Getter
+public enum Version {
+    CURRENT;
+
+    private static final String VERSION_FILE_NAME = "skywalking-agent-version.properties";
+    private final String buildVersion;
+    private final String commitIdAbbrev;
+    private final String buildTime;

Review Comment:
   It works well in my local. Here is the log after I run the script `create_release.sh` with my personal repo. You can see the properties contains the field`buildTime`. 
   
   ```
   ➜  skywalking-java git:(report-agent-version) ✗ ./tools/releasing/create_release.sh
   Release version 8.14.0-test
   Source tag v8.14.0-test
   Creating source package
   Cloning into './apache-skywalking-java-agent-8.14.0-test'...
   remote: Enumerating objects: 253586, done.
   remote: Counting objects: 100% (1700/1700), done.
   remote: Compressing objects: 100% (683/683), done.
   remote: Total 253586 (delta 593), reused 1523 (delta 466), pack-reused 251886
   Receiving objects: 100% (253586/253586), 158.63 MiB | 17.31 MiB/s, done.
   Resolving deltas: 100% (98366/98366), done.
   Submodule 'apm-protocol/apm-network/src/main/proto' (https://github.com/apache/skywalking-data-collect-protocol.git) registered for path 'apm-protocol/apm-network/src/main/proto'
   Cloning into '/Users/nisiyong/CodeProjects/skywalking-java/apache-skywalking-java-agent-8.14.0-test/apm-protocol/apm-network/src/main/proto'...
   Submodule path 'apm-protocol/apm-network/src/main/proto': checked out 'f9066463deb7f9d1fbe8110eab3524694b0db298'
   --2022-11-26 23:48:11--  https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar
   Resolving repo.maven.apache.org (repo.maven.apache.org)... 151.101.40.215
   Connecting to repo.maven.apache.org (repo.maven.apache.org)|151.101.40.215|:443... connected.
   HTTP request sent, awaiting response... 200 OK
   Length: 50710 (50K) [application/java-archive]
   Saving to: ‘/Users/nisiyong/CodeProjects/skywalking-java/apache-skywalking-java-agent-8.14.0-test/.mvn/wrapper/maven-wrapper.jar’
   
   /Users/nisiyong/CodeProjects/skywalking-java/apache-skywalking-java-agent-8. 100%[============================================================================================================================================================================================>]  49.52K   257KB/s    in 0.2s    
   
   2022-11-26 23:48:12 (257 KB/s) - ‘/Users/nisiyong/CodeProjects/skywalking-java/apache-skywalking-java-agent-8.14.0-test/.mvn/wrapper/maven-wrapper.jar’ saved [50710/50710]
   
   ➜  skywalking-java git:(report-agent-version) ✗ find apache-skywalking-java-agent-8.14.0-test -name "*version.properties"
   apache-skywalking-java-agent-8.14.0-test/apm-sniffer/apm-agent-core/src/main/resources/skywalking-agent-version.properties
   ➜  skywalking-java git:(report-agent-version) ✗ cat apache-skywalking-java-agent-8.14.0-test/apm-sniffer/apm-agent-core/src/main/resources/skywalking-agent-version.properties                                                                                                                          
   #Generated by Git-Commit-Id-Plugin
   git.build.time=221126
   git.build.version=8.14.0-SNAPSHOT
   git.commit.id.abbrev=2ef1977
   git.commit.id.full=2ef19778aeea34364d0e8643b093981963a17962
   ➜  skywalking-java git:(report-agent-version) ✗ 
   
   ```



-- 
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