Spring Boot Actuator info端点在Azure应用服务中运行时不返回Git信息。

huangapple go评论75阅读模式
英文:

Spring boot actuator info endpoint does not return git info when running in azure app service

问题

以下是翻译好的部分:

这是一个包含演示的存储库:
https://github.com/teplyuska/spring-boot-actuator-info-demo

查看自述文件以获取更多详细信息

这是它包含的简要描述:

  1. 使用git-commit-id-maven-plugin创建git.properties文件
  2. 使用spring-boot-starter-actuator和相关配置将完整的git信息包含在执行器信息端点中。
  3. 正常启动应用程序显示git信息
  4. 使用Azure应用服务映像启动应用程序不显示git信息
英文:

Here is a repository with the demonstration:
https://github.com/teplyuska/spring-boot-actuator-info-demo

Check the readme for more details

Here is a short description of what it contains.

  1. Use git-commit-id-maven-plugin to create git.properties file
  2. Use spring-boot-starter-actuator and related configs to include full git info in the actuator info endpoint.
  3. Start the app normally shows git info
  4. Start the app using azure app service image does not show git info

答案1

得分: 0

以下是您提供的内容的翻译:

看起来,通过java -cp添加的附加jar文件已经包含了一个带有有关附加jar的git.properties文件的信息。

{"git.commit.message.short"="合并PR 7721155:[ANT101]将Dev合并到Master中","git.remote.origin.url"="https://msazure.visualstudio.com/One/_git/AAPT-Antares-Websites-Extensions-Java","git.dirty"="false","git.closest.tag.name"="","git.branch"="5d33e9c40fdd4248b64cf6242ae5eeabac44a1c6","git.tags"="","git.build.time"="2023-03-05T03:43:51+0000","git.commit.id.describe-short"="5d33e9c","git.closest.tag.commit.count"="","git.local.branch.ahead"="NO_REMOTE","git.commit.message.full"="合并PR 7721155:[ANT101]将Dev合并到Master中\n\n合并PR 7698940:添加对commons-text 1.10.0的依赖以减轻CVE-2022-42889\n\n相关工作项:#17158979","git.commit.id.describe"="5d33e9c","git.commit.time"="2023-03-05T03:30:25+0000","git.total.commit.count"="111","git.build.version"="1.0",{"git.commit.id"="5d33e9c40fdd4248b64cf6242ae5eeabac44a1c6","git.local.branch.behind"="NO_REMOTE","git.commit.id.abbrev"="5d33e9c"}}

如何查找:
https://github.com/teplyuska/spring-boot-actuator-info-demo/commit/8fb8ae5da1495bd83045c46bda021d46729adc3d

为了解决这个问题,我添加了:

<generateGitPropertiesFilename>${project.build.outputDirectory}/my-git.properties</generateGitPropertiesFilename>

spring.info.git.location=classpath:my-git.properties

更多信息:
https://github.com/teplyuska/spring-boot-actuator-info-demo/commit/9b42b6d432dfcc982ec5bcc0d5c8e67eca78c0e8

英文:

It seems the additional jar files added by java -cp already contained a git.properties file with information about the additional jar.

{&quot;git.commit.message.short&quot;=&quot;Merged PR 7721155: [ANT101] Merge Dev into Master&quot;,, &quot;git.remote.origin.url&quot;=&quot;https://msazure.visualstudio.com/One/_git/AAPT-Antares-Websites-Extensions-Java&quot;,, &quot;git.dirty&quot;=&quot;false&quot;,, &quot;git.closest.tag.name&quot;=&quot;&quot;,, &quot;git.branch&quot;=&quot;5d33e9c40fdd4248b64cf6242ae5eeabac44a1c6&quot;,, &quot;git.tags&quot;=&quot;&quot;,, &quot;git.build.time&quot;=&quot;2023-03-05T03:43:51+0000&quot;,, &quot;git.commit.id.describe-short&quot;=&quot;5d33e9c&quot;,, &quot;git.closest.tag.commit.count&quot;=&quot;&quot;,, &quot;git.local.branch.ahead&quot;=&quot;NO_REMOTE&quot;,, &quot;git.commit.message.full&quot;=&quot;Merged PR 7721155: [ANT101] Merge Dev into Master

Merged PR 7698940: Add dependency on commons-text 1.10.0 to mitigate CVE-2022-42889

Related work items: #17158979&quot;,, &quot;git.commit.id.describe&quot;=&quot;5d33e9c&quot;,, &quot;git.commit.time&quot;=&quot;2023-03-05T03:30:25+0000&quot;,, &quot;git.total.commit.count&quot;=&quot;111&quot;, &quot;git.build.version&quot;=&quot;1.0&quot;,, {=, &quot;git.commit.id&quot;=&quot;5d33e9c40fdd4248b64cf6242ae5eeabac44a1c6&quot;,, &quot;git.local.branch.behind&quot;=&quot;NO_REMOTE&quot;,, &quot;git.commit.id.abbrev&quot;=&quot;5d33e9c&quot;,, }=}

How to find:
https://github.com/teplyuska/spring-boot-actuator-info-demo/commit/8fb8ae5da1495bd83045c46bda021d46729adc3d

To solve this i added:

&lt;generateGitPropertiesFilename&gt;${project.build.outputDirectory}/my-git.properties&lt;/generateGitPropertiesFilename&gt;

and

spring.info.git.location=classpath:my-git.properties

More info:
https://github.com/teplyuska/spring-boot-actuator-info-demo/commit/9b42b6d432dfcc982ec5bcc0d5c8e67eca78c0e8

huangapple
  • 本文由 发表于 2023年5月24日 22:16:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/76324531.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定