Merge pull request #1714 from coreos-inc/gitlab-tag
Fix exception in Gitlab trigger when project is not present
This commit is contained in:
commit
7cea696d83
1 changed files with 7 additions and 8 deletions
|
@ -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.
|
||||
|
|
Reference in a new issue