handle wip branch from no -wip jenkins jobs (#36676)

This commit is contained in:
Benjamin Dauvergne 2019-10-03 22:57:31 +02:00 committed by Frédéric Péters
parent a2370672cd
commit ea15462e01
1 changed files with 37 additions and 22 deletions

View File

@ -177,38 +177,53 @@ $(function() {
}
});
function handle_jobs(jobs) {
$(jobs).each(function(idx, job) {
if (job.name.indexOf('wip%2F' + issue_no) == 0) {
$.ajax({
url: job.url + 'lastBuild/api/json',
async: true,
dataType: 'json',
crossDomain: true,
success: function(data) {
var date = new Date(data.timestamp);
var $jenkins_link = $('<div class="jenkins jenkins-' + data.result + '"><a href="' +
data.url + '">Jenkins: ' + data.fullDisplayName + ': ' + data.result + '</a>' +
' (' + date.toLocaleString() + ') ' +
'+ <a href="https://git.entrouvert.org/' + project_name + '.git/log?h=' + job.name + '">Gitolite</a>' +
'</div>');
$jenkins_link.appendTo($('#history'));
}
});
}
});
}
if ($('.controller-issues.action-show a.overview').length) {
var project_name = $('a.overview').attr('href').split('/')[2];
var issue_no = $('.icon-edit[accesskey=e]').attr('href').split('/')[2];
$.ajax({
var call1 = $.ajax({
url: 'https://jenkins.entrouvert.org/job/' + project_name + '-wip/api/json',
async: true,
dataType: 'json',
crossDomain: true,
success: function(data) {
$(data.jobs).each(function(idx, job) {
if (job.name.indexOf('wip%2F' + issue_no) == 0) {
$.ajax({
url: job.url + 'lastBuild/api/json',
async: true,
dataType: 'json',
crossDomain: true,
success: function(data) {
var date = new Date(data.timestamp);
var $jenkins_link = $('<div class="jenkins jenkins-' + data.result + '"><a href="' +
data.url + '">Jenkins: ' + data.fullDisplayName + ': ' + data.result + '</a>' +
' (' + date.toLocaleString() + ') ' +
'+ <a href="https://git.entrouvert.org/' + project_name + '.git/log?h=' + job.name + '">Gitolite</a>' +
'</div>');
$jenkins_link.appendTo($('#history'));
}
});
}
});
}
});
call1.then(function (data) {
handle_jobs(data.jobs);
}, function () {
var call2 = $.ajax({
url: 'https://jenkins.entrouvert.org/job/' + project_name + '/api/json',
async: true,
dataType: 'json',
crossDomain: true,
});
call2.then(function (data) {
handle_jobs(data.jobs);
});
});
}
var user_href = $('#loggedas a').attr('href');
if (user_href) {
$('div.journal.has-notes').each(function(idx, entry) {