Add metadata related to builds and commits 07/139207/7
authormpriyank <priyank.maheshwari@est.tech>
Wed, 16 Oct 2024 10:59:49 +0000 (11:59 +0100)
committermpriyank <priyank.maheshwari@est.tech>
Wed, 23 Oct 2024 21:55:21 +0000 (22:55 +0100)
- removing the build-info goal from the existing spring-boot-maven-plugin
- adding git-commit-id-maven-plugin to expose the git related info using
  actuator/info endpoint
- adding the dateFormat to git plugin to make it same as the build-info
- cleaning up a duplicate dependency in cps-ncmp-rest-stub module

Issue-ID: CPS-2445
Change-Id: Id7179a81361718d293b7b31f50c1adbdd2ad4302
Signed-off-by: mpriyank <priyank.maheshwari@est.tech>
cps-application/pom.xml
cps-application/src/main/resources/application.yml
cps-ncmp-rest-stub/cps-ncmp-rest-stub-service/pom.xml
cps-parent/pom.xml

index c374473..08c7181 100644 (file)
                     </execution>
                 </executions>
             </plugin>
+            <plugin>
+                <groupId>io.github.git-commit-id</groupId>
+                <artifactId>git-commit-id-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>get-git-info</id>
+                        <goals>
+                            <goal>revision</goal>
+                        </goals>
+                        <phase>package</phase>
+                    </execution>
+                </executions>
+                <configuration>
+                    <dateFormat>yyyy-MM-dd'T'HH:mm:ss.sss'Z'</dateFormat>
+                    <includeOnlyProperties>
+                        <includeOnlyProperty>^git.build.(time|version)$</includeOnlyProperty>
+                        <includeOnlyProperty>^git.commit.(id.full|message.short|user.name|user.email)$</includeOnlyProperty>
+                        <includeOnlyProperty>^git.branch</includeOnlyProperty>
+                    </includeOnlyProperties>
+                    <generateGitPropertiesFile>true</generateGitPropertiesFile>
+                    <generateGitPropertiesFilename>${project.build.outputDirectory}/git.properties</generateGitPropertiesFilename>
+                    <commitIdGenerationMode>full</commitIdGenerationMode>
+                </configuration>
+            </plugin>
         </plugins>
     </build>
     <profiles>
index 3789e92..d7e39f7 100644 (file)
@@ -180,6 +180,11 @@ management:
             probes:
                 enabled: true
 
+    info:
+        git:
+            enabled: true
+            mode: full
+
 logging:
     format: json
     level:
index 1fcea8f..aa7e1fb 100644 (file)
             <artifactId>spock-spring</artifactId>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>org.spockframework</groupId>
-            <artifactId>spock-core</artifactId>
-            <scope>test</scope>
-        </dependency>
     </dependencies>
     
 </project>
\ No newline at end of file
index f97a40b..a83278d 100644 (file)
                     <executions>
                         <execution>
                             <goals>
-                                <goal>build-info</goal>
                                 <goal>repackage</goal>
                             </goals>
                         </execution>
                     </executions>
                 </plugin>
+                <plugin>
+                    <groupId>io.github.git-commit-id</groupId>
+                    <artifactId>git-commit-id-maven-plugin</artifactId>
+                    <version>9.0.0</version>
+                    <executions>
+                        <execution>
+                            <id>get-git-info</id>
+                            <goals>
+                                <goal>revision</goal>
+                            </goals>
+                            <phase>package</phase>
+                        </execution>
+                    </executions>
+                </plugin>
                 <plugin>
                     <groupId>org.apache.maven.plugins</groupId>
                     <artifactId>maven-surefire-plugin</artifactId>