From c28bb8447048ada4211be17370b127c732892f33 Mon Sep 17 00:00:00 2001
From: Terri Chu <tchu@gitlab.com>
Date: Fri, 17 May 2024 15:54:09 +0000
Subject: [PATCH] Improvements for
 Keeps::MarkOldAdvancedSearchMigrationsAsObsolete

---
 ...old_advanced_search_migrations_as_obsolete.rb | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/keeps/mark_old_advanced_search_migrations_as_obsolete.rb b/keeps/mark_old_advanced_search_migrations_as_obsolete.rb
index 29e3399f85e60..2b0e8100c09fe 100644
--- a/keeps/mark_old_advanced_search_migrations_as_obsolete.rb
+++ b/keeps/mark_old_advanced_search_migrations_as_obsolete.rb
@@ -108,9 +108,9 @@ def create_mark_obsolete_change(version, migration_data)
       change.description = <<~MARKDOWN
         This migration marks the #{version} #{migration_name} Advanced search migration as obsolete.
 
-        This MR will still need changes to remove references to the migration in the code.
-        At the moment the `gitlab-housekeeper` is not always capable of removing all references so you must check the
-        diff and pipeline failures to confirm if there are any issues.
+        This MR will still need changes to remove [references to the migration](https://gitlab.com/search?project_id=278964&scope=blobs&search=#{migration_name.underscore}&regex=false)
+        in the code. At the moment, the `gitlab-housekeeper` is not always capable of removing all references so
+        you must check the diff and pipeline failures to confirm if there are any issues.
         It is the responsibility of the assignee (picked from ~"group::global search") to push those changes to this branch.
 
         You can read more about the process for marking Advanced search migrations as obsolete in
@@ -126,10 +126,16 @@ def create_mark_obsolete_change(version, migration_data)
       change.changed_files = []
       add_obsolete_to_yaml(migration_data[:yaml_filename], migration_data[:yaml_content])
       change.changed_files << migration_data[:yaml_filename]
+
       add_obsolete_to_migration(migration_data[:file])
       change.changed_files << migration_data[:file]
-      add_obsolete_to_migration_spec(version, migration_data[:spec_file])
-      change.changed_files << migration_data[:spec_file]
+
+      if File.exist?(migration_data[:spec_file])
+        add_obsolete_to_migration_spec(version, migration_data[:spec_file])
+        change.changed_files << migration_data[:spec_file]
+      end
+
+      change.push_options.ci_skip = true
 
       change
     end
-- 
GitLab