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:
parent
f6f857eec2
commit
8681dd9cb9
3 changed files with 28 additions and 11 deletions
|
@ -823,7 +823,7 @@ i.toggle-icon:hover {
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -4736,6 +4736,9 @@ quayApp.directive('buildMessage', function () {
|
|||
case 'waiting':
|
||||
return 'Waiting for available build worker';
|
||||
|
||||
case 'unpacking':
|
||||
return 'Unpacking build package';
|
||||
|
||||
case 'pulling':
|
||||
return 'Pulling base image';
|
||||
|
||||
|
@ -4791,6 +4794,7 @@ quayApp.directive('buildProgress', function () {
|
|||
case 'starting':
|
||||
case 'waiting':
|
||||
case 'cannot_load':
|
||||
case 'unpacking':
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -521,16 +521,6 @@ class DockerfileBuildWorker(Worker):
|
|||
logger.info(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.
|
||||
event_data = {
|
||||
'build_id': repository_build.uuid,
|
||||
|
@ -544,6 +534,7 @@ class DockerfileBuildWorker(Worker):
|
|||
subpage='build?current=%s' % repository_build.uuid,
|
||||
pathargs=['build', repository_build.uuid])
|
||||
|
||||
|
||||
# Setup a handler for spawning failure messages.
|
||||
def spawn_failure(message, event_data):
|
||||
event_data['error_message'] = message
|
||||
|
@ -551,6 +542,28 @@ class DockerfileBuildWorker(Worker):
|
|||
subpage='build?current=%s' % 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.
|
||||
try:
|
||||
with DockerfileBuildContext(build_dir, build_subdir, repo, tag_names, access_token,
|
||||
|
|
Reference in a new issue