#!/usr/bin/perl # HOW TO APPLY THE TRIGGER # # Triggers: # JOB-CLOSE form-commit job "/home/scm/newjob.pl %user% %formname%" # use strict; my $logfile="/home/scm/job-log.txt"; my ($job,$cmd,$temp,$t,$val,$passwd,$user,$readfile)=""; my (@arry,@tarray)=(); # THIS IS THE PROTOTYPE VERSION # THE PERFORCE USER IDS AND PASSWORDS ARE STORED IN A CSV FILE IN /home/scm/proto-ldap.txt my $readfile="/home/scm/proto-ldap.txt"; open(RFIL,"$readfile") or die "\n CANNOT OPEN FILE $readfile FOR READ ACCESS: $!\n"; @tarray=(<RFIL>); close(RFIL); $user=$ARGV[0]; $job=$ARGV[1]; open(FIL,">$logfile") or die "\n CANNOT OPEN FILE $logfile FOR OVERWRITE: $!\n"; print FIL "JOB UNDER INSPECTION:$job\n$user\n"; $t=grep /$user/,@tarray; if($t==1) { foreach(@tarray) { $passwd=$_ if(/$user/); $passwd=~s/$user,?//; chomp($passwd); } } $cmd="p4 job -o $job"; print FIL "$cmd\n"; print FIL "\nUser: $user \t Passwd: $passwd\n"; $val=`$cmd 2>&1`; if($?!=0) { print FIL "\nERROR"; print FIL "\n$val\n"; exit 1; } @arry=split(/\n/,$val); #IF ANY JOBS ARE CLOSED, INVOKE THE PYTHON TRIGGER SCRIPT TO TRANSITION THE RESPECTIVE JIRA TICKETS TO "RESOLVED" STATE foreach(@arry) { chomp($_); if(/^Status:\s+closed/) { `python /home/scm/closeIssue.py $user $passwd $job`; close(FIL); exit 0; } } close(FIL);
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 7825 | Jai Siddagangappa |
Perforce-JIRA trigger scripts - Jaishankar Siddagangappa When you have Perforce and JIRA integrated and have imported the JIRA jobspec into Perforce, each JIRA ticket created will result in an associated Perforce job to be created. Unfortunately at this point, the reverse integration is not supported by Atlassian. When a Perforce Job is closed, the associated JIRA ticket must be transitioned from its current state (open, reopened, in progress) to the "Resolved" state. These triggers help achieve this. |