nicolaferraro closed pull request #165: Ci integration tests URL: https://github.com/apache/camel-k/pull/165
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..6b9e372 --- /dev/null +++ b/.dockerignore @@ -0,0 +1 @@ +openshift.local.clusterup* \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 28b3a4b..13d1d39 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,19 @@ +sudo: required + language: go go: - "1.10.x" +env: + global: + - OPENSHIFT_VERSION=3.10.0 + - OPENSHIFT_COMMIT=dd10d17 + +services: + - docker + +script: + - make + - ./build/prepare_integration_tests_travis.sh + - make test-integration diff --git a/build/prepare_integration_tests_travis.sh b/build/prepare_integration_tests_travis.sh new file mode 100755 index 0000000..4b546dc --- /dev/null +++ b/build/prepare_integration_tests_travis.sh @@ -0,0 +1,61 @@ +#!/bin/sh + +set -e + +# set docker0 to promiscuous mode +sudo ip link set docker0 promisc on + +# Download and install the oc binary +sudo mount --make-shared / +sudo service docker stop +sudo sed -i 's/DOCKER_OPTS=\"/DOCKER_OPTS=\"--insecure-registry 172.30.0.0\/16 /' /etc/default/docker +sudo service docker start +wget https://github.com/openshift/origin/releases/download/v$OPENSHIFT_VERSION/openshift-origin-client-tools-v$OPENSHIFT_VERSION-$OPENSHIFT_COMMIT-linux-64bit.tar.gz +tar xvzOf openshift-origin-client-tools-v$OPENSHIFT_VERSION-$OPENSHIFT_COMMIT-linux-64bit.tar.gz > oc.bin +sudo mv oc.bin /usr/local/bin/oc +sudo chmod 755 /usr/local/bin/oc + +# Figure out this host's IP address +IP_ADDR="$(ip addr show eth0 | grep "inet\b" | awk '{print $2}' | cut -d/ -f1)" + +# Start OpenShift +oc cluster up --public-hostname=$IP_ADDR + +oc login -u system:admin + +# Wait until we have a ready node in openshift +TIMEOUT=0 +TIMEOUT_COUNT=60 +until [ $TIMEOUT -eq $TIMEOUT_COUNT ]; do + if [ -n "$(oc get nodes | grep Ready)" ]; then + break + fi + + echo "openshift is not up yet" + let TIMEOUT=TIMEOUT+1 + sleep 5 +done + +if [ $TIMEOUT -eq $TIMEOUT_COUNT ]; then + echo "Failed to start openshift" + exit 1 +fi + +echo "openshift is deployed and reachable" +oc describe nodes + +echo "Adding maven artifacts to the image context" +./build/package_maven_artifacts.sh + +echo "Copying binary file to docker dir" +mkdir -p ./tmp/_output/bin +cp ./camel-k-operator ./tmp/_output/bin/ + +echo "Building the images" +export IMAGE=docker.io/apache/camel-k:$(./build/get_version.sh) +./tmp/build/docker_build.sh + +echo "installing camel k cluster resources" +./kamel install --cluster-setup + +oc login -u developer ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services
