It's all about the answers!

Ask a question

Continuous Integration with Build Forge and AccuRev SCM


Benjamin Chodroff (8985231) | asked Sep 28 '11, 12:23 a.m.
I wrote a sample adaptor to show how Build Forge can do continuous integration for AccuRev SCM. This is sample code only and is not supported by IBM or AccuRev. I'm sure it has a bug or two in there but I hope this helps others get started! Let me know if I can help.

Here is what the Bill of Materials looks like after completion. It allows you to see all the transaction that occurred since the last run and view all the changed files that compose those transactions.
http://i.imgur.com/vCY9T.png

Here is the adaptor:

<?xml version="1.0"?>
<!-- (c) Copyright by IBM Corp. and other(s) [2003], 2011 All Rights Reserved. -->
<!DOCTYPE PROJECT_INTERFACE SYSTEM "interface.dtd">
<PROJECT_INTERFACE IFTYPE="Source" INSTANCE="7.021">
<template>
<!-- Template section, these are parsed out of the final xml and used to populate an
existing environment group if an instance of this interface is linked with a project.
However, use the list below to help identify the variables needed to run this interface
if you are integrating it during a regular BuildForge step.
-->
<env name="USERNAME" value="ibm" />
<env name="PASSWORD" value="ibm" />
<env name="CurDate" value=".date %Y/%m/%d %H:%M:%S" />
<env name="LAST_RUN" value="2005/01/01 00:00:00" />
<env name="LABEL" value="BUILD_1"/>
<env name="SNAPSHOT" value="BUILD_1"/>
<env name="WORKSPACE" value="PBWSbuild" />
<env name="STREAM" value="PBWS" />
<env name="PROJ_PATH" value="PlantsByWebSphere" />
<env name="ACCUREV" value="/opt/accurev/bin/accurev" />
<env name="ACSERVER" value="RAFW_LOCAL" />
</template>
<!-- The 'ByDate' entry point is used to gather changes between two build instances. -->
<interface>
<setenv name="CHANGES" value="" type="temp"/>

<!-- ac_changes is detailed below, but is basically the entry point into the command set to gather change info -->
<run command="ac_changes" params="$USERNAME $PASSWORD $WORKSPACE $STREAM" server="$ACSERVER" dir="/$BF_PROJECTNAME_PHYS" timeout="360"/>
<!-- Here we test to see if we have any changes, 'Changes' should have some data if a change was found -->
<ontempenv name="CHANGES" state="empty">
<!-- No changes, fail the build, default behaviour is pass -->
<step result="FAIL"/>
</ontempenv>
<!-- If we found changes (not failing step), then update our environment for the next run -->
<onstep result="pass">
<setenv group="[ADAPTOR]" name="LAST_RUN" value="$CurDate"/>
</onstep>
</interface>
<command name="ac_changes">
<execute>
mkdir -p $BF_TAG
cd $BF_TAG
accurev login $1 $2
accurev chws -w $3 -l .
accurev update -i
accurev info -v
</execute>
<resultsblock>
<match pattern="^(.+):\s+(.+)$">
<bom category="INFO" section="INFO" >
<field name="$1" text="$2" />
</bom>
</match>
<!-- if we find any changes then set CHANGES to TRUE -->
<match pattern="Would make.(\w+).change">
<setenv name="CHANGES" value="some text" type="temp append\n" />
<run command="ac_diff" params="$STREAM $LAST_RUN" server="$ACSERVER" dir="/$BF_PROJECTNAME_PHYS/$BF_TAG" timeout="360"/>
<run command="ac_update" params="" server="$ACSERVER" dir="/$BF_PROJECTNAME_PHYS/$BF_TAG" timeout="360"/>
</match>
</resultsblock>
</command>
<command name="ac_diff">
<execute>
accurev hist -a -s $1 -fxiv -t "$2 $3"-now
</execute>
<resultsblock beginpattern="\s+<transaction" endpattern="\s+</transaction>">
<match pattern="\s+id=.(\d+).">
<bom category="details" section="Transaction" >
<field name="transaction" text="$1" />
</bom>
</match>
<match pattern="<comment>(.+)</comment>">
<bom category="details" section="Transaction" >
<field name="comment" text="$1" />
</bom>
</match>

<match pattern="\s+type=.(\w+).">
<bom category="details" section="Transaction" >
<field name="type" text="$1" />
</bom>
</match>
<match pattern="\s+time=.(\w+).">
<bom category="details" section="Transaction" >
<field name="time" text="$1" />
</bom>
</match>
<match pattern="\s+user=.(\w+).">
<bom category="details" section="Transaction" >
<field name="user" text="$1" />
</bom>
</match>



<resultsblock beginpattern="<version" endpattern="/>" >
<match pattern="path="(.+)"">
<bom category="details" section="version" >
<field name="path" text="$1" />
</bom>
</match>
<match pattern="eid="(.+)"">
<bom category="details" section="version" >
<field name="eid" text="$1" />
</bom>
</match>
<match pattern="virtual="(.+)"">
<bom category="details" section="version" >
<field name="virtual" text="$1" />
</bom>
</match>
<match pattern="real="(.+)"">
<bom category="details" section="version" >
<field name="real" text="$1" />
</bom>
</match>
<match pattern="virtualNamedVersion="(.+)"">
<bom category="details" section="version" >
<field name="virtualNamedVersion" text="$1" />
</bom>
</match>
<match pattern="realNamedVersion="(.+)"">
<bom category="details" section="version" >
<field name="realNamedVersion" text="$1" />
</bom>
</match>
<match pattern="elem_type="(.+)"">
<bom category="details" section="version" >
<field name="elem_type" text="$1" />
</bom>
</match>
<match pattern="dir="(.+)"">
<bom category="details" section="version" >
<field name="dir" text="$1" />
</bom>
</match>
</resultsblock>
</resultsblock>


</command>

<command name="ac_update">
<execute>
accurev pop PlantsByWebSphere -R -O
accurev update
accurev logout
</execute>
</command>

<!-- Reports a brief summary of the file changes that are included in this build. -->
<!-- The bomformat sets up the BuildForge BOM display for the information we gather during this interface execution -->
<bomformat category="INFO" title="Workspace Info">
<!-- A section defines the columns for blocks of information, a new row of information is added

each time the last field (by order number) in a block is populated with new information -->
<section name="INFO">
<field order="1" name="Shell" title="Shell"/>
<field order="2" name="Principal" title="Principal"/>
<field order="3" name="Host" title="Host"/>
<field order="4" name="Domain" title="Domain"/>
<field order="5" name="client_ver" title="client_ver"/>
<field order="6" name="Port" title="Port"/>
<field order="7" name="DB Encoding" title="DB Encoding" />
<field order="8" name="ACCUREV_BIN" text="ACCUREV_BIN" />
<field order="9" name="server_ver" text="server_ver" />
<field order="10" name="Client time" text="Client time" />
<field order="11" name="Server time" text="Server time" />
<field order="12" name="Depot" text="Depot" />
<field order="13" name="Workspace/ref" text="Workspace/ref" />
<field order="14" name="Basis" text="Basis" />
<field order="15" name="Top" text="Top" />
</section>
</bomformat>

<bomformat category="details" title="Source Details">
<section name="Transaction" expandable="true">
<field order="1" name="transaction" title="Activity/Defect Id"/>
<field order="5" name="comment" title="Comment"/>
<field order="2" name="type" title="Type"/>
<field order="3" name="time" title="Time"/>
<field order="4" name="user" title="User"/>
</section>

<section name="version" parent="Transaction">
<field order="1" name="path" title="Path"/>
<field order="2" name="eid" title="eid"/>
<field order="3" name="virtual" title="virtual"/>
<field order="4" name="real" title="real"/>
<field order="5" name="virtualNamedVersion" title="virtualNamedVersion"/>
<field order="6" name="realNamedVersion" title="realNamedVersion"/>
<field order="7" name="elem_type" title="elem_type"/>
<field order="8" name="dir" title="dir"/>
</section>
</bomformat>
</PROJECT_INTERFACE>

One answer



permanent link
Robert haig (1.0k16) | answered Oct 06 '11, 3:37 p.m.
FORUM MODERATOR / JAZZ DEVELOPER
thank you for your contribution.

Your answer


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.