Sha256: 7f238daa6ab2f49a352669d0024da4127a89f41377d300dd492001f1c4490c2f

Contents?: true

Size: 852 Bytes

Versions: 44

Compression:

Stored size: 852 Bytes

Contents

# frozen_string_literal: true

module Gitlab
  module QA
    module Slack
      class PostToSlack
        def initialize(message:, icon_emoji: Runtime::Env.slack_icon_emoji, channel: Runtime::Env.slack_qa_channel)
          @channel = channel
          @message = message
          @icon_emoji = icon_emoji
        end

        def invoke!
          Runtime::Env.require_slack_qa_channel! unless @channel
          Runtime::Env.require_ci_slack_webhook_url!

          params = {}
          params['channel'] = @channel
          params['username'] = "GitLab QA Bot"
          params['icon_emoji'] = @icon_emoji
          params['text'] = @message

          url = Runtime::Env.ci_slack_webhook_url

          Support::HttpRequest.make_http_request(method: 'post', url: url, params: params, show_response: true)
        end
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
gitlab-qa-8.14.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.13.1 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.13.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.12.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.11.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.10.2 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.10.1 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.10.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.9.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.8.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.7.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.6.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.5.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.4.2 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.4.1 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.4.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.3.2 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.3.1 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.3.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.2.0 lib/gitlab/qa/slack/post_to_slack.rb