Skip to content

Commit

Permalink
Improve documentation regarding git commit info
Browse files Browse the repository at this point in the history
Closes gh-24205
  • Loading branch information
mbhave committed Dec 19, 2020
1 parent c9a09cf commit 302ba77
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Expand Up @@ -2535,6 +2535,8 @@ Gradle users can achieve the same result by using the https://plugins.gradle.org
}
----

Both the Maven and Gradle plugins allow the properties that are included in `git.properties` to be configured.

TIP: The commit time in `git.properties` is expected to match the following format: `yyyy-MM-dd'T'HH:mm:ssZ`.
This is the default format for both plugins listed above.
Using this format lets the time be parsed into a `Date` and its format, when serialized to JSON, to be controlled by Jackson's date serialization configuration settings.
Expand Down
Expand Up @@ -1108,11 +1108,13 @@ Assuming you use Maven, you could rewrite the preceding example as follows:
[[production-ready-application-info-git]]
==== Git Commit Information
Another useful feature of the `info` endpoint is its ability to publish information about the state of your `git` source code repository when the project was built.
If a `GitProperties` bean is available, the `git.branch`, `git.commit.id`, and `git.commit.time` properties are exposed.
If a `GitProperties` bean is available, the `info` endpoint can be used to expose these properties.

TIP: A `GitProperties` bean is auto-configured if a `git.properties` file is available at the root of the classpath.
See "<<howto.adoc#howto-git-info,Generate git information>>" for more details.

By default, the endpoint exposes `git.branch`, `git.commit.id`, and `git.commit.time` properties, if present.
If you don't want any of these properties in the endpoint response, they need to be excluded from the `git.properties` file.
If you want to display the full git information (that is, the full content of `git.properties`), use the configprop:management.info.git.mode[] property, as follows:

[source,properties,indent=0,configprops]
Expand Down

0 comments on commit 302ba77

Please sign in to comment.