* Add gitlab pipeline.
This commit is contained in:
+10
-26
@@ -1,6 +1,12 @@
|
||||
$('#repo').change(function()
|
||||
{
|
||||
var repoID = $(this).val();
|
||||
$.getJSON(createLink('job', 'ajaxGetProductByRepo', 'repoID=' + repoID), function(product)
|
||||
{
|
||||
console.log(product);
|
||||
}
|
||||
);
|
||||
|
||||
var type = 'Git';
|
||||
if(typeof(repoTypes[repoID]) != 'undefined') type = repoTypes[repoID];
|
||||
|
||||
@@ -82,37 +88,15 @@ $('#triggerType').change(function()
|
||||
}
|
||||
});
|
||||
|
||||
$('#gitlabServer').change(function()
|
||||
{
|
||||
var repoID = $('#repo').val();
|
||||
$('#gitlabServerTR #pipeline').remove();
|
||||
$('#gitlabServerTR #pipeline_chosen').remove();
|
||||
$('#gitlabServerTR .input-group').append("<div class='load-indicator loading'></div>");
|
||||
$.getJSON(createLink('gitlab', 'ajaxGetGitlabPipeline', 'repoID=' + repoID), function(tasks)
|
||||
{
|
||||
html = "<select id='pipeline' name='pipeline' class='form-control'>";
|
||||
for(taskKey in tasks)
|
||||
{
|
||||
var task = tasks[taskKey];
|
||||
html += "<option value='" + taskKey + "'>" + task + "</option>";
|
||||
}
|
||||
html += '</select>';
|
||||
$('#gitlabServerTR .loading').remove();
|
||||
$('#gitlabServerTR .input-group').append(html);
|
||||
|
||||
$('#gitlabServerTR #pipeline').chosen({drop_direction: 'auto'});
|
||||
})
|
||||
})
|
||||
|
||||
$('#jkServer').change(function()
|
||||
{
|
||||
var jenkinsID = $(this).val();
|
||||
$('#jenkinsServerTR #JkTask').remove();
|
||||
$('#jenkinsServerTR #JkTask_chosen').remove();
|
||||
$('#jenkinsServerTR #jkTask').remove();
|
||||
$('#jenkinsServerTR #jkTask_chosen').remove();
|
||||
$('#jenkinsServerTR .input-group').append("<div class='load-indicator loading'></div>");
|
||||
$.getJSON(createLink('jenkins', 'ajaxGetJenkinsTasks', 'jenkinsID=' + jenkinsID), function(tasks)
|
||||
{
|
||||
html = "<select id='JkTask' name='JkTask' class='form-control'>";
|
||||
html = "<select id='jkTask' name='jkTask' class='form-control'>";
|
||||
for(taskKey in tasks)
|
||||
{
|
||||
var task = tasks[taskKey];
|
||||
@@ -122,7 +106,7 @@ $('#jkServer').change(function()
|
||||
$('#jenkinsServerTR .loading').remove();
|
||||
$('#jenkinsServerTR .input-group').append(html);
|
||||
|
||||
$('#jenkinsServerTR #JkTask').chosen({drop_direction: 'auto'});
|
||||
$('#jenkinsServerTR #jkTask').chosen({drop_direction: 'auto'});
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
@@ -76,6 +76,6 @@ $lang->job->engineList['gitlab'] = 'GitLab';
|
||||
$lang->job->engineList['jenkins'] = 'Jenkins';
|
||||
|
||||
$lang->job->engineTips = new stdclass;
|
||||
$lang->job->engineTips->success = '构建引擎将使用GitLab项目内置的流水线';
|
||||
$lang->job->engineTips->error = '当前GitLab项目内没有可用的流水线,请先前往GitLab配置';
|
||||
$lang->job->engineTips->success = '构建引擎将使用GitLab项目内置的流水线.';
|
||||
$lang->job->engineTips->error = '当前GitLab项目内没有可用的流水线,请先前往GitLab配置.';
|
||||
|
||||
|
||||
+14
-1
@@ -119,6 +119,20 @@ class jobModel extends model
|
||||
->add('createdDate', helper::now())
|
||||
->remove('repoType')
|
||||
->get();
|
||||
|
||||
if($job->engine == 'jenkins')
|
||||
{
|
||||
$job->server = $job->jkServer;
|
||||
$job->pipeline = $job->jkTask;
|
||||
unset($job->jkServer);
|
||||
unset($job->jkTask);
|
||||
}
|
||||
|
||||
if(strtolower($job->engine) == 'gitlab')
|
||||
{
|
||||
var_dump($job);exit;
|
||||
}
|
||||
|
||||
if($job->triggerType == 'schedule') $job->atDay = empty($_POST['atDay']) ? '' : join(',', $this->post->atDay);
|
||||
|
||||
$job->svnDir = '';
|
||||
@@ -158,7 +172,6 @@ class jobModel extends model
|
||||
->batchCheckIF($job->triggerType === 'schedule', "atDay,atTime", 'notempty')
|
||||
->batchCheckIF($job->triggerType === 'commit', "comment", 'notempty')
|
||||
->batchCheckIF(($this->post->repoType == 'Subversion' and $job->triggerType == 'tag'), "svnDir", 'notempty')
|
||||
|
||||
->autoCheck()
|
||||
->exec();
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
<th class='text-left'><?php common::printOrderLink('name', $orderBy, $vars, $lang->job->name);?></th>
|
||||
<th class='w-150px text-left'><?php common::printOrderLink('repo', $orderBy, $vars, $lang->job->repo);?></th>
|
||||
<th class='w-80px'><?php common::printOrderLink('frame', $orderBy, $vars, $lang->job->frame);?></th>
|
||||
<th class='w-80px'><?php common::printOrderLink('engine', $orderBy, $vars, $lang->job->engine);?></th>
|
||||
<th class='w-250px text-left'><?php common::printOrderLink('server', $orderBy, $vars, $lang->job->jenkins);?></th>
|
||||
<th class='text-left'><?php echo $lang->job->triggerType;?></th>
|
||||
<th class='w-100px text-center'><?php common::printOrderLink('lastStatus', $orderBy, $vars, $lang->job->lastStatus);?></th>
|
||||
@@ -44,6 +45,7 @@
|
||||
<td title='<?php echo $job->name; ?>'><?php echo common::hasPriv('job', 'view') ? html::a($this->createLink('job', 'view', "jobID={$job->id}", 'html', true), $job->name, '', "class='iframe' data-width='90%'") : $job->name;?></td>
|
||||
<td title='<?php echo $job->repoName; ?>'><?php echo $job->repoName; ?></td>
|
||||
<td><?php echo zget($lang->job->frameList, $job->frame);?></td>
|
||||
<td><?php echo $job->engine;?></td>
|
||||
<?php $jenkins = urldecode($job->pipeline) . '@' . $job->jenkinsName;?>
|
||||
<td title='<?php echo $jenkins; ?>'><?php echo $jenkins; ?></td>
|
||||
<?php $triggerConfig = $this->job->getTriggerConfig($job);?>
|
||||
|
||||
@@ -55,16 +55,16 @@
|
||||
<div class='table-col'>
|
||||
<div class='input-group'>
|
||||
<span class='input-group-addon'><?php echo $lang->job->pipeline; ?></span>
|
||||
<?php echo html::select('JkTask', array('' => ''), '', "class='form-control chosen'"); ?>
|
||||
<?php echo html::select('jkTask', array('' => ''), '', "class='form-control chosen'"); ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr id="gitlabServerTR">
|
||||
<th><?php echo $lang->job->server; ?></th>
|
||||
<th></th>
|
||||
<td>
|
||||
<?php echo 'gitlabServer'; ?>
|
||||
<?php echo $lang->job->engineTips->success; ?>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user