Using the Jazz SCM command line to support software configuration audit
In this article we will look at how to use the Jazz SCM CLI in Rational Team Concert to derive some of the data required to perform a software configuration audit. Readers are expected to be familiar with Jazz SCM CLI. If not, please refer to Getting started with the Jazz SCM command line in Rational Team Concert
Prerequisites
This article assumes that the following steps have been completed:
- Rational Team Concert is installed on the client and server
- Jazz server is up and running
- Project areas and Team areas have been created
- Users have been created and given appropriate set of priviliges
- Workspaces, Streams, Baselines and Snapshots have been created
If you do not have the client and server running please refer to the Interactive installation guide. After that, refer to the Jazz Tutorial on how to set up the project area and team area for a team.
Generating BoM
One of the artifacts required to perform a system level audit is the Bill of Materials for a particular configuration of the system. Loosely speaking Bill of Materials is the list of configuration items, along with their version identifiers, present in a particular configuration of the system.
In Jazz SCM, a configuration is represented by a stream, workspace, baseline or a snapshot in the repository. For generating a Bill of Materials report we are more interested in a baseline, which represents a configuration of a component at any particular point in time or a snapshot, which represents a configuration of a stream/workspace at any particular point in time. Snapshot is just a collection of baselines, one for each component in the stream/workspace. In the examples given below we will look at how to list the baselines/snapshots present in the repository and in turn generate the Bill of Materials for a baseline/snapshot.
List Baselines
To list the baselines associated with all components present in a stream/workspace, run lscm list baselines with -w/–workspace option.
$ lscm ls baselines -w "JUnit Stream" -r localhost Component: (5630) "JUnit Releng" Baseline: (5631) 2 "Initial Snapshot for JUnit Releng" "" ADMIN Jun 6, 2012 12:37:58 PM Baseline: (5639) 1 "Initial Baseline for JUnit Releng" "Initial Baseline of Component JUnit Releng" ADMIN Jun 6, 2012 12:33:34 PM Component: (5632) "JUnit Source" Baseline: (5633) 5 "Milestone-1" "Baseline created as part of Milestone-1 Snapshot" ADMIN Jun 6, 2012 12:47:23 PM Baseline: (5634) 4 "Vector.java Modification-2" "Vector.java Modification-2" ADMIN Jun 6, 2012 12:46:10 PM Baseline: (5635) 3 "Vector.java Modification-1" "Vector.java Modification-1" ADMIN Jun 6, 2012 12:43:40 PM Baseline: (5636) 2 "Initial Snapshot for JUnit Source" "Initial Snapshot for JUnit Source" ADMIN Jun 6, 2012 12:37:58 PM Baseline: (5637) 1 "Initial Baseline for JUnit Source" "Initial Baseline of Component JUnit" ADMIN Jun 6, 2012 12:28:05 PM
JUnit Stream is the name of the stream.
To list the baselines associated with a particular component that is present in a stream/workspace, run lscm list baselines with -C/–components and -w/–workspace options.
Generate Bill of Materials for a baseline
To list the configuration items present in a baseline, run lscm list remotefiles with -b/–baseline option.
$ lscm -u y list remotefiles -b "Milestone-1" --depth - -r localhost "JUnit Source" (_918ikK-kEeG1Cpkga4BpnQ:_919JoK-kEeG1Cpkga4BpnQ) / (_-PoN4a-kEeGh3Lc1HlRGdw:_-Q0gt6-kEeG1Cpkga4BpnQ) /JUnit Examples/ (_-UJhgK-kEeGh3Lc1HlRGdw:_-ewPDK-kEeG1Cpkga4BpnQ) /JUnit Examples/.settings/ (_-ULWsK-kEeGh3Lc1HlRGdw:_-evn-6-kEeG1Cpkga4BpnQ) /JUnit Examples/.settings/org.eclipse.core.resources.prefs (_-UNL4K-kEeGh3Lc1HlRGdw:_-euZ0K-kEeG1Cpkga4BpnQ) /JUnit Examples/src/ (_-UQPMK-kEeGh3Lc1HlRGdw:_-ew2F6-kEeG1Cpkga4BpnQ) /JUnit Examples/src/com/ (_-USrcK-kEeGh3Lc1HlRGdw:_-ewPAq-kEeG1Cpkga4BpnQ) /JUnit Examples/src/com/ibm/ (_-UVuwK-kEeGh3Lc1HlRGdw:_-evn_q-kEeG1Cpkga4BpnQ) /JUnit Examples/src/com/ibm/team/ (_-UYLAK-kEeGh3Lc1HlRGdw:_-evA4K-kEeG1Cpkga4BpnQ) /JUnit Examples/src/com/ibm/team/junit/ (_-UaAMK-kEeGh3Lc1HlRGdw:_-euZ2q-kEeG1Cpkga4BpnQ) /JUnit Examples/src/com/ibm/team/junit/examples/ (_-UeRoK-kEeGh3Lc1HlRGdw:_kjQ2BK-nEeG1Cpkga4BpnQ) /JUnit Examples/src/com/ibm/team/junit/examples/Math.java (_-UffwK-kEeGh3Lc1HlRGdw:_ZAPexK-nEeG1Cpkga4BpnQ) /JUnit Examples/src/com/ibm/team/junit/examples/Vector.java (_-UcccK-kEeGh3Lc1HlRGdw:_-nq6dK-kEeG1Cpkga4BpnQ) /JUnit Examples/src/com/ibm/team/junit/examples/AllTests.java (_-UHFQK-kEeGh3Lc1HlRGdw:_-ewPCa-kEeG1Cpkga4BpnQ) /JUnit Examples/.classpath (_-UI6cK-kEeGh3Lc1HlRGdw:_-ew2FK-kEeG1Cpkga4BpnQ) /JUnit Examples/.project
- Milestone-1 is the name of the baseline and JUnit Source is the name of the component
- Using the -u/–show-uuid option displays the version identifier along with the unique identifier of the configuration items, in (unique-id:version-id) format
- Passing ‘-‘ as the value for the –depth option, lists all paths present in the baseline
We can customize the listing to a specific hierarchy by specifying a path present in the configuration and passing an appropriate value for the –depth option.
$ lscm -u y list remotefiles -b "Milestone-1" --depth 2 -r localhost "JUnit Source" "/JUnit Examples/src/com/ibm/team/junit/examples/" (_-UaAMK-kEeGh3Lc1HlRGdw:_-euZ2q-kEeG1Cpkga4BpnQ) /JUnit Examples/src/com/ibm/team/junit/examples/ (_-UeRoK-kEeGh3Lc1HlRGdw:_kjQ2BK-nEeG1Cpkga4BpnQ) /JUnit Examples/src/com/ibm/team/junit/examples/Math.java (_-UffwK-kEeGh3Lc1HlRGdw:_ZAPexK-nEeG1Cpkga4BpnQ) /JUnit Examples/src/com/ibm/team/junit/examples/Vector.java (_-UcccK-kEeGh3Lc1HlRGdw:_-nq6dK-kEeG1Cpkga4BpnQ) /JUnit Examples/src/com/ibm/team/junit/examples/AllTests.java
The above listing displays all the configuration items in two levels of the hierarchy, starting from the path “/JUnit Examples/src/com/ibm/team/junit/examples/”, present in the configuration.
List Snapshots
To list the snapshots associated with a particular stream/workspace, run lscm list snapshots.
$ lscm list snapshot -r localhost "JUnit Stream" (5640) "Milestone-1 Snapshot" Jun 6, 2012 12:47 PM (5641) "Initial Snapshot" Jun 6, 2012 12:37 PM
JUnit Stream is the name of the stream, for which to list the snapshots.
Generate Bill of Materials for a snapshot
To list the configuration items present in a snapshot, run lscm list snapshots with -s/–snapshot option.
$ lscm -u y list remotefiles -s "Milestone-1 Snapshot" --depth - -r localhost "JUnit Releng" (_u39q4K-lEeG1Cpkga4BpnQ:_u39q4a-lEeG1Cpkga4BpnQ) / (_zQ0hgK-lEeGh3Lc1HlRGdw:_zRjhUK-lEeG1Cpkga4BpnQ) /releng/ (_zSQr8K-lEeGh3Lc1HlRGdw:_zXtzvq-lEeG1Cpkga4BpnQ) /releng/.project (_zSUWUK-lEeGh3Lc1HlRGdw:_zXtzyK-lEeG1Cpkga4BpnQ) /releng/compiler/ (_zSVkcK-lEeGh3Lc1HlRGdw:_zXtzxa-lEeG1Cpkga4BpnQ) /releng/compiler/ecj.jar (_zSXZoK-lEeGh3Lc1HlRGdw:_zXtzsK-lEeG1Cpkga4BpnQ) /releng/compiler/junit.jar (_zSTIMK-lEeGh3Lc1HlRGdw:_zXtzt6-lEeG1Cpkga4BpnQ) /releng/build.xml
Milestone-1 Snapshot is the name of the snapshot and JUnit Releng is the name of the component.
Extract contents
More often than not, as part of an audit, it is required to validate the contents of an item present in a configuration. Once we have the BoM report for a configuration, we would know the unique id and version id of the item, using which we can extract the contents.
To extract the contents of a particular version of an item run lscm extract file.
$ lscm extract file -r localhost _-UeRoK-kEeGh3Lc1HlRGdw _kjQ2BK-nEeG1Cpkga4BpnQ C:TempMath.java Successfully extracted file to "C:tempMath.java".
_-UeRoK-kEeGh3Lc1HlRGdw is the unique id of the item /JUnit Examples/src/com/ibm/team/junit/examples/Math.java and _kjQ2BK-nEeG1Cpkga4BpnQ is the version id of the item. C:TempMath.java is the path on disk where the contents will be extracted.
List changes between releases
To get a list of changes that went in a particular release, we can use lscm compare command to compare the snapshot created for the current release with the snapshot created for the previous release.
$ lscm compare -I dcsfw -r localhost snapshot "Release1.1 Snapshot" snapshot "Release1.0 Snapshot" Outgoing Changes Component (1006) "JUnit Releng" Component (1007) "JUnit Source" (1013) ADMIN <ADMIN> 98: Fix testAddition testcase - Math.java Modification 2012/06/06 /JUnit Examples/src/com/ibm/team/junit/examples/Math.java (1009) ADMIN <ADMIN> 97: Add test cases for operations added in Release 1.1 - Modified in Release1.1 2012/06/06 /JUnit Examples/src/com/ibm/team/junit/examples/Vector.java Incoming Changes Component (1006) "JUnit Releng" Component (1007) "JUnit Source"
Release1.1 Snapshot is the name of the snapshot created for the current release and Release1.0 Snapshot is the name of the snapshot created for the previous release. The output indicates,
- Two files Math.java and Vector.java have been modified in the current release
- When and who made a particular change
- The workitems associated with a changeset, adding traceability to the task as part of which the changes were made
One can run ‘list changes’ command to determine the type of change(add, modify or delete) present in a changeset.
Summary
In this article we looked at using Jazz SCM CLI to
- Generate BoM for a configuration
- Extract the contents of a particular version of a configuration item
- List changes between releases
Copyright © 2012 IBM Corporation