英文:
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
查看自述文件以获取更多详细信息
这是它包含的简要描述:
- 使用git-commit-id-maven-plugin创建git.properties文件
- 使用spring-boot-starter-actuator和相关配置将完整的git信息包含在执行器信息端点中。
- 正常启动应用程序显示git信息
- 使用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.
- Use git-commit-id-maven-plugin to create git.properties file
- Use spring-boot-starter-actuator and related configs to include full git info in the actuator info endpoint.
- Start the app normally shows git info
- 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"}}
为了解决这个问题,我添加了:
<generateGitPropertiesFilename>${project.build.outputDirectory}/my-git.properties</generateGitPropertiesFilename>
和
spring.info.git.location=classpath:my-git.properties
英文:
It seems the additional jar files added by java -cp already contained a git.properties file with information about the additional jar.
{"git.commit.message.short"="Merged PR 7721155: [ANT101] Merge Dev into 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"="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",, "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",, }=}
How to find:
https://github.com/teplyuska/spring-boot-actuator-info-demo/commit/8fb8ae5da1495bd83045c46bda021d46729adc3d
To solve this i added:
<generateGitPropertiesFilename>${project.build.outputDirectory}/my-git.properties</generateGitPropertiesFilename>
and
spring.info.git.location=classpath:my-git.properties
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论