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.

150 lines
4.7 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
  17. CLOUD_REGION=europe-west1-b
  18. - >-
  19. KUBE_NETWORK_PLUGIN=calico
  20. CLOUD_IMAGE=debian-8
  21. CLOUD_REGION=us-central1-c
  22. - >-
  23. KUBE_NETWORK_PLUGIN=weave
  24. CLOUD_IMAGE=debian-8
  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. before_install:
  83. # Install Ansible.
  84. - pip install --user boto -U
  85. - pip install --user ansible
  86. - pip install --user netaddr
  87. - pip install --user apache-libcloud
  88. cache:
  89. - directories:
  90. - $HOME/.cache/pip
  91. - $HOME/.local
  92. before_script:
  93. - echo "RUN $TRAVIS_JOB_NUMBER $KUBE_NETWORK_PLUGIN $CONTAINER_ENGINE "
  94. - mkdir -p $HOME/.ssh
  95. - echo $PRIVATE_KEY | base64 -d > $HOME/.ssh/id_rsa
  96. - echo $GCE_PEM_FILE | base64 -d > $HOME/.ssh/gce
  97. - chmod 400 $HOME/.ssh/id_rsa
  98. - chmod 755 $HOME/.local/bin/ansible-playbook
  99. - $HOME/.local/bin/ansible-playbook --version
  100. - cp tests/ansible.cfg .
  101. # - "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"
  102. script:
  103. - >
  104. $HOME/.local/bin/ansible-playbook tests/cloud_playbooks/create-gce.yml -i tests/local_inventory/hosts -c local $LOG_LEVEL
  105. -e test_id=${TEST_ID}
  106. -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
  107. -e gce_project_id=${GCE_PROJECT_ID}
  108. -e gce_service_account_email=${GCE_ACCOUNT}
  109. -e gce_pem_file=${HOME}/.ssh/gce
  110. -e cloud_image=${CLOUD_IMAGE}
  111. -e inventory_path=${PWD}/inventory/inventory.ini
  112. -e cloud_region=${CLOUD_REGION}
  113. # Create cluster
  114. - "$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"
  115. # Tests Cases
  116. ## Test Master API
  117. - $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini tests/testcases/010_check-apiserver.yml $LOG_LEVEL
  118. ## Create a POD
  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 tests/testcases/020_check-create-pod.yml $LOG_LEVEL
  120. ## Ping the between 2 pod
  121. - $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
  122. after_script:
  123. - >
  124. $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini tests/cloud_playbooks/delete-gce.yml -c local $LOG_LEVEL
  125. -e test_id=${TEST_ID}
  126. -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
  127. -e gce_project_id=${GCE_PROJECT_ID}
  128. -e gce_service_account_email=${GCE_ACCOUNT}
  129. -e gce_pem_file=${HOME}/.ssh/gce
  130. -e cloud_image=${CLOUD_IMAGE}
  131. -e inventory_path=${PWD}/inventory/inventory.ini
  132. -e cloud_region=${CLOUD_REGION}