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.

177 lines
5.3 KiB

  1. ---
  2. # Tests for contrib/terraform/
  3. .terraform_install:
  4. extends: .job
  5. before_script:
  6. - update-alternatives --install /usr/bin/python python /usr/bin/python3 1
  7. - ./tests/scripts/rebase.sh
  8. - ./tests/scripts/testcases_prepare.sh
  9. - ./tests/scripts/terraform_install.sh
  10. # Set Ansible config
  11. - cp ansible.cfg ~/.ansible.cfg
  12. # Prepare inventory
  13. - cp contrib/terraform/$PROVIDER/sample-inventory/cluster.tfvars .
  14. - ln -s contrib/terraform/$PROVIDER/hosts
  15. - terraform init contrib/terraform/$PROVIDER
  16. # Copy SSH keypair
  17. - mkdir -p ~/.ssh
  18. - echo "$PACKET_PRIVATE_KEY" | base64 -d > ~/.ssh/id_rsa
  19. - chmod 400 ~/.ssh/id_rsa
  20. - echo "$PACKET_PUBLIC_KEY" | base64 -d > ~/.ssh/id_rsa.pub
  21. .terraform_validate:
  22. extends: .terraform_install
  23. stage: unit-tests
  24. tags: [light]
  25. only: ['master', /^pr-.*$/]
  26. script:
  27. - terraform validate -var-file=cluster.tfvars contrib/terraform/$PROVIDER
  28. - terraform fmt -check -diff contrib/terraform/$PROVIDER
  29. .terraform_apply:
  30. extends: .terraform_install
  31. tags: [light]
  32. stage: deploy-part3
  33. when: manual
  34. only: [/^pr-.*$/]
  35. artifacts:
  36. paths:
  37. - cluster-dump/
  38. variables:
  39. ANSIBLE_INVENTORY_UNPARSED_FAILED: "true"
  40. ANSIBLE_INVENTORY: hosts
  41. CI_PLATFORM: tf
  42. TF_VAR_ssh_user: $SSH_USER
  43. TF_VAR_cluster_name: $CI_JOB_ID
  44. script:
  45. - tests/scripts/testcases_run.sh
  46. after_script:
  47. # Cleanup regardless of exit code
  48. - chronic ./tests/scripts/testcases_cleanup.sh
  49. tf-validate-openstack:
  50. extends: .terraform_validate
  51. variables:
  52. TF_VERSION: 0.12.24
  53. PROVIDER: openstack
  54. CLUSTER: $CI_COMMIT_REF_NAME
  55. tf-validate-packet:
  56. extends: .terraform_validate
  57. variables:
  58. TF_VERSION: 0.12.24
  59. PROVIDER: packet
  60. CLUSTER: $CI_COMMIT_REF_NAME
  61. tf-validate-aws:
  62. extends: .terraform_validate
  63. variables:
  64. TF_VERSION: 0.12.24
  65. PROVIDER: aws
  66. CLUSTER: $CI_COMMIT_REF_NAME
  67. # tf-packet-ubuntu16-default:
  68. # extends: .terraform_apply
  69. # variables:
  70. # TF_VERSION: 0.12.24
  71. # PROVIDER: packet
  72. # CLUSTER: $CI_COMMIT_REF_NAME
  73. # TF_VAR_number_of_k8s_masters: "1"
  74. # TF_VAR_number_of_k8s_nodes: "1"
  75. # TF_VAR_plan_k8s_masters: t1.small.x86
  76. # TF_VAR_plan_k8s_nodes: t1.small.x86
  77. # TF_VAR_facility: ewr1
  78. # TF_VAR_public_key_path: ""
  79. # TF_VAR_operating_system: ubuntu_16_04
  80. #
  81. # tf-packet-ubuntu18-default:
  82. # extends: .terraform_apply
  83. # variables:
  84. # TF_VERSION: 0.12.24
  85. # PROVIDER: packet
  86. # CLUSTER: $CI_COMMIT_REF_NAME
  87. # TF_VAR_number_of_k8s_masters: "1"
  88. # TF_VAR_number_of_k8s_nodes: "1"
  89. # TF_VAR_plan_k8s_masters: t1.small.x86
  90. # TF_VAR_plan_k8s_nodes: t1.small.x86
  91. # TF_VAR_facility: ams1
  92. # TF_VAR_public_key_path: ""
  93. # TF_VAR_operating_system: ubuntu_18_04
  94. .ovh_variables: &ovh_variables
  95. OS_AUTH_URL: https://auth.cloud.ovh.net/v3
  96. OS_PROJECT_ID: 8d3cd5d737d74227ace462dee0b903fe
  97. OS_PROJECT_NAME: "9361447987648822"
  98. OS_USER_DOMAIN_NAME: Default
  99. OS_PROJECT_DOMAIN_ID: default
  100. OS_USERNAME: 8XuhBMfkKVrk
  101. OS_REGION_NAME: UK1
  102. OS_INTERFACE: public
  103. OS_IDENTITY_API_VERSION: "3"
  104. tf-ovh_cleanup:
  105. stage: unit-tests
  106. tags: [light]
  107. image: python
  108. variables:
  109. <<: *ovh_variables
  110. before_script:
  111. - pip install -r scripts/openstack-cleanup/requirements.txt
  112. script:
  113. - ./scripts/openstack-cleanup/main.py
  114. tf-ovh_ubuntu18-calico:
  115. extends: .terraform_apply
  116. when: on_success
  117. variables:
  118. <<: *ovh_variables
  119. TF_VERSION: 0.12.24
  120. PROVIDER: openstack
  121. CLUSTER: $CI_COMMIT_REF_NAME
  122. ANSIBLE_TIMEOUT: "60"
  123. SSH_USER: ubuntu
  124. TF_VAR_number_of_k8s_masters: "0"
  125. TF_VAR_number_of_k8s_masters_no_floating_ip: "1"
  126. TF_VAR_number_of_k8s_masters_no_floating_ip_no_etcd: "0"
  127. TF_VAR_number_of_etcd: "0"
  128. TF_VAR_number_of_k8s_nodes: "0"
  129. TF_VAR_number_of_k8s_nodes_no_floating_ip: "1"
  130. TF_VAR_number_of_gfs_nodes_no_floating_ip: "0"
  131. TF_VAR_number_of_bastions: "0"
  132. TF_VAR_number_of_k8s_masters_no_etcd: "0"
  133. TF_VAR_use_neutron: "0"
  134. TF_VAR_floatingip_pool: "Ext-Net"
  135. TF_VAR_external_net: "6011fbc9-4cbf-46a4-8452-6890a340b60b"
  136. TF_VAR_network_name: "Ext-Net"
  137. TF_VAR_flavor_k8s_master: "defa64c3-bd46-43b4-858a-d93bbae0a229" # s1-8
  138. TF_VAR_flavor_k8s_node: "defa64c3-bd46-43b4-858a-d93bbae0a229" # s1-8
  139. TF_VAR_image: "Ubuntu 18.04"
  140. TF_VAR_k8s_allowed_remote_ips: '["0.0.0.0/0"]'
  141. tf-ovh_coreos-calico:
  142. extends: .terraform_apply
  143. when: on_success
  144. variables:
  145. <<: *ovh_variables
  146. TF_VERSION: 0.12.24
  147. PROVIDER: openstack
  148. CLUSTER: $CI_COMMIT_REF_NAME
  149. ANSIBLE_TIMEOUT: "60"
  150. SSH_USER: core
  151. TF_VAR_number_of_k8s_masters: "0"
  152. TF_VAR_number_of_k8s_masters_no_floating_ip: "1"
  153. TF_VAR_number_of_k8s_masters_no_floating_ip_no_etcd: "0"
  154. TF_VAR_number_of_etcd: "0"
  155. TF_VAR_number_of_k8s_nodes: "0"
  156. TF_VAR_number_of_k8s_nodes_no_floating_ip: "1"
  157. TF_VAR_number_of_gfs_nodes_no_floating_ip: "0"
  158. TF_VAR_number_of_bastions: "0"
  159. TF_VAR_number_of_k8s_masters_no_etcd: "0"
  160. TF_VAR_use_neutron: "0"
  161. TF_VAR_floatingip_pool: "Ext-Net"
  162. TF_VAR_external_net: "6011fbc9-4cbf-46a4-8452-6890a340b60b"
  163. TF_VAR_network_name: "Ext-Net"
  164. TF_VAR_flavor_k8s_master: "4d4fd037-9493-4f2b-9afe-b542b5248eac" # b2-7
  165. TF_VAR_flavor_k8s_node: "4d4fd037-9493-4f2b-9afe-b542b5248eac" # b2-7
  166. TF_VAR_image: "CoreOS Stable"
  167. TF_VAR_k8s_allowed_remote_ips: '["0.0.0.0/0"]'