Skip to content

Commit ca9a68d

Browse files
sarutakdongjoon-hyun
authored andcommitted
[SPARK-37529][K8S][TESTS][FOLLOWUP] Allow dev-run-integration-tests.sh to take a custom Dockerfile
### What changes were proposed in this pull request? This PR changes `dev-run-integration-tests.sh` to allow it to take a custom Dockerfile like #34790 did. With this change, this script accepts `--docker-file` option, which takes a path to a custom Dockerfile. ``` $ ./dev/run-integration-tests.sh --docker-file /path/to/dockerfile ``` ### Why are the changes needed? As of #34790, we can specify a custom Dockerfile by `spark.kubernetes.test.dockerFile` property when we run the K8s integration tests using Maven. We can run the integration test via `dev-run-integration-tests.sh` but there is no way to specify a custom Dockerfile. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Confirmed that the K8s integration tests run with the following command using `Dockerfile.java17`. ``` cd resource-managers/kubernetes/integration-tests ./dev/dev-run-integration-tests.sh --docker-file ../docker/src/main/dockerfiles/spark/Dockerfile.java17 ``` Closes #34818 from sarutak/kube-integration-test-java17-2. Authored-by: Kousuke Saruta <sarutak@oss.nttdata.com> Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
1 parent 88f5122 commit ca9a68d

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

resource-managers/kubernetes/integration-tests/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ To run tests with Java 11 instead of Java 8, use `--java-image-tag` to specify t
1717

1818
./dev/dev-run-integration-tests.sh --java-image-tag 11-jre-slim
1919

20+
To run tests with a custom docker image, use `--docker-file` to specify the Dockerfile.
21+
Note that if both `--docker-file` and `--java-image-tag` are used, `--docker-file` is preferred,
22+
and the custom Dockerfile need to include a Java installation by itself.
23+
Dockerfile.java17 is an example of custom Dockerfile, and you can specify it to run tests with Java 17.
24+
25+
./dev/dev-run-integration-tests.sh --docker-file ../docker/src/main/dockerfiles/spark/Dockerfile.java17
26+
2027
To run tests with Hadoop 2.x instead of Hadoop 3.x, use `--hadoop-profile`.
2128

2229
./dev/dev-run-integration-tests.sh --hadoop-profile hadoop-2
@@ -237,6 +244,13 @@ to the wrapper scripts and using the wrapper scripts will simply set these appro
237244
</td>
238245
<td><code>spark-r</code></td>
239246
</tr>
247+
<tr>
248+
<td><code>spark.kubernetes.test.dockerFile</code></td>
249+
<td>
250+
The path to the custom Dockerfile
251+
</td>
252+
<td><code>N/A</code></td>
253+
</tr>
240254
<tr>
241255
<td><code>spark.kubernetes.test.namespace</code></td>
242256
<td>

resource-managers/kubernetes/integration-tests/dev/dev-run-integration-tests.sh

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
set -exo errexit
2020
TEST_ROOT_DIR=$(git rev-parse --show-toplevel)
2121

22+
. $TEST_ROOT_DIR/build/util.sh
23+
2224
DEPLOY_MODE="minikube"
2325
IMAGE_REPO="docker.io/kubespark"
2426
SPARK_TGZ="N/A"
@@ -28,6 +30,7 @@ BASE_IMAGE_NAME=
2830
JVM_IMAGE_NAME=
2931
PYTHON_IMAGE_NAME=
3032
R_IMAGE_NAME=
33+
DOCKER_FILE=
3134
SPARK_MASTER=
3235
NAMESPACE=
3336
SERVICE_ACCOUNT=
@@ -70,6 +73,10 @@ while (( "$#" )); do
7073
SPARK_TGZ="$2"
7174
shift
7275
;;
76+
--docker-file)
77+
DOCKER_FILE="$2"
78+
shift
79+
;;
7380
--spark-master)
7481
SPARK_MASTER="$2"
7582
shift
@@ -143,6 +150,11 @@ then
143150
properties=( ${properties[@]} -Dspark.kubernetes.test.javaImageTag=$JAVA_IMAGE_TAG )
144151
fi
145152

153+
if [ -n "$DOCKER_FILE" ];
154+
then
155+
properties=( ${properties[@]} -Dspark.kubernetes.test.dockerFile=$(realpath $DOCKER_FILE) )
156+
fi
157+
146158
if [ -n "$NAMESPACE" ];
147159
then
148160
properties=( ${properties[@]} -Dspark.kubernetes.test.namespace=$NAMESPACE )
@@ -180,4 +192,14 @@ properties+=(
180192
-Dlog4j.logger.org.apache.spark=DEBUG
181193
)
182194

183-
$TEST_ROOT_DIR/build/mvn install -f $TEST_ROOT_DIR/pom.xml -pl resource-managers/kubernetes/integration-tests $BUILD_DEPENDENCIES_MVN_FLAG -Pscala-$SCALA_VERSION -P$HADOOP_PROFILE -Pkubernetes -Pkubernetes-integration-tests ${properties[@]}
195+
(
196+
cd $TEST_ROOT_DIR;
197+
./build/mvn install \
198+
-pl resource-managers/kubernetes/integration-tests \
199+
$BUILD_DEPENDENCIES_MVN_FLAG \
200+
-Pscala-$SCALA_VERSION \
201+
-P$HADOOP_PROFILE \
202+
-Pkubernetes \
203+
-Pkubernetes-integration-tests \
204+
${properties[@]}
205+
)

0 commit comments

Comments
 (0)