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.

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