You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

143 lines
4.7 KiB

  1. sudo: false
  2. git:
  3. depth: 5
  4. env:
  5. global:
  6. GCE_USER=travis
  7. SSH_USER=$GCE_USER
  8. TEST_ID=$TRAVIS_JOB_NUMBER
  9. CONTAINER_ENGINE=docker
  10. PRIVATE_KEY=$GCE_PRIVATE_KEY
  11. ANSIBLE_KEEP_REMOTE_FILES=1
  12. matrix:
  13. # Debian Jessie
  14. - >-
  15. KUBE_NETWORK_PLUGIN=flannel
  16. CLOUD_IMAGE=debian-8
  17. CLOUD_REGION=europe-west1-b
  18. - >-
  19. KUBE_NETWORK_PLUGIN=calico
  20. CLOUD_IMAGE=debian-8
  21. CLOUD_REGION=europe-west1-b
  22. - >-
  23. KUBE_NETWORK_PLUGIN=weave
  24. CLOUD_IMAGE=debian-8
  25. CLOUD_REGION=europe-west1-b
  26. # Centos 7
  27. - >-
  28. KUBE_NETWORK_PLUGIN=flannel
  29. CLOUD_IMAGE=centos-7-sudo
  30. CLOUD_REGION=us-central1-c
  31. # - >-
  32. # KUBE_NETWORK_PLUGIN=calico
  33. # CLOUD_IMAGE=centos-7-sudo
  34. # CLOUD_REGION=us-central1-c
  35. # # Redhat 7
  36. - >-
  37. KUBE_NETWORK_PLUGIN=flannel
  38. CLOUD_IMAGE=rhel-7-sudo
  39. CLOUD_REGION=us-east1-d
  40. # - >-
  41. # KUBE_NETWORK_PLUGIN=calico
  42. # CLOUD_IMAGE=rhel-7-sudo
  43. # CLOUD_REGION=us-east1-d
  44. # Ubuntu 14.04
  45. - >-
  46. KUBE_NETWORK_PLUGIN=flannel
  47. CLOUD_IMAGE=ubuntu-1404-trusty
  48. CLOUD_REGION=europe-west1-c
  49. - >-
  50. KUBE_NETWORK_PLUGIN=calico
  51. CLOUD_IMAGE=ubuntu-1404-trusty
  52. CLOUD_REGION=europe-west1-c
  53. - >-
  54. KUBE_NETWORK_PLUGIN=weave
  55. CLOUD_IMAGE=ubuntu-1404-trusty
  56. CLOUD_REGION=europe-west1-c
  57. # Ubuntu 15.10
  58. - >-
  59. KUBE_NETWORK_PLUGIN=flannel
  60. CLOUD_IMAGE=ubuntu-1510-wily
  61. CLOUD_REGION=us-central1-a
  62. - >-
  63. KUBE_NETWORK_PLUGIN=calico
  64. CLOUD_IMAGE=ubuntu-1510-wily
  65. CLOUD_REGION=us-central1-a
  66. - >-
  67. KUBE_NETWORK_PLUGIN=weave
  68. CLOUD_IMAGE=ubuntu-1510-wily
  69. CLOUD_REGION=us-central1-a
  70. matrix:
  71. allow_failures:
  72. - env: KUBE_NETWORK_PLUGIN=flannel CLOUD_IMAGE=centos-7-sudo CLOUD_REGION=us-central1-c
  73. - env: KUBE_NETWORK_PLUGIN=flannel CLOUD_IMAGE=rhel-7-sudo CLOUD_REGION=us-east1-d
  74. - env: KUBE_NETWORK_PLUGIN=weave CLOUD_IMAGE=ubuntu-1404-trusty CLOUD_REGION=europe-west1-c
  75. - env: KUBE_NETWORK_PLUGIN=calico CLOUD_IMAGE=ubuntu-1404-trusty CLOUD_REGION=europe-west1-c
  76. before_install:
  77. # Install Ansible.
  78. - pip install --user boto -U
  79. - pip install --user ansible
  80. - pip install --user netaddr
  81. - pip install --user apache-libcloud
  82. cache:
  83. - directories:
  84. - $HOME/.cache/pip
  85. - $HOME/.local
  86. before_script:
  87. - echo "RUN $TRAVIS_JOB_NUMBER $KUBE_NETWORK_PLUGIN $CONTAINER_ENGINE "
  88. - mkdir -p $HOME/.ssh
  89. - echo $PRIVATE_KEY | base64 -d > $HOME/.ssh/id_rsa
  90. - echo $GCE_PEM_FILE | base64 -d > $HOME/.ssh/gce
  91. - chmod 400 $HOME/.ssh/id_rsa
  92. - chmod 755 $HOME/.local/bin/ansible-playbook
  93. - $HOME/.local/bin/ansible-playbook --version
  94. - cp tests/ansible.cfg .
  95. # - "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"
  96. script:
  97. - >
  98. $HOME/.local/bin/ansible-playbook tests/cloud_playbooks/create-gce.yml -i tests/local_inventory/hosts -c local $LOG_LEVEL
  99. -e test_id=${TEST_ID}
  100. -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
  101. -e gce_project_id=${GCE_PROJECT_ID}
  102. -e gce_service_account_email=${GCE_ACCOUNT}
  103. -e gce_pem_file=${HOME}/.ssh/gce
  104. -e cloud_image=${CLOUD_IMAGE}
  105. -e inventory_path=${PWD}/inventory/inventory.ini
  106. -e cloud_region=${CLOUD_REGION}
  107. # Create cluster
  108. - "$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\": true}' $LOG_LEVEL -e kube_network_plugin=${KUBE_NETWORK_PLUGIN} cluster.yml"
  109. # Tests Cases
  110. ## Test Master API
  111. - $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini tests/testcases/010_check-apiserver.yml $LOG_LEVEL
  112. ## Create a POD
  113. - $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/020_check-create-pod.yml $LOG_LEVEL
  114. ## Ping the between 2 pod
  115. - $HOME/.local/bin/ansible-playbook -i setup-kubernetes/inventory/inventory.ini -u $SSH_USER -e ansible_ssh_user=$SSH_USER $SSH_ARGS -b --become-user=root tests/testcases/030_check-network.yml $LOG_LEVEL
  116. after_script:
  117. - >
  118. $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini tests/cloud_playbooks/delete-gce.yml -c local $LOG_LEVEL
  119. -e test_id=${TEST_ID}
  120. -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
  121. -e gce_project_id=${GCE_PROJECT_ID}
  122. -e gce_service_account_email=${GCE_ACCOUNT}
  123. -e gce_pem_file=${HOME}/.ssh/gce
  124. -e cloud_image=${CLOUD_IMAGE}
  125. -e inventory_path=${PWD}/inventory/inventory.ini
  126. -e cloud_region=${CLOUD_REGION}