From b097f319586be40d4978abc0787cbc62a95251d2 Mon Sep 17 00:00:00 2001 From: sourabh_sourabh Date: Tue, 3 Jun 2025 14:03:05 +0100 Subject: [PATCH] Add git-commit-id-maven-plugin to generate build metadat - Integrated git-commit-id-maven-plugin in pom.xml - Configured it to run during the package phase - Outputs selected metadata to git.properties. - Set custom date format and file output location Issue-ID: CPS-2690 Change-Id: Id496bd7cc67982dedfd0a70dbdb6136046a2dac1 Signed-off-by: sourabh_sourabh --- dmi-service/pom.xml | 24 ++++++++++++++++++++++ dmi-service/src/main/resources/application.yml | 4 ++++ .../src/main/resources/application.yml | 6 +++++- dmi-stub/pom.xml | 24 ++++++++++++++++++++++ pom.xml | 14 +++++++++++++ 5 files changed, 71 insertions(+), 1 deletion(-) diff --git a/dmi-service/pom.xml b/dmi-service/pom.xml index 830ff987..56ff6546 100644 --- a/dmi-service/pom.xml +++ b/dmi-service/pom.xml @@ -604,6 +604,30 @@ maven-deploy-plugin ${maven.deploy.plugin.version} + + io.github.git-commit-id + git-commit-id-maven-plugin + + + get-git-info + + revision + + package + + + + yyyy-MM-dd'T'HH:mm:ss.sss'Z' + + ^git.build.(time|version)$ + ^git.commit.(id.full|message.short|user.name|user.email)$ + ^git.branch + + true + ${project.build.outputDirectory}/git.properties + full + + diff --git a/dmi-service/src/main/resources/application.yml b/dmi-service/src/main/resources/application.yml index 003aa191..ef61a08a 100644 --- a/dmi-service/src/main/resources/application.yml +++ b/dmi-service/src/main/resources/application.yml @@ -94,6 +94,10 @@ management: enabled: true loggers: enabled: true + info: + git: + enabled: true + mode: full cps-core: baseUrl: http://${CPS_CORE_HOST}:${CPS_CORE_PORT} diff --git a/dmi-stub/dmi-stub-service/src/main/resources/application.yml b/dmi-stub/dmi-stub-service/src/main/resources/application.yml index 09edb13e..38f35ac9 100644 --- a/dmi-stub/dmi-stub-service/src/main/resources/application.yml +++ b/dmi-stub/dmi-stub-service/src/main/resources/application.yml @@ -40,13 +40,17 @@ management: endpoints: web: exposure: - include: health + include: info,health endpoint: health: show-details: always # kubernetes probes: liveness and readiness probes: enabled: true + info: + git: + enabled: true + mode: full app: ncmp: diff --git a/dmi-stub/pom.xml b/dmi-stub/pom.xml index dedcc3e6..ce6fd1ee 100644 --- a/dmi-stub/pom.xml +++ b/dmi-stub/pom.xml @@ -99,6 +99,30 @@ + + io.github.git-commit-id + git-commit-id-maven-plugin + + + get-git-info + + revision + + package + + + + yyyy-MM-dd'T'HH:mm:ss.sss'Z' + + ^git.build.(time|version)$ + ^git.commit.(id.full|message.short|user.name|user.email)$ + ^git.branch + + true + ${project.build.outputDirectory}/git.properties + full + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index fb3b78c6..1f56532d 100644 --- a/pom.xml +++ b/pom.xml @@ -161,6 +161,20 @@ maven-deploy-plugin ${maven.deploy.plugin.version} + + io.github.git-commit-id + git-commit-id-maven-plugin + 9.0.1 + + + get-git-info + + revision + + package + + + -- 2.16.6