diff --git a/buildtrigger/gitlabhandler.py b/buildtrigger/gitlabhandler.py index 0d45ea2ba..945e88257 100644 --- a/buildtrigger/gitlabhandler.py +++ b/buildtrigger/gitlabhandler.py @@ -1,8 +1,6 @@ import logging from functools import wraps -from urlparse import urljoin - from app import app, gitlab_trigger from jsonschema import validate @@ -414,17 +412,18 @@ class GitLabBuildTrigger(BuildTriggerHandler): if not payload: raise SkipRequestException() + logger.debug('GitLab trigger payload %s', payload) + # Lookup the default branch. - default_branch = None gl_client = self._get_authorized_client() repo = gl_client.getproject(self.config['build_source']) - if repo is not False: - default_branch = repo['default_branch'] - lookup_user = self.lookup_user + if repo is False: + logger.debug('Skipping GitLab build; project %s not found', self.config['build_source']) + raise SkipRequestException() - logger.debug('GitLab trigger payload %s', payload) + default_branch = repo['default_branch'] metadata = get_transformed_webhook_payload(payload, default_branch=default_branch, - lookup_user=lookup_user) + lookup_user=self.lookup_user) prepared = self.prepare_build(metadata) # Check if we should skip this build.