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.

51 lines
1.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. create-gce: init-gce
  12. ansible-playbook cloud_playbooks/create-gce.yml -i local_inventory/hosts.cfg -c local \
  13. $(LOG_LEVEL) \
  14. -e @"files/${CI_JOB_NAME}.yml" \
  15. -e gce_credentials_file=$(HOME)/.ssh/gce.json \
  16. -e gce_project_id=$(GCE_PROJECT_ID) \
  17. -e gce_service_account_email=$(GCE_ACCOUNT) \
  18. -e inventory_path=$(INVENTORY) \
  19. -e test_id=$(TEST_ID) \
  20. -e preemptible=$(GCE_PREEMPTIBLE)
  21. delete-gce:
  22. ansible-playbook -i $(INVENTORY) cloud_playbooks/delete-gce.yml -c local \
  23. $(LOG_LEVEL) \
  24. -e @"files/${CI_JOB_NAME}.yml" \
  25. -e test_id=$(TEST_ID) \
  26. -e gce_project_id=$(GCE_PROJECT_ID) \
  27. -e gce_service_account_email=$(GCE_ACCOUNT) \
  28. -e gce_credentials_file=$(HOME)/.ssh/gce.json \
  29. -e inventory_path=$(INVENTORY)
  30. create-do: init-do
  31. ansible-playbook cloud_playbooks/create-do.yml -i local_inventory/hosts.cfg -c local \
  32. ${LOG_LEVEL} \
  33. -e @"files/${CI_JOB_NAME}.yml" \
  34. -e inventory_path=$(INVENTORY) \
  35. -e test_id=${TEST_ID}
  36. delete-do:
  37. ansible-playbook -i $(INVENTORY) cloud_playbooks/create-do.yml -c local \
  38. $(LOG_LEVEL) \
  39. -e @"files/${CI_JOB_NAME}.yml" \
  40. -e state=absent \
  41. -e test_id=${TEST_ID} \
  42. -e inventory_path=$(INVENTORY)