Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy release candidates to local maven repo for dependency check[skip ci] #10201

Merged
merged 5 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 47 additions & 0 deletions jenkins/dependency-check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/bin/bash
#
# Copyright (c) 2024, NVIDIA CORPORATION. All rights reserved.
#
# Licensed 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 file checks whether all the dependency jar or pom files for the specified
# artifacts defined in the file "$ARTIFACT_FILE" are available
# in the "$SERVER_ID::default::$SERVER_URL" maven repo


tgravescs marked this conversation as resolved.
Show resolved Hide resolved
# Argument(s):
# ARTIFACT_FILE : Artifact(groupId:artifactId:version:[[packaging]:classifier]) list file
#
# Used environment(s):
# SERVER_ID: The repository id for this deployment.
# SERVER_URL: The url where to deploy artifacts.
# M2_CACHE: Maven local repo
###

set -ex

ARTIFACT_FILE=${1:-"/tmp/artifacts-list"}
Copy link
Collaborator Author

@NvTimLiu NvTimLiu Jan 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

artifact list file created by deploy.sh, e.g.,

com.nvidia:rapids-4-spark-parent_2.12:24.02.0-SNAPSHOT:pom
com.nvidia:rapids-4-spark-jdk-profiles_2.12:24.02.0-SNAPSHOT:pom
com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:pom
com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:jar
com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:jar:cuda11
com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:jar:sources
com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:jar:javadoc

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should

com.nvidia:rapids-4-spark-parent_2.12:24.02.0-SNAPSHOT:pom
com.nvidia:rapids-4-spark-jdk-profiles_2.12:24.02.0-SNAPSHOT:pom

be in this list?

When we do the test with mvn dependency:get for the documented artifacts such as com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:jar:cuda11 and one of the pom-type artifacts above is missing we should see a failure anyways, correct?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gerashegalov Yes, you're right, jar's dependency contain the pom files!

My original thought was to check anything we deployed, though pom check would be duplicated.

Let me remove pom from the check list.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, artifact list will be like

com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:jar
com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:jar:cuda11
com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:jar:cuda12
com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:jar:sources
com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:jar:javadoc

similar list for scala-2.13 jars, and for arm64 jars

SERVER_ID=${SERVER_ID:-"snapshots"}
SERVER_URL=${SERVER_URL:-"file:/tmp/local-release-repo"}
M2_CACHE=${M2_CACHE:-"/tmp/m2-cache"}

remote_maven_repo=$SERVER_ID::default::$SERVER_URL
# Get the spark-rapids-jni and spark-rapids-private jars from OSS Snapshot maven repo
if [ "$SERVER_ID" == "snapshots" ]; then
oss_snapshot_url="https://oss.sonatype.org/content/repositories/snapshots"
remote_maven_repo="$remote_maven_repo,$SERVER_ID::default::$oss_snapshot_url"
fi
while read line; do
artifact=$line # artifact=groupId:artifactId:version:[[packaging]:classifier]
mvn dependency:get -DremoteRepositories=$remote_maven_repo -Dmaven.repo.local=$M2_CACHE -Dartifact=$artifact
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missed in the original review: we should rm -r $M2_CACHE/com/nvidia before this line or even the whole $M2_CACHE to avoid side-effect of previous dependency:get

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, filed a follow-up PR for it #10278

done < $ARTIFACT_FILE
21 changes: 19 additions & 2 deletions jenkins/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
#
# Copyright (c) 2020-2023, NVIDIA CORPORATION. All rights reserved.
# Copyright (c) 2020-2024, NVIDIA CORPORATION. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,6 +50,12 @@ 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
SERVER_ID=${SERVER_ID:-"snapshots"}
SERVER_URL=${SERVER_URL:-"file:/tmp/local-release-repo"}
# Save to be deployed artifact list into the file, e.g.
ARTIFACT_FILE=${ARTIFACT_FILE:-"/tmp/artifact-file"}
# Clean rtifact list file befor saving
rm -rf $ARTIFACT_FILE

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 @@ -63,7 +69,7 @@ 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
source jenkins/version-def.sh >/dev/null 2>&1
echo $SPARK_BASE_SHIM_VERSION
SQL_ART_ID=$(mvnEval $SQL_PL project.artifactId)
SQL_ART_VER=$(mvnEval $SQL_PL project.version)
Expand Down Expand Up @@ -97,6 +103,10 @@ echo "Deploy CMD: $DEPLOY_CMD"
###### Deploy the parent pom file ######
$DEPLOY_CMD -Dfile=./pom.xml -DpomFile=./pom.xml

###### Deploy the jdk-profile pom file ######
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy pom.xml file of the module jdk-profiles here, to PASS the release artifact's dependency check

JDK_PROFILES=${JDK_PROFILES:-"jdk-profiles"}
$DEPLOY_CMD -Dfile=$JDK_PROFILES/pom.xml -DpomFile=$JDK_PROFILES/pom.xml

###### Deploy the artifact jar(s) ######
$DEPLOY_CMD -DpomFile=$POM_FILE \
-Dfile=$FPATH-$DEFAULT_CUDA_CLASSIFIER.jar \
Expand All @@ -105,3 +115,10 @@ $DEPLOY_CMD -DpomFile=$POM_FILE \
-Dfiles=$DEPLOY_FILES \
-Dtypes=$DEPLOY_TYPES \
-Dclassifiers=$CLASSIFIERS

echo "$ART_GROUP_ID:$ART_ID:$ART_VER:jar" >> $ARTIFACT_FILE
CLASSLIST="$CLASSIFIERS,sources,javadoc"
CLASSLIST=(${CLASSLIST//','/' '})
for class in ${CLASSLIST[@]}; do
echo "$ART_GROUP_ID:$ART_ID:$ART_VER:jar:$class" >> $ARTIFACT_FILE
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The artifact file is like below, and our plugin nightly build CI will check all these artifacts dependencies.

com.nvidia:rapids-4-spark-parent_2.12:24.02.0-SNAPSHOT:pom
com.nvidia:rapids-4-spark-jdk-profiles_2.12:24.02.0-SNAPSHOT:pom
com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:pom
com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:jar
com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:jar:cuda11
com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:jar:sources
com.nvidia:rapids-4-spark_2.12:24.02.0-SNAPSHOT:jar:javadoc

done
2 changes: 1 addition & 1 deletion jenkins/spark-nightly-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ WORKSPACE=${WORKSPACE:-$(pwd)}
export M2DIR=${M2DIR:-"$WORKSPACE/.m2"}

## MVN_OPT : maven options environment, e.g. MVN_OPT='-Dspark-rapids-jni.version=xxx' to specify spark-rapids-jni dependency's version.
MVN="mvn -Dmaven.wagon.http.retryHandler.count=3 -DretryFailedDeploymentCount=3 ${MVN_OPT}"
MVN="mvn -Dmaven.wagon.http.retryHandler.count=3 -DretryFailedDeploymentCount=3 ${MVN_OPT} -Psource-javadoc"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sources.jar and javadoc.jar files are required by OSS release

Generate these 2 files to mimic OSS release in our nightly build CI


DIST_PL="dist"
function mvnEval {
Expand Down