From 7d048d955a4426d71652408d8a8df3f171a44114 Mon Sep 17 00:00:00 2001
From: Varac <varac@varac.net>
Date: Tue, 7 Dec 2021 12:10:32 +0100
Subject: [PATCH] Fix termninate-droplet job needs

---
 .gitlab-ci.yml | 43 +++++++++++++++++++------------------------
 1 file changed, 19 insertions(+), 24 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c7b08003d..c1b3987aa 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -320,6 +320,25 @@ install-k8s:
     - .general_rules
   interruptible: true
 
+# Terminates a droplet and deletes the branch container image once the MR for it is merged
+terminate-droplet:
+  # Stage has to be the same as the step that created the VPS
+  # https://docs.gitlab.com/ee/ci/environments.html#automatically-stopping-an-environment
+  stage: install-cluster
+  # Gets triggered by on_stop of create-vps job
+  when: manual
+  variables:
+    GIT_STRATEGY: none
+  script:
+    - *debug_information
+    # Delete droplet
+    - python3 -c "import greenhost_cloud; greenhost_cloud.terminate_droplets_by_name(\"^${CI_COMMIT_REF_SLUG}\")"
+    # Delete container image if one was created
+    - "if [ \"$CI_CONTAINER_TAG\" != \"main\" ]; then curl --request DELETE --header \"PRIVATE-TOKEN: ${CLEANER_TOKEN}\" https://open.greenhost.net/api/v4/projects/stackspin%2Fstackspin/registry/repositories/73/tags/${CI_CONTAINER_TAG}; fi"
+  environment:
+    name: $CI_COMMIT_REF_SLUG
+    action: stop
+
 # Stage: install-stackspin
 # ========================
 #
@@ -760,27 +779,3 @@ zulip-taiko:
   extends:
     - .taiko
     - .zulip_rules
-
-
-# Etc
-# ===
-
-
-# Terminates a droplet and deletes the branch container image once the MR for it is merged
-terminate-droplet:
-  # Stage has to be the same as the step that created the VPS
-  # https://docs.gitlab.com/ee/ci/environments.html#automatically-stopping-an-environment
-  stage: create-vps
-  # Gets triggered by on_stop of create-vps job
-  when: manual
-  variables:
-    GIT_STRATEGY: none
-  script:
-    - *debug_information
-    # Delete droplet
-    - python3 -c "import greenhost_cloud; greenhost_cloud.terminate_droplets_by_name(\"^${CI_COMMIT_REF_SLUG}\")"
-    # Delete container image if one was created
-    - "if [ \"$CI_CONTAINER_TAG\" != \"main\" ]; then curl --request DELETE --header \"PRIVATE-TOKEN: ${CLEANER_TOKEN}\" https://open.greenhost.net/api/v4/projects/stackspin%2Fstackspin/registry/repositories/73/tags/${CI_CONTAINER_TAG}; fi"
-  environment:
-    name: $CI_COMMIT_REF_SLUG
-    action: stop
-- 
GitLab