Skip to content

Instantly share code, notes, and snippets.

@NigelThorne
Last active October 19, 2015 06:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NigelThorne/d47f05b15046296c0f45 to your computer and use it in GitHub Desktop.
Save NigelThorne/d47f05b15046296c0f45 to your computer and use it in GitHub Desktop.
Atlassian Slack - show build status from Teamcity. Ignore tester branches. Add Buttons to resize code review window.

installation

  • Install controlfreak in chrome
  • Add script for PullRequest page
  • Add JQuery library

Note: Change teamcity , branchkey, and buildTypeid.

var teamcity = "teamcity:8000"
var buildTypeid = "bt233";
var branchkey = "project34";
if($('button#inc').length == 0){
var inc_button = $("<button id='inc' class=''>+</button>");
var dec_button = $("<button id='dec' class=''>-</button>");
$('h3.title').append(inc_button);
$('h3.title').append(dec_button);
$('button#inc').click(function() {
var x = $('#aui-page-panel-content-body > div > section > div > div > div > div.file-tree-container');
x.width(x.width() + 150);
});
$('button#dec').click(function() {
var x = $('#aui-page-panel-content-body > div > section > div > div > div > div.file-tree-container');
x.width(0);
});
var branch = $('header.pull-request-metadata > div > div.pull-request-metadata-primary > div.pull-request-branches > span.aui-lozenge.source-branch.ref-lozenge.monospace-lozenge > span > span.name').text();
$('h3.title').append($(
"<a href='http://"+teamcity+"/viewType.html?buildTypeId="+buildTypeid+"&tab=buildTypeStatusDiv&branch_"+branchkey+"="+branch+"'>"+
"<img src='http://"+teamcity+"/app/rest/builds/buildType:(id:"+buildTypeid+"),branch:"+ branch +"/statusIcon'/></a>"))
}
function addbuildstatus( name, buildTypeid, branch) {
return $(
"<a href='http://"+teamcity+"/viewType.html?buildTypeId="+buildTypeid+"&tab=buildTypeStatusDiv&branch_"+branchkey+"="+branch+"'>"+
name + ": <img src='http://"+teamcity+"/app/rest/builds/buildType:(id:"+buildTypeid+"),branch:"+ branch +"/statusIcon'/></a></br>");
}
$(".source .name").each(function(){
branch = $(this).text();
$(this).closest("td.source")
.append( addbuildstatus("CI", "bt237", branch)) // bt237&branch_project34
.append( addbuildstatus("CI long", "bt238", branch)) // bt238&branch_project34
.append( addbuildstatus("release", "bt233", branch));
});
$(".pull-request-row").filter(function(n){
var text = $(this).text();
function includes(text2)
{
return text.indexOf(text2) > -1
}
return
includes("Vijayanand Gummi") ||
includes("Naveen Kumar") ||
includes("Gopal Reddy") ||
includes("Kasyap Krishnan") ;
}
).hide();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment