Tuesday, January 15, 2013

clearcase setview command

cleartool setview command when executes will spawn a new shell, so if it is executed within a shell it would escape and won't return :-) . You need to use -exe



This technote explains why setting into an IBM® Rational® ClearCase® view from within a UNIX® or Linux® shell script does not process the remaining commands in that script.


When running the sample script below, all commands executed after the cleartool setviewcommand are not processed because cleartool setview spawns a new shell:

/usr/atria/bin/cleartool setview cmview
/usr/atria/bin/cleartool pwv
/usr/atria/bin/cleartool lsview
cd /vob/transition/Admin_transition
/usr/atria/bin/cleartool mkbrtype -global -nc 02b456
In the above script any commands that appear after the execution of cleartool setview cmvieware not processed because a shell is spawned off with exec(), which replaces the current program with a new program.
This means current process's text and code segments, which in this case is the script that contains all the commands, is replaced by the program getting executed, which is the shell invoked by runningcleartool setview cmview. Hence, none of the commands are processed beyond the point of invocation of the setview.

Resolving the problem

This is the expected behavior.
  1. Run cleartool setview prior to calling the script:


    $ cat /tmp/script.sh
    /usr/atria/bin/cleartool pwv

    $ cleartool setview new_view
    [new_view]$ /tmp/script.sh
    Working directory view: new_view
    Set view: new_view
  2. Run the cleartool setview command and exec into the script:


    $ cleartool setview -exec /tmp/script.sh new_view
    Working directory view: new_view
    Set view: new_view


A quick example is:

cleartool setview -exec "/usr/local/bin/myscript.sh" $myview 

Friday, January 11, 2013

more headless jenkins under Mac OS X 10.x

Steps to create a headless Slave Jenkins Mac OS X

1. Install Java VM or JDK
    Downloading .DMG from Oracle Java site. Install
2. Install Apple X Code development plus command line package
    Download from Apple Developers site
3. Connect under-setup Jenkins Mac Slave to Jenkins Master through web browser
4. Create a Mac Slave Node on Master
5. From Slave, connect to Master from Mac Slave Node using command line:
    javaws http://<your jenkins master>:8080/computer/<YOUR SLAVE MACHINE NAME>/slave-agent.jnlp
or if the slave is headless:
    java -jar slave.jar -jnlpUrl http://<your jenkins master>:8080/computer/<YOUR SLAVE MACHINE NAME>/slave-agent.jnlp

6. The above step #5 will fail as expected

7. Create a .plist file org.jenkins-ci.plist for launchDaemons in
    /Library/LaunchDaemons/<create a dir name here>
All paths here are specific for my system.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<string>/Library/Application Support/build-slave/start-headless-jenkins-slave.sh</string>
<string>your user</string>
<true />

8. Create a LaunchDaemon script start-headless-jenkins-slave.sh in
    /Library/Application Support/<create a dir name here>
/usr/bin/java -jar slave.jar -jnlpUrl http://<your jenkins master:8080>/computer/<your mac slave>/slave-agent.jnlp

9. Create a launchDaemon script to start jenkins headless slave in case you want to do it manually, test, etc.
sudo launchctl load -w /Library/LaunchDaemons/org.jenkins-ci.plist

10. Put the command line in /etc/launchd.conf to start everytime the system reboots
launchctl load -w /Library/LaunchDaemons/org.jenkins-ci.plist

some examples of launchctl:

sudo launchctl list
sudo launchctl unload -w /System/Library/LaunchDaemons/finger.plist
sudo launchctl load -w /System/Library/LaunchDaemons/finger.plist


Thursday, January 10, 2013

Headless Jenkins in Mac OS X 10.8

Working on the Launch scripts, but for now save all relevant and related links: