I was at a customer site this week, and they asked me for a report that shows all of the changes and differences between two different RTC baselines.  It bothered me, because it was a pretty simple request.  So I got back to the hotel and wrote this quick bash script that will give them this information.  It works on Ubuntu, and should work on most any Linux variant.  You can download the script from here, but I will walk you through the various sections, and share some thoughts on how you can improve this for your Jazz users.

The top of the script is the usual fluff, nothing much interesting here, just identification of some default values (which you need to change to match your environment), a path to the Jazz scm command line tool, and some temp files.

TMPFILE="Jazz_BL_Exec.sh"
RESULTFILE="Jazz_BL_Result.txt"
SCM_CMD=/home/dtoczala/Jazz/Clients/RTC_3_0/scmtools/eclipse/scm

I then go out and get some user inputs to tell me which component and baselines they want the information for.  One note about this script is that you could EASILY change the logic, and feed this script based on some array of values to get multiple release notes reports, for multiple products and development lines.  Just don’t write the to the same result file (RESULTFILE).

One important thing to note is that I enclose the user defined baselines and component names in double quotes, because often the names of baselines and components in Jazz can have spaces in them.

read -p "Initial baseline is [$DEFAULT_START_BL] - " START_BL
if [ "$START_BL" = "" ]; then
TEMP=$DEFAULT_START_BL
else
TEMP=$START_BL
fi
START_BL=$QUOTE$TEMP$QUOTE

In the next section, we’ll begin writing commands into a file that we will execute at the end of this script.  First, we write the command to log into the repository using the supplied parameters.  Avoid the temptation to hardcode your userID and password. Don’t be a security hole, just enter them in interactively.

$SCM_CMD login -r $REPO_PATH -u $USERID -P $USERPW -n $NICKNAME

Next we write the scm command to give us the differences between the baselines.  We then make the file executable.

CMD="$SCM_CMD compare -r $NICKNAME -f i -I w -c $COMPONENT baseline $START_BL baseline $END_BL "
echo $CMD > $TMPFILE
chmod 775 $TMPFILE

Finally we execute the file that we have created (all two commands), capture the results, and then delete the file of commands.  If you are interested in the structure of the commands, run this without deleting the command file, so you can check out the command file.

CMD="$SCM_CMD compare -r $NICKNAME -f i -I w -c $COMPONENT baseline $START_BL baseline $END_BL "
echo $CMD > $TMPFILE
chmod 775 $TMPFILE
./$TMPFILE >> $RESULTFILE
rm $TMPFILE

The last thing that I do is to do some quick clean up, and I copy the file to a dropbox location on my machine.  This will then synchronize with an online repository that can be accessed anywhere.  From this repository, you can access your file contents with a simple link.  I’ll also use HTML widgets to display graphs on my RTC dashboards.  You can check it out at http://www.dropbox.com.

cp $RESULTFILE /home/dtoczala/Dropbox/Public/ReleaseNotes.txt
Advertisements