diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index ac40a98e2fe0d6c497dcef03f235dbbb23755c14..5d271fa1cc2a52a36ee5fe246f2dc7fb7725eaa7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -44,12 +44,14 @@ test-single: - touch ./secure.yml # better to init terraform before allocating public floating IP address (the state could be locked) - terraform init -input=false - - ip=`openstack floating ip create -c floating_ip_address -f value public-muni-147-251-21-GROUP` + - if test -f ip.txt; then ip=$(cat ip.txt); openstack floating ip show "$ip" >/dev/null || ip=''; fi + - if test -z "$ip"; then ip=$(openstack floating ip create -c floating_ip_address -f value public-muni-147-251-21-GROUP); echo "$ip" > ip.txt; fi cache: when: always key: single paths: - ".terraform/" + - "ip.txt" script: - args="-auto-approve -var type=hadoop-single -var flavor=standard.large -var n=0 -var domain=terra1 -var image_name=$IMAGE_NAME -var image_visibility=$IMAGE_VISIBILITY -var floating_ip=$ip" - terraform apply $args @@ -58,6 +60,7 @@ test-single: - ssh -o PreferredAuthentications=publickey deployadm@$ip "sudo -u debian sh -c 'cd; ~deployadm/terraform/image/tests/run-tests.sh'" - terraform destroy $args - openstack floating ip delete $ip + - rm -fv ip.txt rules: - if: '$JOB =~ /all|test-single/' artifacts: &artifacts @@ -73,6 +76,7 @@ test-cluster: key: cluster paths: - ".terraform/" + - "ip.txt" script: - args="-auto-approve -var type=hadoop -var domain=terra2 -var image_name=$IMAGE_NAME -var image_visibility=$IMAGE_VISIBILITY -var floating_ip=$ip" - terraform apply $args @@ -81,6 +85,7 @@ test-cluster: - ssh -o PreferredAuthentications=publickey deployadm@$ip "sudo -u debian sh -c 'cd; ~deployadm/terraform/image/tests/run-tests.sh'" - terraform destroy $args - openstack floating ip delete $ip + - rm -fv ip.txt rules: - if: '$JOB =~ /all|test-cluster/' artifacts: *artifacts