Fix exception in Gitlab trigger when project is not present
Fixes #1629
This commit is contained in:
parent
9d48bcd0f1
commit
626042b10a
1 changed files with 7 additions and 8 deletions
|
@ -1,8 +1,6 @@
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from functools import wraps
|
from functools import wraps
|
||||||
from urlparse import urljoin
|
|
||||||
|
|
||||||
from app import app, gitlab_trigger
|
from app import app, gitlab_trigger
|
||||||
|
|
||||||
from jsonschema import validate
|
from jsonschema import validate
|
||||||
|
@ -414,17 +412,18 @@ class GitLabBuildTrigger(BuildTriggerHandler):
|
||||||
if not payload:
|
if not payload:
|
||||||
raise SkipRequestException()
|
raise SkipRequestException()
|
||||||
|
|
||||||
|
logger.debug('GitLab trigger payload %s', payload)
|
||||||
|
|
||||||
# Lookup the default branch.
|
# Lookup the default branch.
|
||||||
default_branch = None
|
|
||||||
gl_client = self._get_authorized_client()
|
gl_client = self._get_authorized_client()
|
||||||
repo = gl_client.getproject(self.config['build_source'])
|
repo = gl_client.getproject(self.config['build_source'])
|
||||||
if repo is not False:
|
if repo is False:
|
||||||
default_branch = repo['default_branch']
|
logger.debug('Skipping GitLab build; project %s not found', self.config['build_source'])
|
||||||
lookup_user = self.lookup_user
|
raise SkipRequestException()
|
||||||
|
|
||||||
logger.debug('GitLab trigger payload %s', payload)
|
default_branch = repo['default_branch']
|
||||||
metadata = get_transformed_webhook_payload(payload, default_branch=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)
|
prepared = self.prepare_build(metadata)
|
||||||
|
|
||||||
# Check if we should skip this build.
|
# Check if we should skip this build.
|
||||||
|
|
Reference in a new issue