summaryrefslogtreecommitdiff
path: root/lib/gitlab/ci/pipeline/chain/remove_unwanted_chat_jobs.rb
blob: 1e09b41731113fb350281aa97a01f387201c5625 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# frozen_string_literal: true

module Gitlab
  module Ci
    module Pipeline
      module Chain
        class RemoveUnwantedChatJobs < Chain::Base
          def perform!
            return unless pipeline.config_processor && pipeline.chat?

            # When scheduling a chat pipeline we only want to run the build
            # that matches the chat command.
            pipeline.config_processor.jobs.select! do |name, _|
              name.to_s == command.chat_data[:command].to_s
            end
          end

          def break?
            false
          end
        end
      end
    end
  end
end