Skip to content
.travis.yml 5.28 KiB
Newer Older
sudo: required

services:
  - docker
ant31's avatar
ant31 committed

ant31's avatar
ant31 committed
git:
  depth: 5
ant31's avatar
ant31 committed

env:
ant31's avatar
ant31 committed
  global:
    GCE_USER=travis
    SSH_USER=$GCE_USER
    TEST_ID=$TRAVIS_JOB_NUMBER
    CONTAINER_ENGINE=docker
    PRIVATE_KEY=$GCE_PRIVATE_KEY
    GS_ACCESS_KEY_ID=$GS_KEY
    GS_SECRET_ACCESS_KEY=$GS_SECRET
ant31's avatar
ant31 committed
    ANSIBLE_KEEP_REMOTE_FILES=1
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
    CLUSTER_MODE=default
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
    BOOTSTRAP_OS=none
ant31's avatar
ant31 committed
  matrix:
    # Debian Jessie
    - >-
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      KUBE_NETWORK_PLUGIN=canal
      CLOUD_IMAGE=debian-8
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLOUD_REGION=europe-west1-d
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLUSTER_MODE=default
ant31's avatar
ant31 committed
    - >-
      KUBE_NETWORK_PLUGIN=calico
      CLOUD_IMAGE=debian-8
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLOUD_REGION=us-central1-b
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLUSTER_MODE=default
ant31's avatar
ant31 committed

ant31's avatar
ant31 committed
    # Centos 7
    - >-
      KUBE_NETWORK_PLUGIN=flannel
      CLOUD_IMAGE=centos-7
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLOUD_REGION=europe-west1-d
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLUSTER_MODE=default
Smana's avatar
Smana committed
    - >-
      KUBE_NETWORK_PLUGIN=calico
      CLOUD_IMAGE=centos-7
Smana's avatar
Smana committed
      CLOUD_REGION=europe-west1-b
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLUSTER_MODE=default
Smana's avatar
Smana committed
   # Redhat 7
    - >-
      KUBE_NETWORK_PLUGIN=weave
      CLOUD_IMAGE=rhel-7
Smana's avatar
Smana committed
      CLOUD_REGION=europe-west1-b
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLUSTER_MODE=default
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
    # CoreOS stable
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
    #- >-
    #  KUBE_NETWORK_PLUGIN=weave
    #  CLOUD_IMAGE=coreos-stable
    #  CLOUD_REGION=europe-west1-a
    #  CLUSTER_MODE=default
    #  BOOTSTRAP_OS=coreos
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
    - >-
      KUBE_NETWORK_PLUGIN=canal
      CLOUD_IMAGE=coreos-stable
      CLOUD_REGION=us-east1-d
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLUSTER_MODE=default
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      BOOTSTRAP_OS=coreos
ant31's avatar
ant31 committed

Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
    # Extra cases for separated roles
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      KUBE_NETWORK_PLUGIN=canal
      CLOUD_IMAGE=rhel-7
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLOUD_REGION=europe-west1-c
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLUSTER_MODE=separate
    - >-
      KUBE_NETWORK_PLUGIN=weave
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLOUD_IMAGE=ubuntu-1604-xenial
      CLOUD_REGION=us-west1-b
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLUSTER_MODE=separate
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
    - >-
      KUBE_NETWORK_PLUGIN=calico
      CLOUD_IMAGE=coreos-stable
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLOUD_REGION=us-central1-f
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
      CLUSTER_MODE=separate
      BOOTSTRAP_OS=coreos
matrix:
  allow_failures:
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
    - env: KUBE_NETWORK_PLUGIN=weave CLOUD_IMAGE=coreos-stable CLOUD_REGION=europe-west1-a CLUSTER_MODE=default BOOTSTRAP_OS=coreos
ant31's avatar
ant31 committed

before_install:
ant31's avatar
ant31 committed
  # Install Ansible.
ant31's avatar
ant31 committed
  - pip install --user ansible
  - pip install --user netaddr
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
  # W/A https://github.com/ansible/ansible-modules-core/issues/5196#issuecomment-253766186
  - pip install --user apache-libcloud==0.20.1
  - pip install --user boto==2.9.0 -U
  # Load cached docker images
  - if [ -d /var/tmp/releases ]; then find /var/tmp/releases -type f -name "*.tar" | xargs -I {} sh -c "zcat {} | docker load"; fi
ant31's avatar
ant31 committed

cache:
ant31's avatar
ant31 committed
  - directories:
ant31's avatar
ant31 committed
    - $HOME/.cache/pip
ant31's avatar
ant31 committed
    - $HOME/.local
    - /var/tmp/releases
ant31's avatar
ant31 committed

before_script:
ant31's avatar
ant31 committed
  - echo "RUN $TRAVIS_JOB_NUMBER $KUBE_NETWORK_PLUGIN $CONTAINER_ENGINE "
  - mkdir -p $HOME/.ssh
  - echo $PRIVATE_KEY | base64 -d > $HOME/.ssh/id_rsa
  - echo $GCE_PEM_FILE | base64 -d > $HOME/.ssh/gce
  - chmod 400 $HOME/.ssh/id_rsa
  - chmod 755 $HOME/.local/bin/ansible-playbook
  - $HOME/.local/bin/ansible-playbook --version
  - cp tests/ansible.cfg .
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
  - export PYPATH=$([ $BOOTSTRAP_OS = none ] && echo /usr/bin/python || echo /opt/bin/python)
ant31's avatar
ant31 committed
#  - "echo $HOME/.local/bin/ansible-playbook -i inventory.ini -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root -e '{\"cloud_provider\": true}'  $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} setup-kubernetes/cluster.yml"
ant31's avatar
ant31 committed

script:
ant31's avatar
ant31 committed
  - >
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
    $HOME/.local/bin/ansible-playbook tests/cloud_playbooks/create-gce.yml -i tests/local_inventory/hosts.cfg -c local $LOG_LEVEL
    -e mode=${CLUSTER_MODE}
ant31's avatar
ant31 committed
    -e test_id=${TEST_ID}
    -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
    -e gce_project_id=${GCE_PROJECT_ID}
    -e gce_service_account_email=${GCE_ACCOUNT}
    -e gce_pem_file=${HOME}/.ssh/gce
    -e cloud_image=${CLOUD_IMAGE}
    -e inventory_path=${PWD}/inventory/inventory.ini
    -e cloud_region=${CLOUD_REGION}
ant31's avatar
ant31 committed

ant31's avatar
ant31 committed
    # Create cluster
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
  - >
    $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS
    -b --become-user=root -e cloud_provider=gce  $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
    -e bootstrap_os=${BOOTSTRAP_OS}
    -e ansible_python_interpreter=${PYPATH}
    -e download_run_once=true
    -e download_localhost=true
    -e local_release_dir=/var/tmp/releases
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
    cluster.yml

ant31's avatar
ant31 committed
    # Tests Cases
    ## Test Master API
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
  - $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} tests/testcases/010_check-apiserver.yml $LOG_LEVEL
ant31's avatar
ant31 committed
    ## Create a POD
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
  - $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/020_check-create-pod.yml $LOG_LEVEL
ant31's avatar
ant31 committed
    ## Ping the between 2 pod
Bogdan Dobrelya's avatar
Bogdan Dobrelya committed
  - $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini -e ansible_python_interpreter=${PYPATH} -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/030_check-network.yml $LOG_LEVEL
ant31's avatar
ant31 committed
after_script:
ant31's avatar
ant31 committed
  - >
ant31's avatar
ant31 committed
    $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini tests/cloud_playbooks/delete-gce.yml -c local  $LOG_LEVEL
    -e test_id=${TEST_ID}
    -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
    -e gce_project_id=${GCE_PROJECT_ID}
    -e gce_service_account_email=${GCE_ACCOUNT}
    -e gce_pem_file=${HOME}/.ssh/gce
    -e cloud_image=${CLOUD_IMAGE}
    -e inventory_path=${PWD}/inventory/inventory.ini
    -e cloud_region=${CLOUD_REGION}