From ca715972fc245a87cf22b00f0c4506715b1b6587 Mon Sep 17 00:00:00 2001
From: Maarten de Waard <maarten@greenhost.nl>
Date: Thu, 28 Oct 2021 16:54:21 +0200
Subject: [PATCH] find another way to fix delete-image job

TRIGGER_JOBS=ci-test-image-build
---
 .gitlab-ci.yml | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index d223947ff..7bcebe94c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -718,9 +718,10 @@ terminate-droplet:
 # Careful! When you run this step manually, you might have to trigger container
 # image re-build as well
 delete-image:
-  stage: build
-  needs:
-    - job: ci-test-image-build
+  # Should be in the post-build stage so it automatically gets the artifacts it
+  # that contain the CI_COMMIT_REF_SLUG variable
+  stage: create-vps
+  when: manual
   variables:
     GIT_STRATEGY: none
   script:
@@ -729,15 +730,3 @@ delete-image:
   environment:
     name: image/$CI_COMMIT_REF_SLUG
     action: stop
-  rules:
-    # Copy the rules from ci-test-image-build to prevent broken pipelines when
-    # that job did not run
-    - changes:
-        - Dockerfile
-        - requirements.txt
-        - .gitlab/ci_templates/kaniko.yml
-      when: manual
-    - if: '$TRIGGER_JOBS =~ /ci-test-image-build/'
-      when: manual
-    - if: '$CI_COMMIT_MESSAGE =~ /TRIGGER_JOBS=.*ci-test-image-build/'
-      when: manual
-- 
GitLab