in lib/release_tools/slack/auto_deploy_notification.rb [9:49]
def self.on_create(results)
return unless results.any?
branch = results.first.branch
fallback = "New auto-deploy branch: `#{branch}`"
if results.any?(&:notify_branch_too_far_behind)
fallback += "\n@release-managers Auto deploy branches with :warning: next to them are too far behind the default branch. " \
"Please check and notify the appropriate groups."
end
blocks = ::Slack::BlockKit.blocks
blocks.section { |section| section.mrkdwn(text: fallback) }
blocks.section do |section|
results.each do |result|
text = "<#{commits_url(result.project, branch)}|#{result.project}>"
text.prepend(":warning: ") if result.notify_branch_too_far_behind
section.mrkdwn_field(text: text.freeze)
end
end
if results.any?(&:notify_branch_too_far_behind)
blocks.divider
blocks.context do |context|
docs_url = 'https://gitlab.com/gitlab-org/release/docs/-/blob/master/general/deploy/how-to-fix-auto-deploy-branch-behind-master.md'
context.mrkdwn(text: "<#{docs_url}|Runbook for handling branch behind master>")
end
end
if ENV['CI_JOB_URL']
blocks.context { |context| context.mrkdwn(text: "Created via <#{ENV['CI_JOB_URL']}|scheduled pipeline>.") }
end
fire_hook(text: fallback, blocks: blocks.as_json, channel: F_UPCOMING_RELEASE)
end