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.

145 lines
4.5 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 16.04
  53. - >-
  54. KUBE_NETWORK_PLUGIN=flannel
  55. CLOUD_IMAGE=ubuntu-1604-xenial
  56. CLOUD_REGION=us-central1-c
  57. - >-
  58. KUBE_NETWORK_PLUGIN=calico
  59. CLOUD_IMAGE=ubuntu-1604-xenial
  60. CLOUD_REGION=us-east1-d
  61. - >-
  62. KUBE_NETWORK_PLUGIN=weave
  63. CLOUD_IMAGE=ubuntu-1604-xenial
  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. before_install:
  79. # Install Ansible.
  80. - pip install --user boto -U
  81. - pip install --user ansible
  82. - pip install --user netaddr
  83. - pip install --user apache-libcloud
  84. cache:
  85. - directories:
  86. - $HOME/.cache/pip
  87. - $HOME/.local
  88. before_script:
  89. - echo "RUN $TRAVIS_JOB_NUMBER $KUBE_NETWORK_PLUGIN $CONTAINER_ENGINE "
  90. - mkdir -p $HOME/.ssh
  91. - echo $PRIVATE_KEY | base64 -d > $HOME/.ssh/id_rsa
  92. - echo $GCE_PEM_FILE | base64 -d > $HOME/.ssh/gce
  93. - chmod 400 $HOME/.ssh/id_rsa
  94. - chmod 755 $HOME/.local/bin/ansible-playbook
  95. - $HOME/.local/bin/ansible-playbook --version
  96. - cp tests/ansible.cfg .
  97. # - "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"
  98. script:
  99. - >
  100. $HOME/.local/bin/ansible-playbook tests/cloud_playbooks/create-gce.yml -i tests/local_inventory/hosts -c local $LOG_LEVEL
  101. -e test_id=${TEST_ID}
  102. -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
  103. -e gce_project_id=${GCE_PROJECT_ID}
  104. -e gce_service_account_email=${GCE_ACCOUNT}
  105. -e gce_pem_file=${HOME}/.ssh/gce
  106. -e cloud_image=${CLOUD_IMAGE}
  107. -e inventory_path=${PWD}/inventory/inventory.ini
  108. -e cloud_region=${CLOUD_REGION}
  109. # Create cluster
  110. - "$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"
  111. # Tests Cases
  112. ## Test Master API
  113. - $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini tests/testcases/010_check-apiserver.yml $LOG_LEVEL
  114. ## Create a POD
  115. - $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
  116. ## Ping the between 2 pod
  117. - $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
  118. after_script:
  119. - >
  120. $HOME/.local/bin/ansible-playbook -i inventory/inventory.ini tests/cloud_playbooks/delete-gce.yml -c local $LOG_LEVEL
  121. -e test_id=${TEST_ID}
  122. -e kube_network_plugin=${KUBE_NETWORK_PLUGIN}
  123. -e gce_project_id=${GCE_PROJECT_ID}
  124. -e gce_service_account_email=${GCE_ACCOUNT}
  125. -e gce_pem_file=${HOME}/.ssh/gce
  126. -e cloud_image=${CLOUD_IMAGE}
  127. -e inventory_path=${PWD}/inventory/inventory.ini
  128. -e cloud_region=${CLOUD_REGION}