Skip to content

YunaBraska/version-endpoint

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

version-endpoint

Creates a version endpoint with git properties like SHA etc.

Build Maintainable Coverage Issues Commit Dependencies License Central Tag Javadoc Size Label

Requirements

  • pl.project13.maven:git-commit-id-plugin plugin which generates ${project.build.testOutputDirectory}/git.properties
  • org.springframework.boot:spring-boot-maven-plugin plugin which generates ${project.build.outputDirectory}/META-INF/build-info.properties

How to use it

<dependency>
    <groupId>berlin.yuna</groupId>
    <artifactId>version-endpoint</artifactId>
    <version>0.2.2</version>
</dependency>

Configuration

management:
  endpoint:
    version:
      path: /internal/version
        git:
          include: "*"
          exclude: tags, branch

Example

{
    "projectName": "version-endpoint",
    "projectGroup": "berlin.yuna",
    "projectArtifact": "version-endpoint",
    "projectVersion": "0.2.2",
    "git": {
        "tags": "",
        "build.version": "0.2.2",
        "closest.tag.commit.count": "20",
        "commit.user.name": "Yuna Morgenstern",
        "commit.id.abbrev": "a6729de",
        "branch": "testbranch",
        "build.host": "Cr15t4lF1r3",
        "commit.id.describe-short": "0.1.0-1-dirty",
        "total.commit.count": "8",
        "commit.id.describe": "0.1.0-1-ga6729de-dirty",
        "build.user.email": "git@example.com",
        "commit.id": "a6729de1f723aa3ddc84635a7cf9769dea489e17",
        "commit.message.short": "my cool commit message",
        "commit.user.email": "git@example.com",
        "closest.tag.name": "0.2.2",
        "local.branch.ahead": "0",
        "build.time": "1988-08-20T20:12:58+0100",
        "commit.time": "1988-08-20T18:22:17+0100",
        "local.branch.behind": "0",
        "build.user.name": "",
        "dirty": "true",
        "commit.message.full": "my cool commit message",
        "remote.origin.url": "https://github.com/YunaBraska/version-endpoint.git"
    }
}

Troubleshooting

  • BuildProperties are not initialized: just the following command
mvn clean compile
  • Add spring-boot-maven-plugin if the solution above did't help
<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <version>${spring-boot.version}</version>
    <executions>
        <execution>
            <phase>compile</phase>
            <id>build-info</id>
            <goals>
                <goal>build-info</goal>
            </goals>
        </execution>
    </executions>
</plugin>                

TODO

[ ] path to custom properties file

logo

About

A simple spring boot version endpoint with git properties

Resources

License

Stars

Watchers

Forks

Packages