|
| 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 | +usage () { |
| 19 | + echo "Usage:" |
| 20 | + echo " ./e2e/e2e-cloud.sh -h Display this help message." |
| 21 | + echo " ./e2e/e2e-cloud.sh -m <master-url> -r <spark-repo> -i <image-repo>" |
| 22 | + echo " note that you must have kubectl configured to access the specified" |
| 23 | + echo " <master-url>. Also you must have access to the <image-repo>. " |
| 24 | +} |
| 25 | + |
| 26 | +### Basic Validation ### |
| 27 | +if [ ! -d "integration-test" ]; then |
| 28 | + echo "This script must be invoked from the top-level directory of the integration-tests repository" |
| 29 | + usage |
| 30 | + exit 1 |
| 31 | +fi |
| 32 | + |
| 33 | +### Set sensible defaults ### |
| 34 | +REPO="https://github.com/apache/spark" |
| 35 | +IMAGE_REPO="docker.io/kubespark" |
| 36 | + |
| 37 | +### Parse options ### |
| 38 | +while getopts m:r:i:h option |
| 39 | +do |
| 40 | + case "${option}" |
| 41 | + in |
| 42 | + h) |
| 43 | + usage |
| 44 | + exit 0 |
| 45 | + ;; |
| 46 | + m) MASTER=${OPTARG};; |
| 47 | + r) REPO=${OPTARG};; |
| 48 | + i) IMAGE_REPO=${OPTARG};; |
| 49 | + \? ) |
| 50 | + echo "Invalid Option: -$OPTARG" 1>&2 |
| 51 | + exit 1 |
| 52 | + ;; |
| 53 | + esac |
| 54 | +done |
| 55 | + |
| 56 | +### Ensure cluster is set. |
| 57 | +if [ -z "$MASTER" ] |
| 58 | +then |
| 59 | + echo "Missing master-url (-m) argument." |
| 60 | + echo "" |
| 61 | + usage |
| 62 | + exit |
| 63 | +fi |
| 64 | + |
| 65 | +echo "Running tests on cluster $MASTER against $REPO." |
| 66 | +echo "Spark images will be created in $IMAGE_REPO" |
| 67 | + |
| 68 | +set -ex |
| 69 | +root=$(pwd) |
| 70 | + |
| 71 | +# clone spark distribution if needed. |
| 72 | +if [ -d "spark" ]; |
| 73 | +then |
| 74 | + (cd spark && git pull); |
| 75 | +else |
| 76 | + git clone $REPO; |
| 77 | +fi |
| 78 | + |
| 79 | +cd spark && ./dev/make-distribution.sh --tgz -Phadoop-2.7 -Pkubernetes -DskipTests |
| 80 | +tag=$(git rev-parse HEAD | cut -c -6) |
| 81 | +echo "Spark distribution built at SHA $tag" |
| 82 | + |
| 83 | +cd dist && ./sbin/build-push-docker-images.sh -r $IMAGE_REPO -t $tag build |
| 84 | +if [[ $IMAGE_REPO == gcr.io* ]] ; |
| 85 | +then |
| 86 | + gcloud docker -- push $IMAGE_REPO/spark-driver:$tag && \ |
| 87 | + gcloud docker -- push $IMAGE_REPO/spark-executor:$tag && \ |
| 88 | + gcloud docker -- push $IMAGE_REPO/spark-init:$tag |
| 89 | +else |
| 90 | + ./sbin/build-push-docker-images.sh -r $IMAGE_REPO -t $tag push |
| 91 | +fi |
| 92 | + |
| 93 | +cd $root/integration-test |
| 94 | +$root/spark/build/mvn clean -Ddownload.plugin.skip=true integration-test \ |
| 95 | + -Dspark-distro-tgz=$root/spark/*.tgz \ |
| 96 | + -DextraScalaTestArgs="-Dspark.kubernetes.test.master=k8s://$MASTER \ |
| 97 | + -Dspark.docker.test.driverImage=$IMAGE_REPO/spark-driver:$tag \ |
| 98 | + -Dspark.docker.test.executorImage=$IMAGE_REPO/spark-executor:$tag" || : |
| 99 | + |
| 100 | +echo "TEST SUITE FINISHED" |
0 commit comments