Skip to content

Commit 4997c2f

Browse files
committed
code coverage: centralize JaCoCo version
Motivation: To improve maintainability and ensure consistency across the JaCoCo toolchain. This change centralizes the JaCoCo version and removes hardcoded values from scripts and CI jobs. Modifications: CI: Updated .gitlab-ci.yml to use a global JACOCO_VERSION variable, removing hardcoded versions from get_jacoco_cli and generate_jacoco_report jobs. Scripts: Modified get-jacoco.sh and generate-jacoco-report.sh to use the JACOCO_VERSION environment variable with a fallback value for failproof execution. Cleanup: Removed redundant version declarations. Results: The JaCoCo version is now defined once in .gitlab-ci.yml, and once in parent pom.xml. Testing: Confirmed CI jobs use the correct version and generate reports as expected. Acked-by: Tigran Mkrtchyan Target: master Require-book: no Require-notes: no
1 parent 148ab3f commit 4997c2f

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

.gitlab-ci.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ variables:
5353
AUTOCA_URL: https://ci.dcache.org/ca
5454
DCACHE_HELM_REPO: https://gitlab.desy.de/api/v4/projects/7648/packages/helm/test
5555
DCACHE_COMPATIBILITY_VERSION: 9.2.20
56-
56+
JACOCO_VERSION: 0.8.14 #must match maven plugin version
5757

5858
# let's debug nodes where job is running
5959
before_script:
@@ -94,6 +94,7 @@ default:
9494
name: dtzar/helm-kubectl:latest
9595
entrypoint: ['']
9696

97+
9798
#
9899
# default cache konfiguration for maven build jobs
99100
# Cache downloaded dependencies and plugins between builds.
@@ -707,15 +708,12 @@ Run OIDC test:
707708
get_jacoco_cli:
708709
stage: build
709710
image: eclipse-temurin:17-jre
710-
variables:
711-
JACOCO_VERSION: "0.8.14"
712711
script:
713712
- ./get-jacoco.sh
714713
cache:
715714
key: "jacoco-cli-${JACOCO_VERSION}" #cache per version
716715
paths:
717716
- "jacoco-${JACOCO_VERSION}/" #cache the entire JaCoCo directory
718-
policy: pull
719717
artifacts:
720718
paths:
721719
- "jacoco-${JACOCO_VERSION}/lib/jacococli.jar"
@@ -725,8 +723,6 @@ get_jacoco_cli:
725723
generate_jacoco_report:
726724
stage: build
727725
image: eclipse-temurin:17-jre
728-
variables:
729-
JACOCO_VERSION: "0.8.14"
730726
needs:
731727
- job: run_ut_with_coverage
732728
artifacts: true

generate-jacoco-report.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Define paths
44
PROJECT_ROOT="${PROJECT_ROOT:-$(pwd)}"
5-
JACOCO_VERSION=0.8.14
5+
JACOCO_VERSION="${JACOCO_VERSION:-0.8.14}" # Use env var or fallback
66
JACOCO_DIR="${PROJECT_ROOT}/jacoco-$JACOCO_VERSION"
77
JACOCO_CLI_JAR="$JACOCO_DIR/lib/jacococli.jar"
88
MERGED_EXEC="$PROJECT_ROOT/target/coverage-reports/merged.exec"

get-jacoco.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
apt-get update && apt-get install -y wget unzip
44
# Define paths
55
PROJECT_ROOT="${PROJECT_ROOT:-$(pwd)}"
6-
JACOCO_VERSION=0.8.14
6+
JACOCO_VERSION="${JACOCO_VERSION:-0.8.14}" # Use env var or fallback
77
JACOCO_DIR="${PROJECT_ROOT}/jacoco-$JACOCO_VERSION"
88
JACOCO_CLI_JAR="$JACOCO_DIR/lib/jacococli.jar"
99

pom.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
<datanucleus.plugin.version>6.0.0-release</datanucleus.plugin.version>
102102
<asm.version>9.5</asm.version>
103103
<asm-tools.version>5.0.3</asm-tools.version>
104+
<jacoco.version>0.8.14</jacoco.version>
104105
</properties>
105106

106107
<scm>
@@ -1242,7 +1243,7 @@
12421243
<plugin>
12431244
<groupId>org.jacoco</groupId>
12441245
<artifactId>jacoco-maven-plugin</artifactId>
1245-
<version>0.8.14</version>
1246+
<version>${jacoco.version}</version>
12461247
</plugin>
12471248
<plugin>
12481249
<groupId>com.ruleoftech</groupId>

0 commit comments

Comments
 (0)