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-10.3.0.1 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-10.6.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-10.5.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-10.4.1 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-10.4.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-10.3.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-10.2.2 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-10.2.1 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-10.2.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-10.1.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-10.0.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-9.1.2 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-9.1.1 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-9.1.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-9.0.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.15.3 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.15.2 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.15.1 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.15.0 lib/gitlab/qa/slack/post_to_slack.rb
gitlab-qa-8.14.1 lib/gitlab/qa/slack/post_to_slack.rb