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.

160 lines
4.9 KiB

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