You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ad...@apache.org on 2023/03/25 11:23:56 UTC

[ozone] branch master updated: HDDS-8240. Disable JaCoCo for PRs and in forks (#4449)

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

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 11355a46f0 HDDS-8240. Disable JaCoCo for PRs and in forks (#4449)
11355a46f0 is described below

commit 11355a46f035ce96a02069d5d4ca6a1826798b6d
Author: Doroszlai, Attila <64...@users.noreply.github.com>
AuthorDate: Sat Mar 25 12:23:50 2023 +0100

    HDDS-8240. Disable JaCoCo for PRs and in forks (#4449)
---
 .github/workflows/ci.yml                       |  6 ++++--
 hadoop-ozone/dev-support/checks/build.sh       | 12 +++++++++++-
 hadoop-ozone/dev-support/checks/findbugs.sh    |  6 ++++++
 hadoop-ozone/dev-support/checks/junit.sh       | 11 +++++++++--
 hadoop-ozone/dist/src/main/compose/test-all.sh |  6 ++++--
 5 files changed, 34 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ce749125da..d18216cdba 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -18,6 +18,7 @@ on:
 env:
   FAIL_FAST: ${{ github.event_name == 'pull_request' }}
   MAVEN_OPTS: -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.http.retryHandler.class=standard -Dmaven.wagon.http.retryHandler.count=3
+  OZONE_WITH_COVERAGE: ${{ github.repository == 'apache/ozone' && github.event_name != 'pull_request' }}
 jobs:
   build-info:
     runs-on: ubuntu-20.04
@@ -93,7 +94,7 @@ jobs:
           distribution: 'temurin'
           java-version: ${{ matrix.java }}
       - name: Run a full build
-        run: hadoop-ozone/dev-support/checks/build.sh -Pcoverage -Pdist -Psrc
+        run: hadoop-ozone/dev-support/checks/build.sh -Pdist -Psrc
       - name: Store binaries for tests
         uses: actions/upload-artifact@v3
         with:
@@ -148,6 +149,8 @@ jobs:
           java-version: ${{ matrix.java }}
       - name: Compile Ozone using Java ${{ matrix.java }}
         run: hadoop-ozone/dev-support/checks/build.sh -Dskip.npx -Dskip.installnpx -Djavac.version=${{ matrix.java }}
+        env:
+          OZONE_WITH_COVERAGE: false
       - name: Delete temporary build artifacts before caching
         run: |
           #Never cache local artifacts
@@ -274,7 +277,6 @@ jobs:
         env:
           KEEP_IMAGE: false
           OZONE_ACCEPTANCE_SUITE: ${{ matrix.suite }}
-          OZONE_WITH_COVERAGE: true
           OZONE_VOLUME_OWNER: 1000
       - name: Archive build results
         uses: actions/upload-artifact@v3
diff --git a/hadoop-ozone/dev-support/checks/build.sh b/hadoop-ozone/dev-support/checks/build.sh
index bb74e8ddf1..3189ada6fc 100755
--- a/hadoop-ozone/dev-support/checks/build.sh
+++ b/hadoop-ozone/dev-support/checks/build.sh
@@ -16,6 +16,16 @@
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 cd "$DIR/../../.." || exit 1
 
+: ${OZONE_WITH_COVERAGE:="false"}
+
+MAVEN_OPTIONS='-V -B -Dmaven.javadoc.skip=true -DskipTests -DskipDocs --no-transfer-progress'
+
+if [[ "${OZONE_WITH_COVERAGE}" == "true" ]]; then
+  MAVEN_OPTIONS="${MAVEN_OPTIONS} -Pcoverage"
+else
+  MAVEN_OPTIONS="${MAVEN_OPTIONS} -Djacoco.skip"
+fi
+
 export MAVEN_OPTS="-Xmx4096m $MAVEN_OPTS"
-mvn -V -B -Dmaven.javadoc.skip=true -DskipTests -DskipDocs --no-transfer-progress clean install "$@"
+mvn ${MAVEN_OPTIONS} clean install "$@"
 exit $?
diff --git a/hadoop-ozone/dev-support/checks/findbugs.sh b/hadoop-ozone/dev-support/checks/findbugs.sh
index 6928487973..3f7f56ec8d 100755
--- a/hadoop-ozone/dev-support/checks/findbugs.sh
+++ b/hadoop-ozone/dev-support/checks/findbugs.sh
@@ -16,12 +16,18 @@
 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
 cd "$DIR/../../.." || exit 1
 
+: ${OZONE_WITH_COVERAGE:="false"}
+
 source "${DIR}/_lib.sh"
 
 install_spotbugs
 
 MAVEN_OPTIONS='-B -fae -Dskip.npx -Dskip.installnpx --no-transfer-progress'
 
+if [[ "${OZONE_WITH_COVERAGE}" != "true" ]]; then
+  MAVEN_OPTIONS="${MAVEN_OPTIONS} -Djacoco.skip"
+fi
+
 #shellcheck disable=SC2086
 mvn ${MAVEN_OPTIONS} test-compile spotbugs:spotbugs "$@"
 rc=$?
diff --git a/hadoop-ozone/dev-support/checks/junit.sh b/hadoop-ozone/dev-support/checks/junit.sh
index d22bca4f7a..c34e6925a1 100644
--- a/hadoop-ozone/dev-support/checks/junit.sh
+++ b/hadoop-ozone/dev-support/checks/junit.sh
@@ -21,6 +21,7 @@ cd "$DIR/../../.." || exit 1
 
 : ${CHECK:="unit"}
 : ${ITERATIONS:="1"}
+: ${OZONE_WITH_COVERAGE:="false"}
 
 declare -i ITERATIONS
 if [[ ${ITERATIONS} -le 0 ]]; then
@@ -30,6 +31,10 @@ fi
 export MAVEN_OPTS="-Xmx4096m $MAVEN_OPTS"
 MAVEN_OPTIONS='-B -Dskip.npx -Dskip.installnpx --no-transfer-progress'
 
+if [[ "${OZONE_WITH_COVERAGE}" != "true" ]]; then
+  MAVEN_OPTIONS="${MAVEN_OPTIONS} -Djacoco.skip"
+fi
+
 if [[ "${FAIL_FAST:-}" == "true" ]]; then
   MAVEN_OPTIONS="${MAVEN_OPTIONS} --fail-fast -Dsurefire.skipAfterFailureCount=1"
 else
@@ -71,7 +76,9 @@ for i in $(seq 1 ${ITERATIONS}); do
   fi
 done
 
-#Archive combined jacoco records
-mvn -B -N jacoco:merge -Djacoco.destFile=$REPORT_DIR/jacoco-combined.exec
+if [[ "${OZONE_WITH_COVERAGE}" == "true" ]]; then
+  #Archive combined jacoco records
+  mvn -B -N jacoco:merge -Djacoco.destFile=$REPORT_DIR/jacoco-combined.exec
+fi
 
 exit ${rc}
diff --git a/hadoop-ozone/dist/src/main/compose/test-all.sh b/hadoop-ozone/dist/src/main/compose/test-all.sh
index 17b9b0e68b..a998690032 100755
--- a/hadoop-ozone/dist/src/main/compose/test-all.sh
+++ b/hadoop-ozone/dist/src/main/compose/test-all.sh
@@ -27,7 +27,9 @@ rm "$ALL_RESULT_DIR"/* || true
 
 source "$SCRIPT_DIR"/testlib.sh
 
-if [ "$OZONE_WITH_COVERAGE" ]; then
+: ${OZONE_WITH_COVERAGE:="false"}
+
+if [[ "${OZONE_WITH_COVERAGE}" == "true" ]]; then
    java -cp "$PROJECT_DIR"/share/coverage/$(ls "$PROJECT_DIR"/share/coverage | grep test-util):"$PROJECT_DIR"/share/coverage/jacoco-core.jar org.apache.hadoop.test.JacocoServer &
    DOCKER_BRIDGE_IP=$(docker network inspect bridge --format='{{(index .IPAM.Config 0).Gateway}}')
    export OZONE_OPTS="-javaagent:share/coverage/jacoco-agent.jar=output=tcpclient,address=$DOCKER_BRIDGE_IP,includes=org.apache.hadoop.ozone.*:org.apache.hadoop.hdds.*:org.apache.hadoop.fs.ozone.*"
@@ -39,7 +41,7 @@ cd "$SCRIPT_DIR"
 RESULT=0
 run_test_scripts ${tests} || RESULT=$?
 
-if [ "$OZONE_WITH_COVERAGE" ]; then
+if [[ "${OZONE_WITH_COVERAGE}" == "true" ]]; then
   pkill -f JacocoServer
   cp /tmp/jacoco-combined.exec "$SCRIPT_DIR"/result
 fi


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org