Fix parsing of Dockerfile steps in newer versions of Docker

Fixes https://coreosdev.atlassian.net/browse/QS-24
This commit is contained in:
Joseph Schorr 2017-10-05 16:47:47 -04:00
parent 3bef21253d
commit 95868c7b78
3 changed files with 33 additions and 3 deletions

View file

@ -0,0 +1,15 @@
import re
def extract_current_step(current_status_string):
""" Attempts to extract the current step numeric identifier from the given status string. Returns the step
number or None if none.
"""
# Older format: `Step 12 :`
# Newer format: `Step 4/13 :`
step_increment = re.search(r'Step ([0-9]+)/([0-9]+) :', current_status_string)
if step_increment:
return int(step_increment.group(1))
step_increment = re.search(r'Step ([0-9]+) :', current_status_string)
if step_increment:
return int(step_increment.group(1))