Skip to content

Commit

Permalink
release: enhance koparse πŸ™ƒ
Browse files Browse the repository at this point in the history
It is simpler to read and more efficient.

Signed-off-by: Vincent Demeester <[email protected]>
  • Loading branch information
vdemeester authored and tekton-robot committed Oct 21, 2020
1 parent e98baae commit 330d64a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions tekton/koparse/koparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,12 @@ def parse_release(base: str, path: str) -> List[str]:
list of the images parsed from the file
"""
images = []
pattern = re.compile(base + r"[0-9a-z\-]+" + DIGEST_MARKER + r":[0-9a-f]*")
with open(path) as f:
for line in f:
pattern = base + "[0-9a-z\-]+" + DIGEST_MARKER + ":[0-9a-f]*"
match = re.search(pattern, line)
while match is not None:
image = match.group(0)
found = re.findall(pattern, line)
for image in found:
images.append(image)
line = re.sub(image, "found", line)
match = re.search(pattern, line)
return images


Expand Down

0 comments on commit 330d64a

Please sign in to comment.