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.

90 lines
2.6 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. INVENTORY=$(PWD)/../inventory/sample/${CI_JOB_NAME}-${BUILD_NUMBER}.ini
  2. $(HOME)/.ssh/id_rsa:
  3. mkdir -p $(HOME)/.ssh
  4. echo $(PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa
  5. chmod 400 $(HOME)/.ssh/id_rsa
  6. init-gce: $(HOME)/.ssh/id_rsa
  7. # echo $(GCE_PEM_FILE) | base64 -d > $(HOME)/.ssh/gce
  8. echo "$(GCE_CREDENTIALS_B64)" | base64 -d > $(HOME)/.ssh/gce.json
  9. init-do: $(HOME)/.ssh/id_rsa
  10. echo $(DO_PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa
  11. init-packet:
  12. echo $(PACKET_VM_SSH_PRIVATE_KEY) | base64 -d > $(HOME)/.ssh/id_rsa
  13. chmod 400 $(HOME)/.ssh/id_rsa
  14. create-tf:
  15. ./scripts/create-tf.sh
  16. delete-tf:
  17. ./scripts/delete-tf.sh
  18. create-gce: init-gce
  19. ansible-playbook cloud_playbooks/create-gce.yml -i local_inventory/hosts.cfg -c local \
  20. $(ANSIBLE_LOG_LEVEL) \
  21. -e @"files/${CI_JOB_NAME}.yml" \
  22. -e gce_credentials_file=$(HOME)/.ssh/gce.json \
  23. -e gce_project_id=$(GCE_PROJECT_ID) \
  24. -e gce_service_account_email=$(GCE_ACCOUNT) \
  25. -e inventory_path=$(INVENTORY) \
  26. -e test_id=$(TEST_ID) \
  27. -e preemptible=$(GCE_PREEMPTIBLE)
  28. delete-gce:
  29. ansible-playbook -i $(INVENTORY) cloud_playbooks/delete-gce.yml -c local \
  30. $(ANSIBLE_LOG_LEVEL) \
  31. -e @"files/${CI_JOB_NAME}.yml" \
  32. -e test_id=$(TEST_ID) \
  33. -e gce_project_id=$(GCE_PROJECT_ID) \
  34. -e gce_service_account_email=$(GCE_ACCOUNT) \
  35. -e gce_credentials_file=$(HOME)/.ssh/gce.json \
  36. -e inventory_path=$(INVENTORY)
  37. create-do: init-do
  38. ansible-playbook cloud_playbooks/create-do.yml -i local_inventory/hosts.cfg -c local \
  39. ${ANSIBLE_LOG_LEVEL} \
  40. -e @"files/${CI_JOB_NAME}.yml" \
  41. -e inventory_path=$(INVENTORY) \
  42. -e test_id=${TEST_ID}
  43. delete-do:
  44. ansible-playbook -i $(INVENTORY) cloud_playbooks/create-do.yml -c local \
  45. $(ANSIBLE_LOG_LEVEL) \
  46. -e @"files/${CI_JOB_NAME}.yml" \
  47. -e state=absent \
  48. -e test_id=${TEST_ID} \
  49. -e inventory_path=$(INVENTORY)
  50. create-packet: init-packet
  51. ansible-playbook cloud_playbooks/create-packet.yml -c local \
  52. $(ANSIBLE_LOG_LEVEL) \
  53. -e @"files/${CI_JOB_NAME}.yml" \
  54. -e test_id=$(TEST_ID) \
  55. -e branch="$(CI_COMMIT_BRANCH)" \
  56. -e pipeline_id="$(CI_PIPELINE_ID)" \
  57. -e inventory_path=$(INVENTORY)
  58. delete-packet:
  59. ansible-playbook cloud_playbooks/delete-packet.yml -c local \
  60. $(ANSIBLE_LOG_LEVEL) \
  61. -e @"files/${CI_JOB_NAME}.yml" \
  62. -e test_id=$(TEST_ID) \
  63. -e branch="$(CI_COMMIT_BRANCH)" \
  64. -e pipeline_id="$(CI_PIPELINE_ID)" \
  65. -e inventory_path=$(INVENTORY)
  66. cleanup-packet:
  67. ansible-playbook cloud_playbooks/cleanup-packet.yml -c local \
  68. $(ANSIBLE_LOG_LEVEL)
  69. create-vagrant:
  70. vagrant up
  71. find / -name vagrant_ansible_inventory
  72. cp /builds/kargo-ci/kubernetes-sigs-kubespray/inventory/sample/vagrant_ansible_inventory $(INVENTORY)
  73. delete-vagrant:
  74. vagrant destroy -f