Merge branch 'bobthe' of https://bitbucket.org/yackob03/quay into bobthe
This commit is contained in:
commit
fe2c844835
2 changed files with 19 additions and 3 deletions
|
@ -37,7 +37,7 @@ def generate_fake_status():
|
||||||
'complete': {},
|
'complete': {},
|
||||||
'building': {
|
'building': {
|
||||||
'total_commands': 7,
|
'total_commands': 7,
|
||||||
'current_command': random.randint(1, 7),
|
'current_command': random.randint(1, 7),
|
||||||
},
|
},
|
||||||
'pushing': {
|
'pushing': {
|
||||||
'total_commands': 7,
|
'total_commands': 7,
|
||||||
|
@ -97,11 +97,24 @@ def get_fake_repo_build_logs():
|
||||||
adv_total = 110
|
adv_total = 110
|
||||||
lorem_logs = get_sentences(10)
|
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({
|
return jsonify({
|
||||||
'start': adv_start,
|
'start': adv_start,
|
||||||
'end': adv_end,
|
'end': adv_end,
|
||||||
'total': adv_total,
|
'total': adv_total,
|
||||||
'logs': [{'message': sentence} for sentence in lorem_logs]
|
'logs': [wrap_log_message(rnd, sentence) for sentence in lorem_logs]
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -101,14 +101,17 @@ class DockerfileBuildContext(object):
|
||||||
built_image = None
|
built_image = None
|
||||||
for status in build_status:
|
for status in build_status:
|
||||||
logger.debug('Status: %s', str(status.encode('utf-8')))
|
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)
|
step_increment = re.search(r'Step ([0-9]+) :', status)
|
||||||
if step_increment:
|
if step_increment:
|
||||||
|
build_logs.append_log_entry({'message': str(status),
|
||||||
|
'is_command': True})
|
||||||
current_step = int(step_increment.group(1))
|
current_step = int(step_increment.group(1))
|
||||||
logger.debug('Step now: %s/%s' % (current_step, self._num_steps))
|
logger.debug('Step now: %s/%s' % (current_step, self._num_steps))
|
||||||
with self._status as status:
|
with self._status as status:
|
||||||
status['current_command'] = current_step
|
status['current_command'] = current_step
|
||||||
continue
|
continue
|
||||||
|
else:
|
||||||
|
build_logs.append_log_message(self._build_uuid, str(status))
|
||||||
|
|
||||||
complete = re.match(r'Successfully built ([a-z0-9]+)$', status)
|
complete = re.match(r'Successfully built ([a-z0-9]+)$', status)
|
||||||
if complete:
|
if complete:
|
||||||
|
|
Reference in a new issue