initial gitlab angular stuff
This commit is contained in:
parent
d21fbb1204
commit
7426a540dd
5 changed files with 62 additions and 1 deletions
|
@ -1094,7 +1094,7 @@ class GitLabBuildTrigger(BuildTriggerHandler):
|
|||
return 'gitlab'
|
||||
|
||||
def _get_authorized_client(self):
|
||||
host = app.config.get('GITLAB_TRIGGER_CONFIG', {}).get('HOSTNAME', '')
|
||||
host = app.config.get('GITLAB_TRIGGER_CONFIG', {}).get('GITLAB_ENDPOINT', '')
|
||||
auth_token = self.auth_token or 'invalid'
|
||||
return gitlab.Gitlab(host, oauth_token=auth_token)
|
||||
|
||||
|
|
|
@ -70,3 +70,4 @@ git+https://github.com/DevTable/container-cloud-config.git
|
|||
git+https://github.com/DevTable/python-etcd.git
|
||||
git+https://github.com/NateFerrero/oauth2lib.git
|
||||
git+https://github.com/coreos/py-bitbucket.git
|
||||
git+https://github.com/coreos/pyapi-gitlab.git
|
||||
|
|
19
static/directives/trigger/gitlab/trigger-description.html
Normal file
19
static/directives/trigger/gitlab/trigger-description.html
Normal file
|
@ -0,0 +1,19 @@
|
|||
<span>
|
||||
<i class="fa fa-git-square fa-lg" style="margin-right: 6px" data-title="GitLab" bs-tooltip="tooltip.title"></i>
|
||||
Push to GitLab repository
|
||||
<a href="https://gitlab.com/{{ trigger.config.build_source }}" target="_new">
|
||||
{{ trigger.config.build_source }}
|
||||
</a>
|
||||
<div style="margin-top: 4px; margin-left: 26px; font-size: 12px; color: gray;" ng-if="!short">
|
||||
<div>
|
||||
<span class="trigger-description-subtitle">Branches/Tags:</span>
|
||||
<span ng-if="trigger.config.branchtag_regex">Matching Regular Expression {{ trigger.config.branchtag_regex }}</span>
|
||||
<span ng-if="!trigger.config.branchtag_regex">(All Branches and Tags)</span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<span class="trigger-description-subtitle">Dockerfile:</span>
|
||||
<span>{{ TriggerService.getDockerfileLocation(trigger) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
|
@ -8,10 +8,12 @@ angular.module('quay').factory('KeyService', ['$location', 'Config', function($l
|
|||
|
||||
keyService['stripePublishableKey'] = Config['STRIPE_PUBLISHABLE_KEY'];
|
||||
|
||||
keyService['gitlabTriggerClientId'] = oauth['GITLAB_TRIGGER_CONFIG']['CLIENT_ID'];
|
||||
keyService['githubTriggerClientId'] = oauth['GITHUB_TRIGGER_CONFIG']['CLIENT_ID'];
|
||||
keyService['githubLoginClientId'] = oauth['GITHUB_LOGIN_CONFIG']['CLIENT_ID'];
|
||||
keyService['googleLoginClientId'] = oauth['GOOGLE_LOGIN_CONFIG']['CLIENT_ID'];
|
||||
|
||||
keyService['gitlabRedirectUri'] = Config.getURL('/oauth2/gitlab/callback');
|
||||
keyService['githubRedirectUri'] = Config.getUrl('/oauth2/github/callback');
|
||||
keyService['googleRedirectUri'] = Config.getUrl('/oauth2/google/callback');
|
||||
|
||||
|
@ -23,6 +25,9 @@ angular.module('quay').factory('KeyService', ['$location', 'Config', function($l
|
|||
keyService['githubTriggerEndpoint'] = oauth['GITHUB_TRIGGER_CONFIG']['GITHUB_ENDPOINT'];
|
||||
keyService['githubTriggerAuthorizeUrl'] = oauth['GITHUB_TRIGGER_CONFIG']['AUTHORIZE_ENDPOINT'];
|
||||
|
||||
keySerivce['gitlabTriggerEndpoint'] = oauth['GITLAB_TRIGGER_CONFIG']['GITLAB_ENDPOINT'];
|
||||
keyService['gitlabTriggerAuthorizeUrl'] = oauth['GITLAB_TRIGGER_CONFIG']['AUTHORIZE_ENDPOINT'];
|
||||
|
||||
keyService['githubLoginScope'] = 'user:email';
|
||||
if (oauth['GITHUB_LOGIN_CONFIG']['ORG_RESTRICT']) {
|
||||
keyService['githubLoginScope'] += ',read:org';
|
||||
|
|
|
@ -88,6 +88,42 @@ angular.module('quay').factory('TriggerService', ['UtilService', '$sanitize', 'K
|
|||
}
|
||||
},
|
||||
|
||||
'gitlab': {
|
||||
'description': function(config) {
|
||||
var source = UtilService.textToSafeHtml(config['build_source']);
|
||||
var desc = '<i class="fa fa-git-square fa-lg" style="margin-left: 2px; margin-right: 2px"></i> Push to GitLab Repository ';
|
||||
desc += '<a href="https://gitlab.com/' + source + '" target="_blank">' + source + '</a>';
|
||||
desc += '<br>Dockerfile folder: //' + UtilService.textToSafeHtml(config['subdir']);
|
||||
return desc;
|
||||
},
|
||||
'run_parameters': [
|
||||
{
|
||||
'title': 'Branch',
|
||||
'type': 'option',
|
||||
'name': 'branch_name'
|
||||
}
|
||||
],
|
||||
'get_redirect_url': function(namespace, repository) {
|
||||
var redirect_uri = KeyService['gitlabRedirectUri'] + '/trigger/' +
|
||||
namespace + '/' + repository;
|
||||
var authorize_url = KeyService['gitlabTriggerAuthorizeUrl'];
|
||||
var client_id = KeyService['gitlabTriggerClientId'];
|
||||
|
||||
return authorize_url + 'client_id=' + client_id + '&redirect_uri=' + redirect_uri;
|
||||
},
|
||||
'is_external': false,
|
||||
'is_enabled': function() {
|
||||
return Features.GITLAB_BUILD;
|
||||
},
|
||||
'icon': 'fa-git-square',
|
||||
'title': function() { return 'GitLab Repository Push'; },
|
||||
'supports_full_directory_listing': false,
|
||||
'templates': {
|
||||
'credentials': '/static/directives/trigger/githost/credentials.html',
|
||||
'trigger-description': '/static/directives/trigger/gitlab/trigger-description.html'
|
||||
}
|
||||
},
|
||||
|
||||
'custom-git': {
|
||||
'description': function(config) {
|
||||
var source = UtilService.textToSafeHtml(config['build_source']);
|
||||
|
|
Reference in a new issue