Skip to content

Commit

Permalink
[AMORO-2813] Improve the version info about the project (#2821)
Browse files Browse the repository at this point in the history
* [AMORO-2813] Improve the version info about the project

Before this commit, there will only show the version about the project in the topbar,
but this may not enough for some cases, in this commit we enahcned the version info
by including the abbrev.

* fixup! [AMORO-2813] Improve the version info about the project
  • Loading branch information
klion26 authored May 10, 2024
1 parent bdd780b commit 5b90227
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion amoro-ams/amoro-ams-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@
<dotGitDirectory>${project.basedir}/.git</dotGitDirectory>
<generateGitPropertiesFile>true</generateGitPropertiesFile>
<generateGitPropertiesFilename>
${project.build.outputDirectory}/arctic/git.properties
${project.build.outputDirectory}/amoro/git.properties
</generateGitPropertiesFilename>
<includeOnlyProperties>
<includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,21 +35,23 @@ public class VersionController {
public void getVersionInfo(Context ctx) {
Properties prop = new Properties();
InputStream is =
VersionController.class.getClassLoader().getResourceAsStream("arctic/git.properties");
VersionController.class.getClassLoader().getResourceAsStream("amoro/git.properties");
String version = "UNKNOWN";
String commitTime = "UNKNOWN";
String abbrev = "UNKNOWN";
if (is != null) {
try {
prop.load(is);
version = prop.getProperty("git.build.version");
abbrev = prop.getProperty("git.commit.id.abbrev");
commitTime = prop.getProperty("git.commit.time");
} catch (Exception e) {
LOG.warn("Failed to find git.properties.");
}
}

VersionInfo versionInfo = new VersionInfo();
versionInfo.setVersion(version);
versionInfo.setVersion(String.format("%s(%s)", version, abbrev));
versionInfo.setCommitTime(commitTime);
ctx.json(OkResponse.of(versionInfo));
}
Expand Down

0 comments on commit 5b90227

Please sign in to comment.