Nestor – A Faster And Simpler CLI For Jenkins
It all started because at one point I was using a rather resource-challenged machine running Windows and an Ubuntu VM at the same time, and Firefox froze every so often, rendering Jenkins BuildMonitor and Jenkins web interface useless most of the time. So I looked for an alternative and gave Jenkins CLI a go.
Like most Java applications, Jenkins built-in CLI also suffers from slow start up time (flame suit: ON) due to core Java libraries loading (Kohsuke later told me on #jenkins that there’s also a handshaking process involved). This led me to try Jenkins Remote Access API with curl, which performed significantly faster than Jenkins CLI.
So that’s great, but I have another issue with the fact that Jenkins CLI’s commands start with “java -jar jenkins-cli.jar …”, that’s a finger twister right there, and lengthy curl + URL obviously doesn’t help.
Enter Nestor, a Jenkins CLI written in Node.js that aims to be a faster and simpler alternative to the existing solutions. The catch? Node.js and npm support on Windows is not there yet, so if you managed to run Nestor on Windows please let me know about it. Nestor has been tested and used daily on OS X and Linux.
Simple setup
Install Nestor using npm install -g nestor
Configure the Jenkins instance you want to use using export JENKINS_URL=http://user:pass@host:port/path
Simple usage
Nestor commands are simple, it’s always nestor <action> <param>
To trigger a build
> nestor build studio-bob Job was started successfully
To view a job status
> nestor job studio-bob Status: OK No xml report files found for checkstyle Build stability: 3 out of the last 5 builds failed.
To list the executors
> nestor executor * master idle 39% studio-bob
To view the queue
> nestor queue Queue is empty
To view all jobs status on the dashboard
> nestor dashboard WARN blojsom-bloojm OK jenkins-buildmonitor FAIL studio-ae86 OK studio-bob
Check out Nestor’s GitHub README page for more commands available.
Hopefully that’s simple enough.
Note: The name Nestor was inspired by Captain Haddock’s butler at Marlinspike Hall, not the Argonaut one.
Work: couchdb javascript melbjs nodejs presentations shinetech
by Cliffano Subagio
1 comment
Node.js Presentations
I gave two Node.js-related talks within the past week.
The first one was titled “From Java To Node.js”, at Shine Technologies‘ developers meeting on August 5th, 2011.
The second one was titled “JavaScript Everywhere From Nose To Tail”, at Melbourne JavaScript usergroup on August 10th, 2011, with Carl Husselbee from Sensis.
Happy with the positive feedback from the audience of both talks, thanks folks, much appreciated!
Update (08/09/2011):
And here’s the video from the second talk…
JavaScript Everywhere – From Nose To Tail from Benjamin Pearson on Vimeo.
Using Node.js To Discover Jenkins On The Network
I’ve just added a new feature to Nestor to discover Jenkins on the network, and as it turned out, it’s pretty simple to do thanks to Node.js Datagram sockets API (hat tip Paul Querna).
Jenkins has a discovery feature as part of its remote access API where it listens on UDP port 33848, and whenever it receives a message, Jenkins will respond with an XML containing the instance’s URL, version number, and slave port information.
So how do you send a UDP message using NodeJS?
Here’s a sample function adapted from Nestor’s lib/service.js:
function sendUdp(message, host, port, cb) {
var socket = require('dgram').createSocket('udp4'),
buffer = new Buffer(message);
socket.on("error", function (err) {
cb(err);
});
socket.on("message", function (data) {
cb(null, data);
});
socket.send(buffer, 0, buffer.length, port, host, function (err, message) {
if (err) {
cb(err);
}
});
}
For Jenkins discovery purpose, send any message to any hostname on port 33848:
sendUdp('Long live Jenkins!', 'localhost', 33848, function () { ... });
and if there’s any Jenkins instance running on localhost, it will respond with an XML like this:
<hudson> <version>1.414</version> <url>http://localhost:8080</url> <slave-port>12345</slave-port> </hudson>
Simple!
konan cliffano$ nestor discover Jenkins 1.414 running at http://localhost:8080/
Couchtato Introduction
Last Thursday I put up a post at Shine Technologies blog titled Couchtato – A CouchDB Document Utility Tool Written In Node.js. It’s a short introduction to Couchtato, a little hobby project I worked on over several evenings and lunch breaks.
Do check it out if you are a CouchDB and NodeJS user.
Node.js Discussion On Teman Macet Podcast
Last May, I recorded a discussion in Indonesian language on Teman Macet podcast with the show’s host, Ronald Widha, and another guest who was a fellow NodeJS user, Julius Sirait. The discussion itself was more on NodeJS introduction and sharing what we had learnt thus far. The episode, #51 nodeJS bersama Julius Sirait dan Cliffano Subagio, was available for streaming/download in July.
NodeJS is one piece of technology that I’m very excited about. For web application development, I think Node, along with its web stack, is a nice middle ground between Ruby/Rails magical ‘simplicity’ and Java/JEE layers of complexity. For network-related stuffs, (I’m quoting Sami Samhuri here) NodeJS is a swiss army knife. Oh, and have I mentioned that NodeJS is fast? like seriously da*n fast? (thanks to V8).
As a side note, Indonesia is currently undergoing a strong growth in mobile Internet penetration, and with 200+ million people in the market, the progress is very exciting to watch. Teman Macet is one of the best podcast shows, technical or not, in Indonesian language. I personally find it immensely useful at providing information about Indonesian start ups and technology practitioners.