Saturday, February 15, 2014

Execute SSH command as root from a Jenkins build without using keys

Here is an easy way to execute SSH commands on a Linux server from a Jenkins job without having to generate cumbersome keys. While this method may not be as secure as public key cryptography, if you are working in a securely firewalled private network (not the DMZ) that should be less of an issue.

Two plug-ins are used to make this work:
The EnvInject Plugin allows a job to setup environment variables, one of which can be used for masked passwords. I prefer this plugin to mask passwords as they do not show up in the build log or build environment variable saved information.
Assigning a masked password to the "sudopass" environment variable.

The Publish Over SSH plugins allows one to send files or execute commands over SSH as a build step. As you will see below there are three "Advanced" buttons, which are all open, you can select to see more options for this plugin. In the setup below it was necessary to check the "Exec in pty" box in order for the SSH command to run. (The SSH Server setup in the top part of the plugin must be done from the Jenkins Master configuration page.)

Exec command as root using SSH.

Here is SSH sudo command typed out:

echo $sudopass | sudo -S /local/apps/javahost/scripts/ || true

Tuesday, October 29, 2013

Alan Kay, Pioneer of GUI's, Graphics and Object-Oriented Programming, 1987 Video

Alan Kay, 1987
While I was watching Berkeley Professor Brian Harvey's Computer Science 61A: Structure and Interpretation of Computer Programs lectures, I came across an included video during the 2010 lectures #5 and #6 featuring rare footage of Alan Kay giving a talk in 1987 on object-oriented programming and the history of early computing milestones as pertains GUIs, graphics, interactivity, networking and code.

An excerpt from Alan Kay's Wikipedia article offers the following relevant info:
"In 1966, Alan began graduate school at the University of Utah College of Engineering, earning a Master's degree and a Ph.D. degree. There, he worked with Ivan Sutherland, who had done pioneering graphics programs including Sketchpad. This greatly inspired Kay's evolving views on objects and programming."
"Kay is one of the fathers of the idea of object-oriented programming, which he named, along with some colleagues at PARC and predecessors at the Norwegian Computing Center. He conceived the Dynabook concept which defined the conceptual basics for laptop and tablet computers and E-books, and is the architect of the modern overlapping windowing graphical user interface (GUI)."
Relive some exciting moments in computing history with these videos!!
(FYI: Alan starts talking at 2:38 minutes into the video after Brian Harvey's introduction.)

 Along with Alan's presentation are excerpts of a demo for the "Sketch Pad" given by Ivan Sutherland from 1962.

Ivan Sutherland, Sketch Pad demo, 1962

You'll also see parts of Douglas Engelbart's 1968 amazing Mother of All Demos. An excerpt from Wikipedia describes more on the demo:
"The Mother of All Demos is a name given retrospectively to Douglas Engelbart's December 9, 1968 demonstration of experimental computer technologies that are now commonplace. The live demonstration featured the introduction of a system called NLS which included one of[1][2] the earliest computer mouses as well as of video conferencing, teleconferencing, hypertext, word processing, hypermedia, object addressing and dynamic file linking, revision control, and a collaborative real-time editor."

Douglas Engelbart, Mother of All Demos, 1968

Sunday, October 27, 2013

CloudBees Palo Alto 2013 Jenkins User Conference (JUC)

The 2013 Jenkins User Conference (JUC) held in Palo Alto last week was both educational and inspirational. Kohsuke, creator of Jenkins, gave the keynote speech and two tracks for presentations followed, affording a variety of content to choose from. I was fortunate to meet attendees from Netflix, Evernote, VMware, Tesla as well as others in the DevOps community using Jenkins and find out what they were up to with regards to Continuous Integration and Delivery (CI/CD).

Kohsuke's keynote speech

This is the JUC description from the CloudBees site:
The Jenkins User Conference focuses on Continuous Integration (CI) as the fundamental best practice for enterprise software development. Our presenters are experienced Jenkins open source developers, executives, business managers, architects and authors who are luminaries within the Jenkins community. They represent the many organizations around the world who are leveraging the use of Jenkins within the application development lifecycle.

Stas Zvinyatskovsky
(Presenter from Yahoo!)
My favorite session was presented by Stas Zvinyatskovsky from Yahoo! titled, "Implementing Continuous Delivery at Yahoo!" From what I've heard some or all of the talks will be posted online in the near future. Once they are posted I will update this article with a link.

A couple plugins and tools I learned about at the conference, which I'd like to check out included:

A delicious Jenkins cupcake
  • DSL plugin - The job-dsl-plugin allows the programmatic creation of projects using a DSL. Pushing job creation into a script allows you to automate and standardize your Jenkins installation, unlike anything possible before. 
  • Audit Trail plugin - Keep a log of who performed particular Jenkins operations, such as configuring jobs. 
  • Sonar plugin - SonarQube is an open platform to manage code quality.
  • Folders plugin - This plugin allows users to create "folders" to organize jobs. Users can define custom taxonomies (like by project type, organization type etc). Folders are nestable and you can define views within folders 
  • Monitoring plugin - Monitoring of Jenkins / Hudson itself with JavaMelody. Open the report (or [http://yourhost/monitoring]) after installation. 
  • Xcode plugin - This plugin adds the ability to call Xcode command line tools to automate build and packaging iOS applications (iPhone, iPad, ...). 
  • Liquibase - Source control for your DB

Saturday, October 26, 2013

Passing Jenkins Build Variables Using PowerShell's "invoke-command" Cmdlet

Sometimes it is the small things that can take up most of the time when I'm working with PowerShell scripts in Jenkins. I call this the PowerShell Pareto Principle! Usually it is a syntax issue that bites me, but recently I had trouble passing in build variables using the invoke-command cmdlet. This example should clear things up if you encounter the same perplexities which stumped me.

invoke-command your_remote_servername {param(

By using the ArgumentList argument of invoke-command you can pass in outside variables into the Jenkins PowerShell plugin, executing code targeted for a remote server running the WinRM service. That's Hot!™

Wednesday, October 16, 2013

HELP! : The Biggest Thing Missing From The Jenkins Continuous Integration System

Recently I've been doing a lot of automation work using Jenkins - so much that I haven't written much online for the past year. My biggest Jenkins complaint is the sparse documentation of the many features and plugins as well as finding articles which put build tasks together to create a "Rube Goldberg machine" of automated bliss.

For starters I recommend reading "The Jenkins Definitive Guide" O'Reilly book. (I'm guilty of not having finished the text myself and ought to heed my own advice!) While the book covers a breadth of topics, it is the little things (e.g. the syntax of calling a Powershell one-liner with spaces and quotes) that often take up a good chunk of time during the initial configuration of jobs and can frustrate even the most patient of implementors.

What I have found using continuous integration automation systems (cruise control, hudson/jenkins) over several years is that art can emerge amid a string of hacked together disparate processes. Yes, no doubt, sometimes a Jenkins job really is just a hodgepodge, ragtag group of mishmash scripts glued together to form a solution. However, every now and again great things develop, with the shifting and shuffling of build jobs, a beautiful process is born from the thickets. These elevated build chains can become a pragmatic example of CI and agile programming fundamentals put into practice, placing theory at the tip of a button push. What great satisfaction!

As I begin to journal on my Jenkins experiences, it is my hope that my whimsical writings may help others save time and frustrations in learning to use a wonderful automation framework, which may very well become the corner stone to your continuous integration automated processes, whether planned for or not! That is just how it goes sometimes when you combine automation with an open source executor in a suit willing to do your scripted bidding . (As an added bonus Jenkins will also do your job for you, take out the garbage and walk the dog - simultaneously.)

Monday, August 27, 2012

From 60 to 0 with Gmail Shortcuts

Welcome to Monday. This is what my inbox looked liked when I got in... the message list continues outside of the screen capture, but you get the idea:

Monday morning inbox of horrors.

If you are like me and crave the fabled inbox zero, then seek no more -- I can help you reduce and keep your Gmail inbox at a manageable level or zero if you prefer. All you have to do is invest a little time reading this article and try a couple practice keyboard shortcut sessions. Once the shortcuts are second nature you will be able to reduce your inbox message conversations from 60 to 0 in a matter of minutes. This is where I got in 10 minutes time:

Ahh, bliss - a clean inbox.

Before we start let's see why this strategy works:

Keyboard shortcuts save time. Exponentially.
Trust me... Really!

Usually the pain about learning keyboard shortcuts is that there are too many to take in all at once. This article shows you the exact keyboard shortcuts you need to learn for to efficiently reduce messages in your inbox. (If you don't know why you might want to have fewer messages in your inbox read David Allen's Getting Things Done book for starters.)

1. The first thing you'll want to setup is a Google Labs feature called Auto-advance found in your Gmail settings -> Labs. 

FYI: The image below shows the information relevant to this article in green, although I've also highlighted some areas in pink with settings/features I also find useful that happened to be in the same screenshot.

Auto-advance Labs Feature

Next, configure turn on Gmail keyboard shortcuts and configure the Auto-advance feature you installed in step 1.

Add some bling to your Settings.

Great now that your Gmail is setup, here are the keyboard shortcuts that you need for this task. Again focus on the green, which are relevant to this task, although I've also highlighted other frequently used shortcuts in pink. You might learn those once you are comfortable with the green commands.
Gmail Keyboard Shortcuts Help Menu (press '?' to see this)

Here's the list of the green items which are relevant for the clean-up task in text form along with a brief description of what each command does:
u -- Return to conversation list -- Refreshes your page and returns you to the inbox, or list of conversations.
k -- Move to newer conversation -- Opens or moves your cursor to a more recent conversation. You can hit to expand a conversation.
j -- Move to older conversation -- Opens or moves your cursor to the next oldest conversation. You can hit to expand a conversation.
o or <Enter> -- Open -- Opens your conversation. Also expands or collapses a message if you are in 'Conversation View.'
p -- Previous message -- Moves your cursor to the previous message. You can hit to expand or collapse a message. (Only applicable in 'Conversation View.')
n -- Next message -- Moves your cursor to the next message. You can hit to expand or collapse a message. (Only applicable in 'Conversation View.')
v -- Move to -- Moves the conversation from the inbox to a different label, Spam or Trash.
s -- Star a message or conversation -- Adds or removes a star to a message or conversation. Stars allow you to give a message or conversation a special status.
# -- Delete -- Moves the conversation to Trash.
r -- Reply -- Replies to the message sender. + r allows you to reply to a message in a new window. (Only applicable in 'Conversation View.')
a -- Reply all -- Replies to all message recipients. +a allows you to reply to all message recipients in a new window. (Only applicable in 'Conversation View.')
f -- forward -- Forwards a message. + f allows you to forward a message in a new window. (Only applicable in 'Conversation View.')
Tab then <Enter> -- Send message -- Combo key: After composing your message, use this combination to send it automatically.
z   -- Undo -- Undoes your previous action, if possible (works for actions with an 'undo' link).
Some of the shortcuts are intuitive and some will require getting used to. (The navigation key choices stem from Vi, so sysadmins rejoice!)

The clean-up process

  1. From inbox view, jump into a message using <Enter>. 
  2. Once on a message decide if I want to delete (#), move (v), reply/reply all/forward (r/a/f), or mark with a star (s - pushing repeatedly cycles through the star icons).

    GTD TIP: If the item is actionable I may decide to forward to Evernote if it is something I want to look at later, like an article, image or attachment or to ToodleDo if the message is really a task that I need to get done. Repeat with me: My inbox is not my task list, my inbox is not my task list, my inbox is not my task list!!!

    To make it easy to do these forwards add your Evernote and ToodleDo email accounts to your Gmail contacts so they appear in the To: pop-up when you need to send a message to a 3rd party service. Then use the tab+enter combo shortcut to send your message, sans mouse.

  3. Rinse and repeat.

You may have noticed the clean-up process only uses a subset of the keyboard shortcuts I highlighted in green as relevant to the task. This is because you really only need those other keys (ukjpn and z) to navigate comfortably while you are cleaning house. These navigation keys are definitely worth learning right away and will liberate your mouse hand.

If you decide to try this out please leave a comment to let me know how it goes. The only thing I can say about learning this technique for myself is: Why didn't I learn these shortcuts sooner!?

Monday, July 30, 2012

Work, Success and Happiness

“Happiness is an attitude. We either make ourselves miserable, or happy and strong. The amount of work is the same.”
                ~Francesca Reigler 

To be happy at work it really helps to love what you do. Unfortunately not all of us can say we love our work, but fear not! I've found some videos sure to increase motivation and interest in the work we do.

In these 3 TED videos you will hopefully find a renewed interest in whatever work you do and be inspired to make the world a better place!

Richard St. John's 8 secrets of success

Tuesday, July 17, 2012

Shock The Taskbar, Shock The Taskbar

I really don't like it
Shockin' the Taskbah
Shock the Taskbah

A few years back I caught a glimpse of a coworkers screen and noticed his Windows taskbar was in a funny location. I tried moving my own taskbar over to the side and immediately saw how much more useful the window titles were, now that I could partially see what they said. I generally keep my "sidebar" width around 3-4 mini icons.

So what are you waiting for?!
Get vertical!

Sunday, July 15, 2012

Nature Inspires Creativity

Apricots and Avocado

Nature is inspiring and living simply doesn't mean you have to leave creativity at home! Unleashing the creative artist within is a wonderful way to create more balance throughout your life.

Laura's Nature Mosaic

A nature mosaic can be made practically anywhere out of doors and from materials you find in your natural surroundings. To the right is  a mosaic with a giant redwood tree, some wispy green clouds and a sun in the background.

Joshua's Nature Mosaic

A framed nature mosaic with tall aquamarine trees, a log house with chimney smoke and a little garden.

There was charcoal all over the forest we were visiting due to the 2002 Colorado Hayman fire and we left a few tags, in hidden places, to revisit in the future.
Charcoal Tagging
Mr. Smiley

Wednesday, July 11, 2012

Greenshot For My Screenshot

Greenshot is a free screen capture tool and is a must have if you still use your print screen button <PrtScn> and paste images into Paint and MS Word.

My favorite features in the Greenshot image editor include drawing shapes, obfuscating image areas, adding annotations and highlighting. 

Greenshot Editor Demo

After I take a Greenshot using the PrtScn button, I can directly paste this image into Gmail when I use Chrome. This combination is really efficient for saving words in an email by using an image.