6 Nov 2011, 11:59am
Projects:
by

leave a comment

  • Use Jenkins On Firefox By Talking To Your Mac

    I was watching I, Robot the other day, and thought how great it would be to use voice to control Jenkins.

    So last night I did a quick read, and then recorded this video.
    This used Mac Speech Recognition, so in theory I talked to my Mac, which then opened Jenkins pages on Firefox. Here are the commands:

    1. ‘Open Jenkins’: opens Jenkins home page (dashboard)
    2. ‘Build Bob’: builds a project called Bob
    3. ‘Configure system’: opens Jenkins configuration page

    I had to repeat each command 2-3 times because I speak Indonesian-accented English.

    Note: I scrolled the page up and down using the trackpad, it could be voice-controlled too actually.

    It’s easy to add a command:

    1. Create a new file in /Users/<username>/Library/Speech/Speakable Items/Application Speakable Items/firefox directory containing:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
      <plist version="1.0">
      <dict>
      <key>URL</key>
      <string>http://jenkins-host:8080</string>
      </dict>
      </plist>
      

      This format is Mac OS X Property List.

    2. Save this file as <command>, e.g. Open Jenkins (yes, with the space).
    3. Open System Preferences -> Speech, and switch Speakable Items on.
    4. Configure the Listening Method. I set it to Listen continuously with keyword, and keyword is Required before each command. My keyword is VIKI, you know, Virtual Interactive Kinetic Intelligence, from the movie.

    I haven’t investigated how much programming can be done on the command file, but this opens up the possibility of mapping Jenkins HTTP API to commands, and we will be able to fully interact with Jenkins using voice.

    Then the only thing left to do is… develop an American accent.

    22 Oct 2011, 11:20pm
    Projects:
    by

    leave a comment

  • 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.

    15 Aug 2011, 9:42pm
    Projects:
    by

    leave a comment

  • Break Room

    On one weekend evening…

    4 Aug 2011, 9:21pm
    Projects:
    by

    leave a comment

  • 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/

    3 Jul 2011, 6:37pm
    Projects:
    by

    leave a comment

  • 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.

    Recent Posts

    Recent Comments

    • Cliffano Subagio: Good to hear about your opportunity to visit Japan, I’m sure you will have a great...
    • Kayla: I’m going to Japan for two week this summer. Our sister city is Tsubame, Japan and my school has an...
    • poseidonfu: thanks,Very effective
    • anonymous: I really enjoyed both the last lecture and the book. I don’t think that theres anyone that I look up...
    • dioni: The thing I hate about HK is how people shove and push in the queue. Can’t they be civilized?!! I kept...

    Most Commented Posts

    Linkroll