Add a new exposed 'unpacking' phase to the build and make sure that the unzip/untar/etc always occurs under a try-except

This commit is contained in:
Joseph Schorr 2014-08-15 17:58:11 -04:00
parent f6f857eec2
commit 8681dd9cb9
3 changed files with 28 additions and 11 deletions

View file

@ -823,7 +823,7 @@ i.toggle-icon:hover {
background-color: red; background-color: red;
} }
.phase-icon.waiting, .phase-icon.starting, .phase-icon.initializing { .phase-icon.waiting, .phase-icon.unpacking, .phase-icon.starting, .phase-icon.initializing {
background-color: #ddd; background-color: #ddd;
} }

View file

@ -4736,6 +4736,9 @@ quayApp.directive('buildMessage', function () {
case 'waiting': case 'waiting':
return 'Waiting for available build worker'; return 'Waiting for available build worker';
case 'unpacking':
return 'Unpacking build package';
case 'pulling': case 'pulling':
return 'Pulling base image'; return 'Pulling base image';
@ -4791,6 +4794,7 @@ quayApp.directive('buildProgress', function () {
case 'starting': case 'starting':
case 'waiting': case 'waiting':
case 'cannot_load': case 'cannot_load':
case 'unpacking':
return 0; return 0;
break; break;
} }

View file

@ -521,16 +521,6 @@ class DockerfileBuildWorker(Worker):
logger.info(filetype_msg) logger.info(filetype_msg)
log_appender(filetype_msg) log_appender(filetype_msg)
if c_type not in self._mime_processors:
log_appender('error', build_logs.PHASE)
repository_build.phase = 'error'
repository_build.save()
message = 'Unknown mime-type: %s' % c_type
log_appender(message, build_logs.ERROR)
raise JobException(message)
build_dir = self._mime_processors[c_type](docker_resource)
# Spawn a notification that the build has started. # Spawn a notification that the build has started.
event_data = { event_data = {
'build_id': repository_build.uuid, 'build_id': repository_build.uuid,
@ -544,6 +534,7 @@ class DockerfileBuildWorker(Worker):
subpage='build?current=%s' % repository_build.uuid, subpage='build?current=%s' % repository_build.uuid,
pathargs=['build', repository_build.uuid]) pathargs=['build', repository_build.uuid])
# Setup a handler for spawning failure messages. # Setup a handler for spawning failure messages.
def spawn_failure(message, event_data): def spawn_failure(message, event_data):
event_data['error_message'] = message event_data['error_message'] = message
@ -551,6 +542,28 @@ class DockerfileBuildWorker(Worker):
subpage='build?current=%s' % repository_build.uuid, subpage='build?current=%s' % repository_build.uuid,
pathargs=['build', repository_build.uuid]) pathargs=['build', repository_build.uuid])
if c_type not in self._mime_processors:
log_appender('error', build_logs.PHASE)
repository_build.phase = 'error'
repository_build.save()
message = 'Unknown mime-type: %s' % c_type
log_appender(message, build_logs.ERROR)
spawn_failure(message, event_data)
raise JobException(message)
# Try to build the build directory package from the buildpack.
log_appender('unpacking', build_logs.PHASE)
repository_build.phase = 'unpacking'
repository_build.save()
build_dir = None
try:
build_dir = self._mime_processors[c_type](docker_resource)
except Exception as ex:
log_appender(ex.message, build_logs.ERROR)
spawn_failure(ex.message, event_data)
raise JobException(ex.message)
# Start the build process. # Start the build process.
try: try:
with DockerfileBuildContext(build_dir, build_subdir, repo, tag_names, access_token, with DockerfileBuildContext(build_dir, build_subdir, repo, tag_names, access_token,