Skip to content

Commit

Permalink
Revert "Revert "Update nightly build and deploy script for arm artifa…
Browse files Browse the repository at this point in the history
…cts [skip ci] (#9888)""

This reverts commit 5d31719.
  • Loading branch information
ttnghia committed Dec 1, 2023
1 parent 2225a78 commit f7b8349
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 11 deletions.
9 changes: 5 additions & 4 deletions jenkins/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
# POM_FILE: Project pom file to be deployed
# OUT_PATH: The path where jar files are
# CUDA_CLASSIFIERS: Comma separated classifiers, e.g., "cuda11,cuda12"
# CLASSIFIERS: Comma separated classifiers, e.g., "cuda11,cuda12,cuda11-arm64,cuda12-arm64"
###

set -ex
Expand All @@ -48,6 +49,7 @@ ART_GROUP_ID=$(mvnEval $DIST_PL project.groupId)
ART_VER=$(mvnEval $DIST_PL project.version)
DEFAULT_CUDA_CLASSIFIER=$(mvnEval $DIST_PL cuda.version)
CUDA_CLASSIFIERS=${CUDA_CLASSIFIERS:-"$DEFAULT_CUDA_CLASSIFIER"}
CLASSIFIERS=${CLASSIFIERS:-"$CUDA_CLASSIFIERS"} # default as CUDA_CLASSIFIERS for compatibility

SQL_PL=${SQL_PL:-"sql-plugin"}
POM_FILE=${POM_FILE:-"$DIST_PL/target/parallel-world/META-INF/maven/${ART_GROUP_ID}/${ART_ID}/pom.xml"}
Expand All @@ -57,9 +59,8 @@ SIGN_TOOL=${SIGN_TOOL:-"gpg"}
FPATH="$OUT_PATH/$ART_ID-$ART_VER"
DEPLOY_TYPES=''
DEPLOY_FILES=''
IFS=',' read -a CUDA_CLASSIFIERS_ARR <<< "$CUDA_CLASSIFIERS"
DEPLOY_TYPES=$(echo $CUDA_CLASSIFIERS | sed -e 's;[^,]*;jar;g')
DEPLOY_FILES=$(echo $CUDA_CLASSIFIERS | sed -e "s;\([^,]*\);${FPATH}-\1.jar;g")
DEPLOY_TYPES=$(echo $CLASSIFIERS | sed -e 's;[^,]*;jar;g')
DEPLOY_FILES=$(echo $CLASSIFIERS | sed -e "s;\([^,]*\);${FPATH}-\1.jar;g")

# dist does not have javadoc and sources jars, use 'sql-plugin' instead
source jenkins/version-def.sh >/dev/null 2&>1
Expand Down Expand Up @@ -103,4 +104,4 @@ $DEPLOY_CMD -DpomFile=$POM_FILE \
-Djavadoc=$FPATH-javadoc.jar \
-Dfiles=$DEPLOY_FILES \
-Dtypes=$DEPLOY_TYPES \
-Dclassifiers=$CUDA_CLASSIFIERS
-Dclassifiers=$CLASSIFIERS
29 changes: 22 additions & 7 deletions jenkins/spark-nightly-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ ART_GROUP_ID=$(mvnEval project.groupId)
ART_VER=$(mvnEval project.version)
DEFAULT_CUDA_CLASSIFIER=${DEFAULT_CUDA_CLASSIFIER:-$(mvnEval cuda.version)} # default cuda version
CUDA_CLASSIFIERS=${CUDA_CLASSIFIERS:-"$DEFAULT_CUDA_CLASSIFIER"} # e.g. cuda11,cuda12
IFS=',' read -a CUDA_CLASSIFIERS_ARR <<< "$CUDA_CLASSIFIERS"
CLASSIFIERS=${CLASSIFIERS:-"$CUDA_CLASSIFIERS"} # default as CUDA_CLASSIFIERS for compatibility
IFS=',' read -a CLASSIFIERS_ARR <<< "$CLASSIFIERS"
TMP_PATH="/tmp/$(date '+%Y-%m-%d')-$$"

DIST_FPATH="$DIST_PL/target/$ART_ID-$ART_VER-$DEFAULT_CUDA_CLASSIFIER"
Expand Down Expand Up @@ -72,7 +73,7 @@ function distWithReducedPom {

deploy)
mvnCmd="deploy:deploy-file"
if (( ${#CUDA_CLASSIFIERS_ARR[@]} > 1 )); then
if (( ${#CLASSIFIERS_ARR[@]} > 1 )); then
# try move tmp artifacts back to target folder for simplifying separate release process
mv ${TMP_PATH}/${ART_ID}-${ART_VER}-*.jar ${DIST_PL}/target/
fi
Expand Down Expand Up @@ -102,6 +103,11 @@ function distWithReducedPom {

# option to skip unit tests. Used in our CI to separate test runs in parallel stages
SKIP_TESTS=${SKIP_TESTS:-"false"}
if [[ "${SKIP_TESTS}" == "true" ]]; then
# if skip test, we could try speed up build with multiple-threads
MVN="${MVN} -T1C"
fi

set +H # turn off history expansion
DEPLOY_SUBMODULES=${DEPLOY_SUBMODULES:-"!${DIST_PL}"} # TODO: deploy only required submodules to save time
for buildver in "${SPARK_SHIM_VERSIONS[@]:1}"; do
Expand Down Expand Up @@ -129,25 +135,34 @@ for buildver in "${SPARK_SHIM_VERSIONS[@]:1}"; do
done

installDistArtifact() {
local cuda_classifier="$1"
local cuda_version="$1"
local opt="$2"
$MVN -B clean install \
$opt \
$DIST_PROFILE_OPT \
-Dbuildver=$SPARK_BASE_SHIM_VERSION \
$MVN_URM_MIRROR \
-Dmaven.repo.local=$M2DIR \
-Dcuda.version=$cuda_classifier \
-Dcuda.version=$cuda_version \
-DskipTests=$SKIP_TESTS
}

# build extra cuda classifiers
if (( ${#CUDA_CLASSIFIERS_ARR[@]} > 1 )); then
if (( ${#CLASSIFIERS_ARR[@]} > 1 )); then
mkdir -p ${TMP_PATH}
for classifier in "${CUDA_CLASSIFIERS_ARR[@]}"; do
for classifier in "${CLASSIFIERS_ARR[@]}"; do
if [ "${classifier}" == "${DEFAULT_CUDA_CLASSIFIER}" ]; then
echo "skip default: ${DEFAULT_CUDA_CLASSIFIER} in build extra cuda classifiers step..."
continue
fi
installDistArtifact ${classifier}

opt=""
if [[ "${classifier}" == *"-arm64" ]]; then
opt="-Parm64"
fi
# pass cuda version and extra opt
installDistArtifact ${classifier%%-*} ${opt}

# move artifacts to temp for deployment later
artifactFile="${ART_ID}-${ART_VER}-${classifier}.jar"
mv ${DIST_PL}/target/${artifactFile} ${TMP_PATH}/
Expand Down

0 comments on commit f7b8349

Please sign in to comment.