Simple RTC Release Notes Script


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

10 thoughts on “Simple RTC Release Notes Script

  1. Pingback: Jazz, Transparency, and what comes next? « Dan Toczala's Blog

  2. Evan Hughes

    Nice script, Dan. As the originator of the CLI and the scm compare subcommand, I have a quick comment:

    The intended model for running the CLI securely is to use the login subcommand. You should run scm login to allow access to your Jazz artifacts once for your account. Scripts should assume that they are properly logged in.

    That avoids dealing with pesky hardcoded usernames and passwords. 😉

    1. dtoczala

      I fully agree. That’s why I made the comment that this would be the first thing that you should change, and have these entered interactively. I just wanted to see what I could get out of the tool from the CLI, with a minimum of effort. I wanted to see what was possible.

  3. Marc

    The scm login command should have the ability to prompt AND store the password, so the password does not end up in plain text in the “history” shell command.

      1. Marc

        Also found out that most commands fail to read/re-use the persisted password 😦 (“-c” does not make any difference)

    1. dtoczala

      Michael, I am sorry, somehow that script was purged from my Dropbox area. I have restored it. You should be able to go and grab that script now.

  4. Pingback: Firmativ Review

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s