Pragmatic Programmer Stuart Holloway said in a tweet recently, “Anybody can be agile in a green field. Show me your 3rd, 4th, and 5th releases.” Well, we've been maintaining Oracle Mojarra JSF for 32 releases and, we’ve found hudson a completely invaluable tool for maintaining agility as the technology matures and requires maintenance across all the versions we've ever released. Unfortunately, project hygiene has been difficult to maintain across all the code lines, and the JSF 1.2 branch hasn't had a working hudson job in several years. This blog entry shares a little tip I uncovered while re-activing the Mojarra JSF 1.2 job.

Mojarra JSF 1.2 is maintained in CVS because it is not economically viable to move it to a more recent version control system. As such, it must use CVS_RSH. More recent versions of hudson have support for this, but for some reason I haven't been able to get it working with the java.net cvs server. I used a combination of perl and expect to get the checkout working.

I had to download and install expectperl from <http://sourceforge.net/projects/expectperl/> and the IO::Tty perl module from <http://search.cpan.org/~toddr/IO-Tty/Tty.pm> This little perl script successfully does the cvs update, even with the ssh password prompting.

  1. #!/usr/bin/perl
  2.  
  3. use Expect;
  4.  
  5. chdir("/files/hudson_local/jobs/MOJARRA_1_2X_ROLLING_GLASSFISH_2_1_1/workspace");
  6. $ENV{"CVSROOT"} = ":ext:8bit@java.net/cvs/javaserverfaces-sources~cvs-repository";
  7.  
  8. ($cvs = Expect->spawn("cvs update -d -P")) || die "Couldn't spawn cvs, $!";
  9.  
  10. unless ($cvs->expect(30, "Enter passphrase for key '/files/hudson_local/.ssh/id_rsa':")) {
  11.   die "Never got the passphrase prompt";
  12. }
  13.  
  14. print $cvs "this is not the real password\r";
  15.  
  16. unless ($cvs->expect(300, "cvs update: Updating www/legal/jsf-cddl")) {
  17.   die "Never saw update starting";
  18. }
  19.  
  20.