diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ad2661c75a7826284fdbdef2ad275426f171e644..8a4813b6f42e8a9b945004fcc1049c69c8dffd5c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -86,11 +86,11 @@ full-deploy-testing: - echo "Starting the full testing deployment of airflows." - pip install python-openstackclient - OLD_ID=`openstack server show $TESTING_NAME -f value -c id` && server_exists=true || echo "No testing server found. It might be a first time deployment" + - openstack server set --name $OLD_TEST_NAME $OLD_ID; # - if [ "$server_exists" = true ] ; then # ssh -oStrictHostKeyChecking=accept-new airflow@$TESTING_IP "sudo docker-compose -f /home/airflow/data-logistics-service/dockers/docker-compose.yaml --project-directory /home/airflow/eflows-airflow down" # openstack server set --name $OLD_TEST_NAME $OLD_ID; # fi - - openstack server remove volume $OLD_ID $VOLUME_ID - INSTANCE_ID=`openstack server create -f value -c id --prefix IMAGE_ --flavor l2 --image 149a65b5-aeb8-499f-aaa6-ec966bd28dd6 --user-data scripts/cloudinit.yml --security-group ssh --security-group www --security-group https $TESTING_NAME` - while [ "`openstack server show $INSTANCE_ID -c addresses -f value`" = "{}" ]; do sleep 5; done # wait until an address is available to attach the floating ip - openstack server add floating ip $INSTANCE_ID $TESTING_IP @@ -126,6 +126,7 @@ full-deploy-production: - echo "Starting the full production deployment of airflows." - pip install python-openstackclient - OLD_ID=`openstack server show $PRODUCTION_NAME -f value -c id` && server_exists=true || echo "No production server found. It might be a first time deployment" + - openstack server set --name $OLD_PROD_NAME $OLD_ID # - if [ "$server_exists" = true ] ; then # ssh -oStrictHostKeyChecking=accept-new airflow@$PRODUCTION_IP "sudo docker-compose -f /home/airflow/data-logistics-service/dockers/docker-compose.yaml --project-directory /home/airflow/eflows-airflow down" # openstack server set --name $OLD_PROD_NAME $OLD_ID; @@ -178,12 +179,13 @@ cleanup-successful-full-deployment: stage: cleanup when: on_success rules: - - if: ($CI_COMMIT_TAG =~ /stable/ && $MANUAL_FULL_DEPLOY_PRODUCTION == "true") + - if: $MANUAL_FULL_DEPLOY == "true" script: - echo "This is the cleanup for the full-redeployment of the testing or production servers" - echo "if this job is reached, all earlier jobs were successful, and any lingering old instances need to be removed" - pip install python-openstackclient - openstack server delete $OLD_TEST_NAME && echo "Deleted old testing server." || echo "No old testing server found." + - openstack server delete $OLD_PROD_NAME && echo "Deleted old production server." || echo "No old production server found." cleanup-failed-full-deployment: # check if there is an old prod or test instance, assign respective ip to it, re-attach volume, delete new instance, rename old instance