From 871c1634ed3f07e1efad0947d7d7ef0e44bc7174 Mon Sep 17 00:00:00 2001 From: Jimmy Zelinskie Date: Fri, 17 Jun 2016 18:03:27 -0400 Subject: [PATCH] buildman: mark missing buildargs as failure --- buildman/component/buildcomponent.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/buildman/component/buildcomponent.py b/buildman/component/buildcomponent.py index 8421bdee2..e8a80ca19 100644 --- a/buildman/component/buildcomponent.py +++ b/buildman/component/buildcomponent.py @@ -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