Merge branch 'bobthe' of https://bitbucket.org/yackob03/quay into bobthe

This commit is contained in:
Joseph Schorr 2014-02-10 15:15:33 -05:00
commit fe2c844835
2 changed files with 19 additions and 3 deletions

View file

@ -37,7 +37,7 @@ def generate_fake_status():
'complete': {},
'building': {
'total_commands': 7,
'current_command': random.randint(1, 7),
'current_command': random.randint(1, 7),
},
'pushing': {
'total_commands': 7,
@ -97,11 +97,24 @@ def get_fake_repo_build_logs():
adv_total = 110
lorem_logs = get_sentences(10)
def wrap_log_message(rand, msg):
if rand.randint(1, 10) == 1:
block = {
'is_command': True,
'message': 'Step %s : %s' % (rand.randint(1, 10), msg)
}
else:
block = {
'message': msg,
}
return block
rnd = SystemRandom()
return jsonify({
'start': adv_start,
'end': adv_end,
'total': adv_total,
'logs': [{'message': sentence} for sentence in lorem_logs]
'logs': [wrap_log_message(rnd, sentence) for sentence in lorem_logs]
})

View file

@ -101,14 +101,17 @@ class DockerfileBuildContext(object):
built_image = None
for status in build_status:
logger.debug('Status: %s', str(status.encode('utf-8')))
build_logs.append_log_message(self._build_uuid, str(status))
step_increment = re.search(r'Step ([0-9]+) :', status)
if step_increment:
build_logs.append_log_entry({'message': str(status),
'is_command': True})
current_step = int(step_increment.group(1))
logger.debug('Step now: %s/%s' % (current_step, self._num_steps))
with self._status as status:
status['current_command'] = current_step
continue
else:
build_logs.append_log_message(self._build_uuid, str(status))
complete = re.match(r'Successfully built ([a-z0-9]+)$', status)
if complete: