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.

155 lines
5.1 KiB

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