This is an automated email from the ASF dual-hosted git repository.
roryqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git
The following commit(s) were added to refs/heads/master by this push:
new 90033ca83 [MINOR] chore(ci): Add a shade check step after build spark
shade jar (#2037)
90033ca83 is described below
commit 90033ca83f4f205fb48b3753b5688650c38acab3
Author: maobaolong <[email protected]>
AuthorDate: Wed Aug 28 13:03:24 2024 +0800
[MINOR] chore(ci): Add a shade check step after build spark shade jar
(#2037)
### What changes were proposed in this pull request?
Add a check after build spark shaded plugin, to check whether there are new
coming unshaded content.
### Why are the changes needed?
Without this, we cannot prevent to merge some PR which will break the shade
client.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
CI Tests.
---
client-spark/spark2-shaded/pom.xml | 3 +++
client-spark/spark3-shaded/pom.xml | 3 +++
dev/scripts/checkshade.sh | 43 ++++++++++++++++++++++++++++++++++++++
3 files changed, 49 insertions(+)
diff --git a/client-spark/spark2-shaded/pom.xml
b/client-spark/spark2-shaded/pom.xml
index cf54a9121..50a37dd05 100644
--- a/client-spark/spark2-shaded/pom.xml
+++ b/client-spark/spark2-shaded/pom.xml
@@ -312,6 +312,9 @@
<echo message="repackaging netty jar"></echo>
<jar
destfile="${project.build.directory}/${project.artifactId}-${project.version}.jar"
basedir="${project.build.directory}/unpacked"/>
+ <exec executable="bash" failonerror="true"
dir="${project.build.directory}/">
+ <arg
line="${project.basedir}/../../dev/scripts/checkshade.sh
${project.build.directory}/${project.artifactId}-${project.version}.jar"/>
+ </exec>
</target>
</configuration>
</execution>
diff --git a/client-spark/spark3-shaded/pom.xml
b/client-spark/spark3-shaded/pom.xml
index fe2a5a8e9..f0b16eb0d 100644
--- a/client-spark/spark3-shaded/pom.xml
+++ b/client-spark/spark3-shaded/pom.xml
@@ -309,6 +309,9 @@
<echo message="repackaging netty jar"></echo>
<jar
destfile="${project.build.directory}/${project.artifactId}-${project.version}.jar"
basedir="${project.build.directory}/unpacked"/>
+ <exec executable="bash" failonerror="true"
dir="${project.build.directory}/">
+ <arg
line="${project.basedir}/../../dev/scripts/checkshade.sh
${project.build.directory}/${project.artifactId}-${project.version}.jar"/>
+ </exec>
</target>
</configuration>
</execution>
diff --git a/dev/scripts/checkshade.sh b/dev/scripts/checkshade.sh
new file mode 100644
index 000000000..0bede9a73
--- /dev/null
+++ b/dev/scripts/checkshade.sh
@@ -0,0 +1,43 @@
+#!/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.
+#
+
+set -o pipefail
+set -o nounset # exit the script if you try to use an uninitialised variable
+
+SHADED_JAR_PATH=${1}
+echo "checkShaded:"${SHADED_JAR_PATH}
+if [ ! -f "${SHADED_JAR_PATH}" ]; then
+ echo "check failed, file does not exist."
+ exit 1
+fi
+
+UNSHADED=$(unzip -l "${SHADED_JAR_PATH}" | awk 'NR>3 {print $4}' | grep -vE
'uniffle|org/apache/spark/shuffle|META-INF|git.properties|/$|\.html$|\.css$|\.xml$|^javax|^$')
+UNSHADED_COUNT=0
+if [ -n "$UNSHADED" ]; then
+ UNSHADED_COUNT=$(wc -l <<< "$UNSHADED")
+fi
+echo "unshaded count: $UNSHADED_COUNT"
+echo "unshaded content:"
+echo "$UNSHADED"
+if [ $UNSHADED_COUNT -eq 0 ]; then
+ echo "check success."
+else
+ echo "check failed."
+ exit 2
+fi