Skip to content

Commit

Permalink
Fix regex according to current error messages, but allow old form too
Browse files Browse the repository at this point in the history
  • Loading branch information
xDaile committed Jun 5, 2024
1 parent e5b5d71 commit 08b533b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions iib/workers/tasks/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,8 @@ def _regex_reverse_search(
:return: the regex match or None if not matched
:rtype: re.Match
"""
print(f"regex: {regex}")
print(f"proc_response: {proc_response.stderr.splitlines()}")
# Start from the last log message since the failure occurs near the bottom
for msg in reversed(proc_response.stderr.splitlines()):
match = re.match(regex, msg)
Expand Down Expand Up @@ -766,10 +768,16 @@ def run_cmd(
raise IIBError(f'{exc_msg.rstrip(".")}: {match.groups()[0]}')
elif cmd[0] == 'buildah':
# Check for HTTP 50X errors on buildah
regex = r'.*(error creating build container).*((?:50[0-9]|125)\s.*$)'
match = _regex_reverse_search(regex, response)
if match:
raise ExternalServiceError(f'{exc_msg}: {": ".join(match.groups()).strip()}')
network_regexes = [
r'.*([e,E]rror:? creating build container).*(:?(50[0-9]|125)\s.*$)',
r'.* read\/write on closed pipe.*',
]
for regex in network_regexes:
match = _regex_reverse_search(regex, response)
if match:
print(match.groups())
if match:
raise ExternalServiceError(f'{exc_msg}: {": ".join(match.groups()).strip()}')

raise IIBError(exc_msg)

Expand Down
Empty file added test_time.py
Empty file.

0 comments on commit 08b533b

Please sign in to comment.