Skip to content
Snippets Groups Projects
Commit a5d0d369 authored by Varac's avatar Varac
Browse files

Merge branch '398-master-pipeline-sometimes-fails' into 'master'

Add debug prints to failing CI pipeline script

See merge request openappstack/openappstack!151
parents 3aa09091 4251c8ec
No related branches found
No related tags found
No related merge requests found
......@@ -43,11 +43,13 @@ create-vps:
if [ -d clusters/$HOSTNAME/secrets ]
then
ip_address=$(python -m openappstack ${HOSTNAME} info --ip-address)
echo "Running python script"
# Check if the cached machine still exists in the Greenhost cloud and it's
# the same machine.
python3 << EOF
import greenhost_cloud
machine = greenhost_cloud.get_droplets_by_name("^${HOSTNAME}$")[0]
print(machine)
if machine['status'] == 'running' and \
machine['networks']['v4'][0]['ip_address'] == '${IP_ADDRESS}':
exit(0)
......@@ -55,6 +57,7 @@ create-vps:
exit(1)
EOF
echo "Python exited with '$?'"
# If exit code was 0, we can reuse the old machine, otherwise, continue to
# VPS creation
if [ $? -eq 0 ]
......@@ -63,7 +66,9 @@ create-vps:
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}$\")"
echo "Creating new machine"
python3 -m openappstack $HOSTNAME create --create-droplet $DOMAIN --create-hostname $HOSTNAME --ssh-key-id $SSH_KEY_ID --create-domain-records --subdomain $SUBDOMAIN
artifacts:
paths:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment