buildman: mark missing buildargs as failure

This commit is contained in:
Jimmy Zelinskie 2016-06-17 18:03:27 -04:00
parent c712be05e2
commit 871c1634ed

View file

@ -94,6 +94,7 @@ class BuildComponent(BaseComponent):
build_config = build_job.build_config
except BuildJobLoadException as irbe:
self._build_failure('Could not load build job information', irbe)
raise Return()
base_image_information = {}
@ -141,6 +142,14 @@ class BuildComponent(BaseComponent):
'private_key': build_job.repo_build.trigger.private_key,
}
# If the build args have no buildpack, mark it as a failure before sending
# it to a builder instance.
if not build_arguments['build_package'] and not build_arguments['git']:
logger.error('%s: insufficient build args: %s',
self._current_job.repo_build.uuid, build_arguments)
self._build_failure('Insufficient build arguments. No buildpack available.')
raise Return()
# Invoke the build.
logger.debug('Invoking build: %s', self.builder_realm)
logger.debug('With Arguments: %s', build_arguments)
@ -262,7 +271,7 @@ class BuildComponent(BaseComponent):
def _build_failure(self, error_message, exception=None):
""" Handles and logs a failed build. """
self._build_status.set_error(error_message, {
'internal_error': str(exception) if exception else None
'internal_error': str(exception) if exception else None
})
build_id = self._current_job.repo_build.uuid