Add auto_deploy package_check command in chatops

This change adds a way to allow users to verify whether specific merge requests are included in a particular software package version via this chatops command:

  • /chatops run auto_deploy package_check --package_version=<auto_deploy_version> <MR_URL1> <MR_URL2> <MR_URLn>

The new command takes a package version number (like "17.7.202412040601") and one or more merge request URLs, then checks if those code changes made it into that specific package build (this is implemented in the release-tools in this MR).

This change includes proper error handling for missing parameters, invalid package version formats, and malformed merge request URLs. It also includes comprehensive tests to ensure the command works correctly in various scenarios, including edge cases like invalid inputs.

Related issue: gitlab-com/gl-infra/delivery#21583

Testing

In order to test this locally, I updated the trigger_release method so that it will not need to create a pipeline when running the chatops command.:

  • Change
diff --git a/lib/chatops/release/command.rb b/lib/chatops/release/command.rb
index 032fa80..580526d 100644
--- a/lib/chatops/release/command.rb
+++ b/lib/chatops/release/command.rb
@@ -27,26 +27,34 @@ module Chatops
         end
       end
 
-      def trigger_release(version,
-                          task_name = self.class.command_name,
-                          params = {})
-        pipeline = run_task(task_name, version, params)
-        jobs = pipeline_jobs(pipeline.id)
-
-        result =
-          if chatops_job?(jobs)
-            TriggerResult.new(:success, jobs.first.web_url)
-          else
-            TriggerResult.new(:failure, pipeline.web_url)
-          end
-
-        if block_given?
-          yield result
-        elsif result.success?
-          "View `#{task_name}` progress at #{result.url}"
-        else
-          "Pipeline triggered but unable to find `chatops` job: #{result.url}"
-        end
+      # def trigger_release(version,
+      #                     task_name = self.class.command_name,
+      #                     params = {})
+      #   pipeline = run_task(task_name, version, params)
+      #   jobs = pipeline_jobs(pipeline.id)
+
+      #   result =
+      #     if chatops_job?(jobs)
+      #       TriggerResult.new(:success, jobs.first.web_url)
+      #     else
+      #       TriggerResult.new(:failure, pipeline.web_url)
+      #     end
+
+      #   if block_given?
+      #     yield result
+      #   elsif result.success?
+      #     "View `#{task_name}` progress at #{result.url}"
+      #   else
+      #     "Pipeline triggered but unable to find `chatops` job: #{result.url}"
+      #   end
+      # end
+
+      def trigger_release(version, task_name = self.class.command_name, params = {})
+        output = "Trigger Release called with:\n"
+        output += "Task Name: #{task_name.inspect}\n"
+        output += "Params: #{params.inspect}\n"
+        
+        output
       end
 
       private

Instead, it will just output the arguments that were passed to it.

  1. Valid parameters are provided
SLACK_TOKEN='*************' GITLAB_TOKEN="$RELEASE_BOT_PRODUCTION_TOKEN" CHAT_INPUT='package_check --package-version=18.5.202510131406 https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208598 https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208729' CHAT_CHANNEL="$SLACK_CHANNEL_ID" bundle exec ./bin/chatops auto_deploy
Top level ::CompositeIO is deprecated, require 'multipart/post' and use `Multipart::Post::CompositeReadIO` instead!
Top level ::Parts is deprecated, require 'multipart/post' and use `Multipart::Post::Parts` instead!
2025-10-15 21:02:57.451151 I [{:user=>nil}] Chatops -- Command to be executed -- {:name=>"auto_deploy", :chat_input=>"package_check --package-version=18.5.202510131406 https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208598 https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208729", :split_chat_input=>["package_check", "--package-version=18.5.202510131406", "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208598", "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208729"]}

Trigger Release called with:
Task Name: "auto_deploy:package_check"
Params: {:PACKAGE_VERSION=>"18.5.202510131406", :MR_URLS=>"https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208598,https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208729", :TASK=>"package_check"}
  1. Invalid MR URL
SLACK_TOKEN='*************' GITLAB_TOKEN="$RELEASE_BOT_PRODUCTION_TOKEN" CHAT_INPUT='package_check --package-version=18.5.202510131406 https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208598 https://gitlab.com/gitlab-org/gitlab/-/merge_requestss/208729' CHAT_CHANNEL="$SLACK_CHANNEL_ID" bundle exec ./bin/chatops auto_deploy
Top level ::CompositeIO is deprecated, require 'multipart/post' and use `Multipart::Post::CompositeReadIO` instead!
Top level ::Parts is deprecated, require 'multipart/post' and use `Multipart::Post::Parts` instead!
2025-10-15 21:04:57.674103 I [{:user=>nil}] Chatops -- Command to be executed -- {:name=>"auto_deploy", :chat_input=>"package_check --package-version=18.5.202510131406 https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208598 https://gitlab.com/gitlab-org/gitlab/-/merge_requestss/208729", :split_chat_input=>["package_check", "--package-version=18.5.202510131406", "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208598", "https://gitlab.com/gitlab-org/gitlab/-/merge_requestss/208729"]}

Invalid merge request URL: https://gitlab.com/gitlab-org/gitlab/-/merge_requestss/208729
  1. Missing MR URL
SLACK_TOKEN='*************' GITLAB_TOKEN="$RELEASE_BOT_PRODUCTION_TOKEN" CHAT_INPUT='package_check --package-version=18.5.202510131406' CHAT_CHANNEL="$SLACK_CHANNEL_ID" bundle exec ./bin/chatops auto_deploy
Top level ::CompositeIO is deprecated, require 'multipart/post' and use `Multipart::Post::CompositeReadIO` instead!
Top level ::Parts is deprecated, require 'multipart/post' and use `Multipart::Post::Parts` instead!
2025-10-15 21:06:15.261979 I [{:user=>nil}] Chatops -- Command to be executed -- {:name=>"auto_deploy", :chat_input=>"package_check --package-version=18.5.202510131406", :split_chat_input=>["package_check", "--package-version=18.5.202510131406"]}

You must specify at least one merge request URL
  1. Package version not provided
SLACK_TOKEN='*************' GITLAB_TOKEN="$RELEASE_BOT_PRODUCTION_TOKEN" CHAT_INPUT='package_check https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208598' CHAT_CHANNEL="$SLACK_CHANNEL_ID" bundle exec ./bin/chatops auto_deploy
Top level ::CompositeIO is deprecated, require 'multipart/post' and use `Multipart::Post::CompositeReadIO` instead!
Top level ::Parts is deprecated, require 'multipart/post' and use `Multipart::Post::Parts` instead!
2025-10-23 20:17:59.709293 I [{:user=>nil}] Chatops -- Command to be executed -- {:name=>"auto_deploy", :chat_input=>"package_check https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208598", :split_chat_input=>["package_check", "https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208598"]}

Trigger Release called with:
Task Name: "auto_deploy:package_check"
Params: {:MR_URLS=>"https://gitlab.com/gitlab-org/gitlab/-/merge_requests/208598", :TASK=>"package_check"}
Edited by Mawreen Dela Cruz

Merge request reports

Loading