Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Jenkins plugin (custom for tb4)

  • Loading branch information...
commit 57e0df813d70750b7b69118ab2cc6ef680b10978 1 parent c5428ae
Pablo Villalba authored
Showing with 38 additions and 0 deletions.
  1. +1 −0  index.html
  2. +37 −0 js/plugins/jenkins.js
View
1  index.html
@@ -45,6 +45,7 @@
<script src="js/plugins/url_linker.js"></script>
<script src="js/plugins/cloudapp.js"></script>
+ <script src="js/plugins/jenkins.js"></script>
<script src="js/client.js"></script>
View
37 js/plugins/jenkins.js
@@ -0,0 +1,37 @@
+/**
+ * Jenkins: Fetches build status from Teambox
+ */
+
+(function () {
+
+ var $container = $("<div>")
+ .addClass("jenkins_status")
+ .css({ position: "fixed", "z-index": 1000, right: "20px", top: "1px", opacity: '0.6' });
+
+ function fetchJenkinsStatus() {
+ // Note: you can pass ?depth=1, =2 for more data
+ $.getJSON("http://ci.teambox.com/api/json?jsonp=?", function (jenkins) {
+ $container.empty();
+ _(jenkins.jobs).each(function (job) {
+ // Filter tb4 jobs only
+ if (job.name.match(/tb4/)) {
+ var icon = "//teambox.com/assets/emojis/" + (job.color === "red" ? "rage.png" : "green_heart.png")
+ , $img = $("<img>")
+ .attr({ src: icon, title: job.name })
+ .css({ width: "16px", height: "16px" });
+
+ $container.append($("<a>").attr({ href: job.url, target: "_blank" }).html($img));
+ }
+ });
+ });
+ }
+
+ $(function () {
+ $(document.body).append($container);
+
+ fetchJenkinsStatus();
+ setInterval(fetchJenkinsStatus, 60 * 1000);
+ });
+
+}());
+
Please sign in to comment.
Something went wrong with that request. Please try again.