You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@atlas.apache.org by ma...@apache.org on 2025/08/13 23:49:27 UTC

(atlas) branch atlas-2.5 updated (7a5ac036e -> 5d11d763a)

This is an automated email from the ASF dual-hosted git repository.

madhan pushed a change to branch atlas-2.5
in repository https://gitbox.apache.org/repos/asf/atlas.git


    from 7a5ac036e ATLAS-4916 : Improve Efficiency in Access Request Handling by Optimizing Classification Retrieval (#374)
     new 4f6ee2d76 ATLAS-5054: Introduce JaCoCo plugin and generate Code Coverage results with CI (#387)
     new 5d11d763a ATLAS-5054: fix incorrect exit status from atlas-build.sh

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 dev-support/atlas-docker/Dockerfile.atlas-build |  2 +-
 dev-support/atlas-docker/scripts/atlas-build.sh |  9 +++++
 dev-support/checks/coverage.sh                  | 52 +++++++++++++++++++++++++
 pom.xml                                         | 30 +++++++++++++-
 4 files changed, 91 insertions(+), 2 deletions(-)
 create mode 100755 dev-support/checks/coverage.sh


(atlas) 01/02: ATLAS-5054: Introduce JaCoCo plugin and generate Code Coverage results with CI (#387)

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch atlas-2.5
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 4f6ee2d76f6a061390ff056dc0061237f7993d5b
Author: Abhishek Kumar <ab...@apache.org>
AuthorDate: Fri Jun 27 15:42:35 2025 -0700

    ATLAS-5054: Introduce JaCoCo plugin and generate Code Coverage results with CI (#387)
    
    * ATLAS-5054: Introduce JaCoCo plugin and generate Code Coverage results with CI
    
    * ATLAS-5054: refactor coverage.sh execution in atlas-build.sh
    
    * ATLAS-5054: add unzip command in Dockerfile.atlas-build
    
    * ATLAS-5054: move coverage artifacts to dist directory for upload later
    
    * ATLAS-5054: use host relative path for upload
    
    * ATLAS-5054: debug coverage files
    
    * ATLAS-5054: debug coverage files 2
    
    * ATLAS-5054: debug coverage files 3
    
    * ATLAS-5054: debug coverage files 4
    
    * ATLAS-5054: revert all testing changes and make PR ready for review
    
    (cherry picked from commit 783ed50b9137f45e695658ace42c1dc41edc1197)
---
 dev-support/atlas-docker/Dockerfile.atlas-build |  2 +-
 dev-support/atlas-docker/scripts/atlas-build.sh |  8 ++++
 dev-support/checks/coverage.sh                  | 52 +++++++++++++++++++++++++
 pom.xml                                         | 30 +++++++++++++-
 4 files changed, 90 insertions(+), 2 deletions(-)

diff --git a/dev-support/atlas-docker/Dockerfile.atlas-build b/dev-support/atlas-docker/Dockerfile.atlas-build
index 7cc4a612d..42c45dd0c 100644
--- a/dev-support/atlas-docker/Dockerfile.atlas-build
+++ b/dev-support/atlas-docker/Dockerfile.atlas-build
@@ -20,7 +20,7 @@ ARG ATLAS_BUILD_JAVA_VERSION
 ARG TARGETARCH
 
 # Install necessary packages to build Atlas
-RUN apt-get update && apt-get -y install git maven
+RUN apt-get update && apt-get -y install git maven unzip
 
 # Set environment variables
 ENV JAVA_HOME=/usr/lib/jvm/java-${ATLAS_BUILD_JAVA_VERSION}-openjdk-${TARGETARCH}
diff --git a/dev-support/atlas-docker/scripts/atlas-build.sh b/dev-support/atlas-docker/scripts/atlas-build.sh
index 3679bb1ea..fe2f18c86 100755
--- a/dev-support/atlas-docker/scripts/atlas-build.sh
+++ b/dev-support/atlas-docker/scripts/atlas-build.sh
@@ -92,3 +92,11 @@ mv -f distro/target/apache-atlas-${ATLAS_VERSION}-server.tar.gz     /home/atlas/
 mv -f distro/target/apache-atlas-${ATLAS_VERSION}-hive-hook.tar.gz  /home/atlas/dist/
 mv -f distro/target/apache-atlas-${ATLAS_VERSION}-hbase-hook.tar.gz /home/atlas/dist/
 mv -f distro/target/apache-atlas-${ATLAS_VERSION}-kafka-hook.tar.gz /home/atlas/dist/
+
+# Run code coverage and generate reports
+./dev-support/checks/coverage.sh
+status=$?
+
+# save coverage reports to the dist directory before container shutdown
+mv -f target/coverage /home/atlas/dist/
+exit $status
diff --git a/dev-support/checks/coverage.sh b/dev-support/checks/coverage.sh
new file mode 100755
index 000000000..8f35e35c1
--- /dev/null
+++ b/dev-support/checks/coverage.sh
@@ -0,0 +1,52 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This script merges the jacoco exec files and generates a report in HTML and XML formats
+
+DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
+cd "$DIR/../.." || exit 1
+
+set -ex
+
+REPORT_DIR="$DIR/../../target/coverage"
+
+mkdir -p "$REPORT_DIR"
+
+JACOCO_VERSION=$(mvn help:evaluate -Dexpression=jacoco.version -q -DforceStdout -Dscan=false)
+
+# Install jacoco cli
+mvn --non-recursive --no-transfer-progress -Dscan=false \
+  org.apache.maven.plugins:maven-dependency-plugin:copy \
+  -Dartifact=org.jacoco:org.jacoco.cli:${JACOCO_VERSION}:jar:nodeps
+
+jacoco() {
+  java -jar target/dependency/org.jacoco.cli-${JACOCO_VERSION}-nodeps.jar "$@"
+}
+
+# Merge all the jacoco.exec files
+jacoco merge $(find **/target -name jacoco.exec) --destfile "$REPORT_DIR/jacoco-all.exec"
+
+rm -rf target/coverage-classes || true
+mkdir -p target/coverage-classes
+
+# Unzip all the classes from the last build
+{ find */target/ -name 'atlas-*.jar'; find addons/**/target/*.jar -name '*-bridge-*.jar'; } | grep -v 'tests' | xargs -n1 unzip -o -q -d target/coverage-classes
+
+# get all source file paths
+src=$(find . -path '*/src/main/java' -o -path './target' -prune | sed 's/^/--sourcefiles /g' | xargs echo)
+
+# generate the reports
+jacoco report "$REPORT_DIR/jacoco-all.exec" $src --classfiles target/coverage-classes --html "$REPORT_DIR/all" --xml "$REPORT_DIR/all.xml"
diff --git a/pom.xml b/pom.xml
index 70fcc3b5d..9bf5a8cb4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,6 +129,7 @@
         <ivy.version>2.5.2</ivy.version>
         <jackson.databind.version>2.12.7</jackson.databind.version>
         <jackson.version>2.12.7</jackson.version>
+        <jacoco.version>0.8.13</jacoco.version>
         <janusgraph.cassandra.version>0.5.3</janusgraph.cassandra.version>
         <janusgraph.version>1.0.0</janusgraph.version>
         <java.version.required>1.8</java.version.required>
@@ -904,6 +905,12 @@
                 <version>3.0.0</version>
             </dependency>
 
+            <dependency>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
+                <version>${jacoco.version}</version>
+            </dependency>
+
             <dependency>
                 <groupId>org.slf4j</groupId>
                 <artifactId>jul-to-slf4j</artifactId>
@@ -1333,7 +1340,7 @@
                     <forkCount>${surefire.forkCount}</forkCount>
                     <reuseForks>false</reuseForks>
                     <redirectTestOutputToFile>true</redirectTestOutputToFile>
-                    <argLine>-Djava.awt.headless=true -Dproject.version=${project.version}
+                    <argLine>${argLine} -Djava.awt.headless=true -Dproject.version=${project.version}
                         -Dhadoop.tmp.dir="${project.build.directory}/tmp-hadoop-${user.name}"
                         -Xmx1024m -Djava.net.preferIPv4Stack=true ${atlas.surefire.options}</argLine>
                     <skip>${skipUTs}</skip>
@@ -1565,6 +1572,27 @@
                 <artifactId>javancss-maven-plugin</artifactId>
             </plugin>
 
+            <plugin>
+                <groupId>org.jacoco</groupId>
+                <artifactId>jacoco-maven-plugin</artifactId>
+                <version>${jacoco.version}</version>
+                <executions>
+                    <execution>
+                        <id>jacoco-initialize</id>
+                        <goals>
+                            <goal>prepare-agent</goal>
+                        </goals>
+                    </execution>
+                    <execution>
+                        <id>jacoco-site</id>
+                        <goals>
+                            <goal>report</goal>
+                        </goals>
+                        <phase>package</phase>
+                    </execution>
+                </executions>
+            </plugin>
+
             <plugin>
                 <artifactId>maven-clean-plugin</artifactId>
                 <configuration>


(atlas) 02/02: ATLAS-5054: fix incorrect exit status from atlas-build.sh

Posted by ma...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

madhan pushed a commit to branch atlas-2.5
in repository https://gitbox.apache.org/repos/asf/atlas.git

commit 5d11d763aaa1083dad6566becf7a781fba0a7cdb
Author: Madhan Neethiraj <ma...@apache.org>
AuthorDate: Wed Aug 13 16:28:54 2025 -0700

    ATLAS-5054: fix incorrect exit status from atlas-build.sh
    
    (cherry picked from commit 552a3fbd19aa7b2c0900295401430fdb8330e24e)
---
 dev-support/atlas-docker/scripts/atlas-build.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dev-support/atlas-docker/scripts/atlas-build.sh b/dev-support/atlas-docker/scripts/atlas-build.sh
index fe2f18c86..ff60538e8 100755
--- a/dev-support/atlas-docker/scripts/atlas-build.sh
+++ b/dev-support/atlas-docker/scripts/atlas-build.sh
@@ -93,9 +93,10 @@ mv -f distro/target/apache-atlas-${ATLAS_VERSION}-hive-hook.tar.gz  /home/atlas/
 mv -f distro/target/apache-atlas-${ATLAS_VERSION}-hbase-hook.tar.gz /home/atlas/dist/
 mv -f distro/target/apache-atlas-${ATLAS_VERSION}-kafka-hook.tar.gz /home/atlas/dist/
 
+status=$?
+
 # Run code coverage and generate reports
 ./dev-support/checks/coverage.sh
-status=$?
 
 # save coverage reports to the dist directory before container shutdown
 mv -f target/coverage /home/atlas/dist/