Skip to content

Commit

Permalink
Expand on the help for the mentions check
Browse files Browse the repository at this point in the history
In particular, suggest rebasing
  • Loading branch information
zdrve committed Dec 14, 2023
1 parent 1552a79 commit 44f385e
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions lib/kennel/tasks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def git_push?

# ideally do this on every run, but it's slow (~1.5s) and brittle (might not find all + might find false-positives)
# https://help.datadoghq.com/hc/en-us/requests/254114 for automatic validation
desc "Verify that all used monitor mentions are valid"
desc "Verify that all used monitor mentions are valid"
task validate_mentions: :environment do
known = Kennel::Api.new
.send(:request, :get, "/monitor/notifications")
Expand All @@ -91,7 +91,29 @@ def git_push?

if bad.any?
url = Kennel::Utils.path_to_url "/account/settings"
Kennel.out.puts "Invalid mentions found, either ignore them by adding to `KNOWN` env var or add them via #{url}"
Kennel.out.puts <<~MESSAGE
⛔️ Possibly invalid mentions found ⛔️
The monitor definitions in `generated` include at least one mention
that isn't currently in Datadog. See the list below for exactly what
was found.
This check exists to protect against typos in mentions, mentioning
non-existent targets, etc.
How to resolve this:
- If the problems listed below are nothing to do with what you're
changing on this branch, then rebase onto a fresh `#{ENV.fetch("DEFAULT_BRANCH", "master")}`
- If the problems listed below seem valid, i.e. a typo or other mistake,
then fix them :-)
- If you want to mention someone new, someone whom no existing monitor
currently mentions, then you can allow-list them by adding to the
`KNOWN` environment variable, or by adding them in #{url}"
MESSAGE
bad.each { |f, v| Kennel.out.puts "Invalid mention #{v} in monitor message of #{f}" }
Kennel::Tasks.abort ENV["KNOWN_WARNING"]
end
Expand Down

0 comments on commit 44f385e

Please sign in to comment.