Skip to content

Commit d94e5eb

Browse files
authored
Enable CI against Kubernetes 1.7 (#37)
* adding e2e-prow script * uncomment lines * newline * newline * Address one round of comments * Update e2e-prow.sh
1 parent da01bda commit d94e5eb

File tree

3 files changed

+103
-15
lines changed

3 files changed

+103
-15
lines changed

dev/dev-run-integration-tests.sh

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
# limitations under the License.
1818
#
1919

20+
source ./include/util.sh
21+
2022
TEST_ROOT_DIR=$(git rev-parse --show-toplevel)
2123
BRANCH="master"
2224
SPARK_REPO="https://github.com/apache/spark"
@@ -78,21 +80,7 @@ done
7880
if [[ $SPARK_TGZ == "N/A" ]];
7981
then
8082
echo "Cloning $SPARK_REPO into $SPARK_REPO_LOCAL_DIR and checking out $BRANCH."
81-
82-
# clone spark distribution if needed.
83-
if [ -d "$SPARK_REPO_LOCAL_DIR" ];
84-
then
85-
(cd $SPARK_REPO_LOCAL_DIR && git fetch origin $BRANCH);
86-
else
87-
mkdir -p $SPARK_REPO_LOCAL_DIR;
88-
git clone -b $BRANCH --single-branch $SPARK_REPO $SPARK_REPO_LOCAL_DIR;
89-
fi
90-
cd $SPARK_REPO_LOCAL_DIR
91-
git checkout -B $BRANCH origin/$BRANCH
92-
./dev/make-distribution.sh --tgz -Phadoop-2.7 -Pkubernetes -DskipTests;
93-
SPARK_TGZ=$(find $SPARK_REPO_LOCAL_DIR -name spark-*.tgz)
94-
echo "Built Spark TGZ at $SPARK_TGZ".
95-
cd -
83+
clone_build_spark $SPARK_REPO $SPARK_REPO_LOCAL_DIR $BRANCH
9684
fi
9785

9886
cd $TEST_ROOT_DIR

e2e/e2e-prow.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
### This script is used by Kubernetes Test Infrastructure to run integration tests.
19+
### See documenation at https://github.com/kubernetes/test-infra/tree/master/prow
20+
21+
set -ex
22+
23+
# Include requisite scripts
24+
source ./include/util.sh
25+
26+
TEST_ROOT_DIR=$(git rev-parse --show-toplevel)
27+
BRANCH="master"
28+
SPARK_REPO="https://github.com/apache/spark"
29+
SPARK_REPO_LOCAL_DIR="$TEST_ROOT_DIR/target/spark"
30+
31+
## Install basic dependencies
32+
## These are for the kubekins-e2e environment in https://github.com/kubernetes/test-infra/tree/master/images/kubekins-e2e
33+
echo "deb http://http.debian.net/debian jessie-backports main" >> /etc/apt/sources.list
34+
apt-get update && apt-get install -y curl wget git tar uuid-runtime
35+
apt-get install -t jessie-backports -y openjdk-8-jdk
36+
37+
# Set up config.
38+
MASTER=$(kubectl cluster-info | head -n 1 | grep -oE "https?://[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(:[0-9]+)?")
39+
40+
# Special GCP project for publishing docker images built by test.
41+
IMAGE_REPO="gcr.io/spark-testing-191023"
42+
43+
# Cloning the spark distribution
44+
echo "Cloning $SPARK_REPO into $SPARK_REPO_LOCAL_DIR and checking out $BRANCH."
45+
clone_build_spark $SPARK_REPO $SPARK_REPO_LOCAL_DIR $BRANCH
46+
47+
# Spark distribution
48+
properties=(
49+
-Dspark.kubernetes.test.master=k8s://$MASTER \
50+
-Dspark.kubernetes.test.imageRepo=$IMAGE_REPO \
51+
-Dspark.kubernetes.test.sparkTgz="$SPARK_TGZ" \
52+
-Dspark.kubernetes.test.deployMode=cloud \
53+
-Dspark.kubernetes.test.namespace=default \
54+
-Dspark.kubernetes.test.serviceAccountName=default
55+
)
56+
57+
# Run tests.
58+
echo "Starting test with ${properties[@]}"
59+
build/mvn integration-test "${properties[@]}"
60+
61+
# Copy out the junit xml files for consumption by k8s test-infra.
62+
ls -1 ./integration-test/target/surefire-reports/*.xml | cat -n | while read n f; do cp "$f" "/workspace/_artifacts/junit_0$n.xml"; done

include/util.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
3+
# Licensed to the Apache Software Foundation (ASF) under one or more
4+
# contributor license agreements. See the NOTICE file distributed with
5+
# this work for additional information regarding copyright ownership.
6+
# The ASF licenses this file to You under the Apache License, Version 2.0
7+
# (the "License"); you may not use this file except in compliance with
8+
# the License. You may obtain a copy of the License at
9+
#
10+
# http://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# Unless required by applicable law or agreed to in writing, software
13+
# distributed under the License is distributed on an "AS IS" BASIS,
14+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
# See the License for the specific language governing permissions and
16+
# limitations under the License.
17+
18+
clone_build_spark() {
19+
spark_repo=$1
20+
spark_repo_local_dir=$2
21+
branch=$3
22+
pushd .
23+
24+
# clone spark distribution if needed.
25+
if [ -d "$spark_repo_local_dir" ];
26+
then
27+
(cd $spark_repo_local_dir && git fetch origin $branch);
28+
else
29+
mkdir -p $spark_repo_local_dir;
30+
git clone -b $branch --single-branch $spark_repo $spark_repo_local_dir;
31+
fi
32+
cd $spark_repo_local_dir
33+
git checkout -B $branch origin/$branch
34+
./dev/make-distribution.sh --tgz -Phadoop-2.7 -Pkubernetes -DskipTests;
35+
SPARK_TGZ=$(find $spark_repo_local_dir -name spark-*.tgz)
36+
37+
popd
38+
}

0 commit comments

Comments
 (0)