Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic SYNERGY (steve huntington)
Decrease font size
Increase font size
Topic Title: PRETRANS TASK Trigger
Topic Summary: Enforce standards and process via pretrans task trigger
Created On: 24-Oct-2006 17:05
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 24-Oct-2006 17:05
User is offline View Users Profile Print this message


Robert Doerr

Posts: 3
Joined: 28-Apr-2004

I have created a single pretransition task trigger which is made up of several functions which in some cases prevent a task from being checked-in. If new task trigger requirements are needed, merely add a function to the existing trigger script. Currently I have 4 functions:

Our SW process requires that all tasks be associated to a CR (Problem). If on task check-in and there is no associated CR I will alert the user and fail the check-in.

Before successful task check-in CM wants all the associated objects' release tag to match that of the task. One is amazed what some engineers will do.

Our SM process also requires that source files pass a syntax check prior to checkin. If it fails the syntax check CM currently does not abort the task checkin BUT the engineer is notified and a log updated. The external log is reviewed with management monthly.

Lastly the 4th function checks if a newly created object has it parent directory object also associated to its task. If not, the directory object in 'working' status is associated to the task being checked. This CAN and DOES happen when an engineer is creating multiple new objects in the same directory under two or more tasks.

The Trig_eng.def:
pretransition
{
task
{
completed pre_process_task_checkin release task_number created_in database current_user task_subsys resolver modifiable_in;
}

pre_process_task_checkin script:
#!/bin/bash
#
######################################################################
#
# Name: pre_process_task_checkin
#
# Parameters: 1: release
# 2: task_number
# 3: created_in
# 4: database
# 5: current_user
# 6: task subusys
# 7: owner
# 8: modifiable_in
#
# Purpose: Run as 'super' script for PRE-TRANS trigger to executes
# all the pre-checkin task-related scripts. Each new
# script is added as a function to this script.
#
# If new parameters are required, they need to be added
# at the tail end
#
# Functions: is_task_associated_2_cr
# compare_project_N_task_release
# chk_4_newly_created_files
# perform_SDDL_compile
#
# Requirement: Must run as just about anybody.
#
# History: 1 10/18/04 Initial version
# 11 12/09/04 Add SDDL compile check
# 12 01/04/05 Add 'current_user' parameter
#
#####################################################################
DB=`echo $4 | sed -e "s/\/db.*$//"`
CCM_HOME=/usr/local/ccm
export EXE=/bu1/home/cbs/exe
PATH=$CCM_HOME/bin:$EXE:$PATH

#####################################################################
# Determine if task at hand is associated to a CR, reject if NOT.
#####################################################################
function is_task_associated_2_cr
{
if [ "$5" != "ccm_root" ]; then
xx=`ccm query "has_associated_task('$3/task/task$2/1')"`
if [ "$xx" = "" ]; then
echo MSG:Task appears to NOT be associated to a CR, check-in rejected
exit 2
fi
fi

}

#####################################################################
# Determine if the release value of the task matches the release
# value of the project's objects.
#####################################################################
function compare_project_N_task_release
{
TASK_RELEASE=$1

RELEASES=`ccm query "is_associated_cv_of('$3/task/task$2/1')" -u -f "%release"`

for RELEASE in $RELEASES; do
if [ "$RELEASE" != "$TASK_RELEASE" ]; then
echo MSG:Task release value $TASK_RELEASE does not match that of the associated PROJECT $RELEASE, check-in rejected
exit 3
fi
done

}

#####################################################################
# Check if any files are associated with this task. If so make
# sure that the new directory object is also associated to this task.
#
# This fixes Larry's instance where he created a new
# log701.sim-1 file but the task remained ASSIGNED. He
# then created several new files under a second task and
# checked that task in. The objects' statuses = INTEGRATE
# but the newly created directory object was associated
# to the first task and not the checked-in task and
# thereby not visible to PREP upon reconfig.
#####################################################################
function chk_4_newly_created_files
{
OBJS=`ccm query "is_associated_cv_of('$3/task/task$2/1')" -u -f "%objectname"`

for OBJECT in $OBJS; do
PROJECT=`ccm query "has_member('$OBJECT')" -u -f "%objectname" | tail -1`
DIR_DATA=`ccm query "has_child('$OBJECT', '$PROJECT')" -u -f "%objectname|%status"`
DIR_OBJECT=`echo $DIR_DATA | cut -f1 -d\| `
DIR_STATUS=`echo $DIR_DATA | cut -f2 -d\| `
if [ "$DIR_STATUS" = "working" ]; then
ccm task -a "$3#$2" -obj $DIR_OBJECT 2> /dev/null
ccm ci -c "Auto association of directory object to task $3#$2" -s integrate $DIR_OBJECT
fi
done

}

#####################################################################
# Check if any files that are associated with this task are .sim files,
# if so then run SDDL on it and see if it passes. Do not prevent the
# file from being checked in (for now) but alert the user of the
# problem.
#####################################################################
function perform_SDDL_compile
{

for OBJECT in $OBJS; do
FILENAME=`echo $OBJECT | cut -f1 -d-`
EXTENSION=`echo $FILENAME | cut -f2 -d.`
if [ "$EXTENSION" = "sim" ]; then
ccm cat $OBJECT > /tmp/$3$2xyz.sim
sddl /tmp/$3$2xyz.sim /tmp/$3$2xyz.sddl &> /tmp/$3$2xyz.log
HOSED=`cat /tmp/$3$2xyz.log | grep ^Errors | wc -l`
if [ "$HOSED" -gt 0 ]; then
echo MSG:Warning: File $FILENAME did not pass the SDDL check....
echo `date`:$5:$OBJECT failed SDDL compile >> /tmp/SDDL_WATCH_DOG
fi
fi
done
rm -f /tmp/$3$2xyz.* 2> /dev/null

}

#####################################################################
# Main Body
#####################################################################

# Start up a session on the RIGHT server
HOST=`hostname | cut -f2 -d\.`
if [ "$HOST" = "jpl" ]; then
DB=/cbs/ccmdb/jplnew
else
DB=/ccmdb/jplnew
fi

export CCM_ADDR=`ccm start -q -nogui -m -d $DB`

is_task_associated_2_cr $1 $2 $3 $DB $5
compare_project_N_task_release $1 $2 $3 $DB $5
chk_4_newly_created_files $1 $2 $3 $DB $5
perform_SDDL_compile $1 $2 $3 $DB $5

ccm stop
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic SYNERGY forum.
There are currently 2 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 15:34.
There are currently 0 guests browsing this forum, which makes a total of 2 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.