diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 86e7647472f1c712ad25cef2420aef815937cf3f..9f80ae30d55930933549625b09dd9f8a1387ada6 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -131,11 +131,6 @@ create-vps: - openappstack/**/* extends: - .ssh_setup - # Cache the cluster secrets so the next job can use it too - cache: - paths: - - clusters/$HOSTNAME/** - key: ${CI_COMMIT_REF_SLUG} environment: name: $CI_COMMIT_REF_SLUG url: https://$FQDN @@ -188,11 +183,6 @@ setup-openappstack: - openappstack/**/* extends: - .ssh_setup - # Cache the cluster secrets so the next job can use them - cache: - paths: - - clusters/$HOSTNAME/** - key: ${CI_COMMIT_REF_SLUG} # Stage: helm-release diff --git a/.gitlab/ci_scripts/can_reuse_machine.py b/.gitlab/ci_scripts/can_reuse_machine.py deleted file mode 100644 index dcf4e5f8e452ca5929093664fb63981624e9c798..0000000000000000000000000000000000000000 --- a/.gitlab/ci_scripts/can_reuse_machine.py +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/env python3 -""" -This script takes 2 positional arguments, HOSTNAME and IP_ADDRESS. -It polls the Greenhost API for a VPS with the hostname HOSTNAME and checks if -that machine has the IP address provided in the second argument. If -everything's OK, the machine can be reused for the current CI pipeline and the -script exits with 0. If the machine can't be reused the script exits with 1 -""" - -import sys -import greenhost_cloud - -HOSTNAME = sys.argv[1] -IP_ADDRESS = sys.argv[2] -MACHINES = greenhost_cloud.get_droplets_by_name("^{}$".format(HOSTNAME)) - -if MACHINES == []: - print("No machines found with hostname {}".format(HOSTNAME)) - sys.exit(1) - -for machine in MACHINES: - print("Machine status is {}".format(machine['status'])) - print("Comparing IP address '{}' with IP address '{}'".format( - machine['networks']['v4'][0]['ip_address'], IP_ADDRESS)) - if machine['status'] == 'running' and \ - machine['networks']['v4'][0]['ip_address'] == IP_ADDRESS: - sys.exit(0) -sys.exit(1) diff --git a/.gitlab/ci_scripts/create_vps.sh b/.gitlab/ci_scripts/create_vps.sh index c2001c340435bc80e614d2092145a3876dd53c5b..ab6df85f5361906c9a5d713ff9052063ea1e36f8 100644 --- a/.gitlab/ci_scripts/create_vps.sh +++ b/.gitlab/ci_scripts/create_vps.sh @@ -3,18 +3,6 @@ set -ve -if [ -d clusters/$HOSTNAME/secrets ] -then - ip_address=$(python -m openappstack ${HOSTNAME} info --ip-address) - echo "Running python script" - # Run a python script that checks if the cached machine still exists. The - # script exits with 0 (true) if the machine can be reused - if python3 $(dirname "$0")/can_reuse_machine.py $HOSTNAME $ip_address - then - echo "Will reuse machine with hostname '$HOSTNAME' and ip address '$ip_address'" - exit 0 - fi -fi # Delete old machine if it still exists echo "Deleting old machine" python3 -c "import greenhost_cloud; greenhost_cloud.terminate_droplets_by_name(\"^${HOSTNAME}$\")"