From 344556840a28adeb7346655640ab00e0886ac1ca Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Franti=C5=A1ek=20Dvo=C5=99=C3=A1k?= <valtri@civ.zcu.cz>
Date: Sun, 10 Oct 2021 00:32:54 +0200
Subject: [PATCH] gitLab CI: always delete floating IP

---
 .gitlab-ci.yml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ca17c8f..40d7b19 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -43,6 +43,8 @@ test-single:
     # https://github.com/terraform-provider-openstack/terraform-provider-openstack/issues/1160
     - touch ./secure.yml
     - ip=`openstack floating ip create -c floating_ip_address -f value public-muni-147-251-21-GROUP`
+  after_script: &after
+    - openstack floating ip delete $ip
   cache:
     when: always
     key: single
@@ -56,7 +58,6 @@ test-single:
     - ssh-add ./ssh-key.terra1.txt
     - 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
   rules:
     - if: '$JOB =~ /all|test-single/'
   artifacts: &artifacts
@@ -67,6 +68,7 @@ test-cluster:
   stage: test
   variables: *tfvars
   before_script: *before
+  after_script: *after
   cache:
     when: always
     key: cluster
-- 
GitLab