* Add gitlab to pipeline job(staging).

This commit is contained in:
dingguodong
2021-07-22 09:30:46 +08:00
parent bbf8e0b88b
commit daf877dfb6
4 changed files with 83 additions and 25 deletions
+2 -1
View File
@@ -86,7 +86,8 @@ class job extends control
$this->view->repoPairs = $repoPairs;
$this->view->repoTypes = $repoTypes;
$this->view->products = array(0 => '') + $this->loadModel('product')->getProductPairsByProject($this->projectID);
$this->view->serverList = $this->loadModel('jenkins')->getPairs();
$this->view->jenkinsServerList = $this->loadModel('jenkins')->getPairs();
$this->display();
}
+39 -9
View File
@@ -82,13 +82,13 @@ $('#triggerType').change(function()
}
});
$('#server').change(function()
$('#gitlabServer').change(function()
{
var jenkinsID = $(this).val();
$('#pipelineBox #pipeline').remove();
$('#pipelineBox #pipeline_chosen').remove();
$('#pipelineBox .input-group').append("<div class='load-indicator loading'></div>");
$.getJSON(createLink('jenkins', 'ajaxGetTasks', 'jenkinsID=' + jenkinsID), function(tasks)
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)
@@ -97,13 +97,43 @@ $('#server').change(function()
html += "<option value='" + taskKey + "'>" + task + "</option>";
}
html += '</select>';
$('#pipelineBox .loading').remove();
$('#pipelineBox .input-group').append(html);
$('#gitlabServerTR .loading').remove();
$('#gitlabServerTR .input-group').append(html);
$('#pipelineBox #pipeline').chosen({drop_direction: 'auto'});
$('#gitlabServerTR #pipeline').chosen({drop_direction: 'auto'});
})
})
$('#jkServer').change(function()
{
var jenkinsID = $(this).val();
$('#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'>";
for(taskKey in tasks)
{
var task = tasks[taskKey];
html += "<option value='" + taskKey + "'>" + task + "</option>";
}
html += '</select>';
$('#jenkinsServerTR .loading').remove();
$('#jenkinsServerTR .input-group').append(html);
$('#jenkinsServerTR #JkTask').chosen({drop_direction: 'auto'});
})
})
$('#engine').change(function()
{
$('#jenkinsServerTR').toggle($('#engine').val() == 'jenkins');
$('#gitlabServerTR').toggle($('#engine').val() == 'gitlab');
});
$('#engine').change();
$(function()
{
$('#triggerType').change();
+11
View File
@@ -68,3 +68,14 @@ $lang->job->paramValueList['$zentao_version'] = '当前版本号';
$lang->job->paramValueList['$zentao_account'] = '当前用户名';
$lang->job->paramValueList['$zentao_product'] = '当前产品ID';
$lang->job->paramValueList['$zentao_repopath'] = '当前版本库路径';
$lang->job->engineList = array();
$lang->job->engineList[''] = '';
$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配置';
+31 -15
View File
@@ -30,7 +30,7 @@
<td class='required'><?php echo html::input('name', '', "class='form-control'"); ?></td>
<td colspan="2" ></td>
</tr>
<tr>
<tr>
<th><?php echo $lang->job->repo; ?></th>
<td><?php echo html::select('repo', $repoPairs, '', "class='form-control chosen'"); ?></td>
</tr>
@@ -39,6 +39,36 @@
<td><?php echo html::select('product', $products, '', "class='form-control chosen'"); ?></td>
</tr>
<tr>
<th><?php echo $lang->job->engine; ?></th>
<td class='required'>
<div class='table-row'>
<div class='table-col'><?php echo html::select('engine', $lang->job->engineList, '', "class='form-control chosen'"); ?></div>
</div>
</div>
</td>
</tr>
<tr id="jenkinsServerTR">
<th><?php echo $lang->job->server; ?></th>
<td colspan='2'>
<div class='table-row'>
<div class='table-col'><?php echo html::select('jkServer', $jenkinsServerList, '', "class='form-control chosen'"); ?></div>
<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'"); ?>
</div>
</div>
</div>
</td>
</tr>
<tr id="gitlabServerTR">
<th><?php echo $lang->job->server; ?></th>
<td>
<?php echo 'gitlabServer'; ?>
</td>
</tr>
<tr>
<th><?php echo $lang->job->frame; ?></th>
<td><?php echo html::select('frame', $lang->job->frameList, '', "class='form-control chosen'"); ?></td>
</tr>
@@ -72,20 +102,6 @@
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->job->server; ?></th>
<td colspan='2'>
<div class='table-row'>
<div class='table-col'><?php echo html::select('server', $serverList, '', "class='form-control chosen'"); ?></div>
<div id='pipelineBox' class='table-col'>
<div class='input-group'>
<span class='input-group-addon'><?php echo $lang->job->pipeline; ?></span>
<?php echo html::select('pipeline', array('' => ''), '', "class='form-control chosen'"); ?>
</div>
</div>
</div>
</td>
</tr>
<tr>
<th><?php echo $lang->job->customParam;?></th>
<td colspan='2' id='paramDiv'>