Not able to see Code Coverage Difference in Merge Request for a java project

Problem to solve

We are having a Java project repo on GitLab where we are encountering an issue with the CI/CD pipeline’s code coverage reporting.

  • Current Behavior: The Merge Request (MR) shows “Test coverage 26.25% from 4 jobs.”
  • Expected Behavior: The MR should display “Test coverage 26.25% (+10%)” in green or "(-10%) in red " depending on the coverage report to indicate the increase or decrease in code coverage after the merge.

Here is the gitlab ci
testing:
rules:
- if: $CI_PIPELINE_SOURCE == “merge_request_event”
when: on_success
stage: Reports-Generation
image:
name: maven:3.9.6-ibm-semeru-21-jammy
script:
- cat example/example/functions/example/target/site/jacoco/index.html | grep -o 'Total[^%]%’
needs: [“Unit-Tests”]
artifacts:
expire_in: 30 days
when: always
reports:
junit:
- example/example/functions/example/target/surefire-reports/TEST-
.xml
paths:
- example/example/functions/example/target/site/jacoco/index.html
- example/example/functions/example/target/site/jacoco/jacoco.xml
- example/example/functions/example/target/site/jacoco/
coverage: ‘/Total.*?([0-9]{1,3})%/’
tags:
- docker-runner

I have attached the image of MR, how it currently shown

The Gitlab Version we are currently using is 15.1

We are experiencing the same issue on a NodeJS project.
Against the default branch it works, but against another branch it doesn’t.
Both coverage checks work and are reported on the jobs overview. But the diff is not working.
This result in the coverage check approval rule not working correctly as well.
Target branch job:


MR job