Skip to content

Commit

Permalink
ART-8042 Enable elliott go report (#169)
Browse files Browse the repository at this point in the history
* Enable elliott go report
* Ignore rhel by default
* Update help
  • Loading branch information
thegreyd authored Jan 23, 2024
1 parent bf6a57a commit 27d3da0
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
33 changes: 33 additions & 0 deletions artbotlib/elliott.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,36 @@ def go_advisory(so, advisory_id):
so.say("Invalid advisory. Try again.")
else:
so.snippet(payload=stdout, intro=f"Go version for advisory {advisory_id}:", filename='go_advisory_output.txt')


@util.refresh_krb_auth
def go_config(so, ocp_version_string):
ocp_versions = re.findall(r'(\d\.\d+)', ocp_version_string)
if not ocp_versions:
so.say(f"Could not find ocp versions in {ocp_version_string}")
return
ocp_versions = ",".join(ocp_versions)

ignore_rhel = True
if "with rhel" in ocp_version_string or "including rhel" in ocp_version_string:
ignore_rhel = False

cmd = f"elliott go:report --ocp-versions {ocp_versions}"
if ignore_rhel:
cmd = f"{cmd} --ignore-rhel"

try:
rc, stdout, stderr = artbotlib.exectools.cmd_assert(so, cmd)
except Exception as e:
so.say(f"An unexpected error occurred: {e}")
util.please_notify_art_team_of_error(so, str(e))
return

if rc:
so.say("There was a problem with the command.")
return

if not stdout:
so.say("Invalid input")
else:
so.snippet(payload=stdout, intro="Go config report:", filename='go_config_output.txt')
1 change: 1 addition & 0 deletions artbotlib/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def show_help(so):
* What images build in `major.minor`?
* What is the image pipeline for (github|distgit|package|cdn|image) `name` [in `major.minor`]?
* What is the (brew-image|brew-component) for dist-git `name` [in `major.minor`]?
* (go|golang) config for `major.minor` `major.minor2` `major.minor3` [with|including rhel version]
_*ART releases:*_
* Which build of `image_name` is in `release image name or pullspec`?
Expand Down
7 changes: 7 additions & 0 deletions artbotlib/regex_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ def map_command_to_regex(so, plain_text, user_id):
"function": elliott.go_advisory,
"example": "go version for advisory 79678"
},
# * (go|golang) config for `major.minor`,`major.minor2`
{
"regex": r"^(go|golang) config (for|of) (?P<ocp_version_string>.*)$",
"flag": re.I,
"function": elliott.go_config,
"example": "go config for versions 4.13 4.14 4.15 (with|including rhel version)"
},
{
"regex": r"^timestamp (for|of) brew event (?P<brew_event>\d+)$",
"flag": re.I,
Expand Down

0 comments on commit 27d3da0

Please sign in to comment.