Skip to content

Commit

Permalink
Initial setup for openshift integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaferraro committed Oct 25, 2018
1 parent bf9609f commit 02bbdc7
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 0 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
openshift.local.clusterup*
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -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
57 changes: 57 additions & 0 deletions build/prepare_integration_tests_travis.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/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 "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

0 comments on commit 02bbdc7

Please sign in to comment.