package MinJIRA; #============================================================================== # Copyright and license info is available in the LICENSE file included with # the Server Deployment Package (SDP), and also available online: # https://swarm.workshop.perforce.com/projects/perforce-software-sdp/view/main/LICENSE #------------------------------------------------------------------------------ =head1 NAME MinJIRA.pm - Minimal JIRA interface module. =head1 VERSION 1.1.1 =head1 DESCRIPTION Provides a minimal interface to JIRA via the JIRA REST API. =head1 PUBLIC DATA None =head1 PUBLIC FUNCTIONS =cut require Exporter; use strict; use JSON; use JIRA::Client::Automated; use Msg; # The next line avoids problems with 'use strict'. use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS); # Initialization processing occurs in the BEGIN block. BEGIN { # Keep $VERSION value the same as at the top of this file. $VERSION = "1.1.1"; } # Package interface standards. By default, any export can be blocked. @ISA = qw(Exporter); # Prototypes for public functions. sub GetIssueStatus($$$$;); #============================================================================== # Internal Functions #============================================================================== #============================================================================== # Public Functions #============================================================================== #------------------------------------------------------------------------------ =head2 GetIssueStatus() GetIssueStatus ($I<issueKey>, $I<JURL>, $I<JUser>, $I<JPassword>;) =head3 Description-GetIssueStatus Determines if the MinJIRA is Mac. =head3 Parameters-GetIssueStatus =over 4 =item * $I<issueKey> - Self-explanatory. =item * $I<JURL> URL for the JIRA server. =item * $I<JUser> JIRA user for accessing the REST API. =item * $I<JPassword> Password for the JIRA user. =back =head3 Returns-GetIssueStatus Returns the JIRA issue status string on success. =cut #------------------------------------------------------------------------------ sub GetIssueStatus ($$$$;) { $Msg->trace("CALL MinJIRA::GetIssueStatus(@_)"); my ($issueKey, $jurl, $juser, $jpwd) = @_; my $jira; my %issueHash; my $issueHashRef; my %fieldsHash; my $fieldsHashRef; my %statusHash; my $statusHashRef; my $issueStatus = "Undefined_JIRA_Issue_Status"; if ($issueKey =~ /^\w+-\d+/) { $Msg->trace ("This issue key looks valid: [$issueKey]."); } else { $Msg->error ("This issue key does NOT look valid: [$issueKey]."); return $issueStatus; } $jira = JIRA::Client::Automated->new($jurl, $juser, $jpwd); $issueHashRef = $jira->get_issue ($issueKey); %issueHash = %$issueHashRef; $Msg->debug ("JIRA Issue top-level fileds:"); foreach (keys %issueHash) { $Msg->trace ("I: [$_]: [$issueHash{$_}]."); } $fieldsHashRef = $issueHash{'fields'}; %fieldsHash = %$fieldsHashRef; foreach (keys %fieldsHash) { $Msg->trace ("F: [$_]"); } $statusHashRef = $fieldsHash{'status'}; %statusHash = %$statusHashRef; foreach (keys %statusHash) { $Msg->trace ("S: [$_]"); } $issueStatus = $statusHash{'name'}; return $issueStatus; } # Return package load success. 1;
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 18586 | Robert Cowham | Branching using cowhamr.sdp.dev | ||
//guest/perforce_software/sdp/dev/Server/Unix/p4/common/lib/MinJIRA.pm | |||||
#2 | 16029 | C. Thomas Tyler |
Routine merge to dev from main using: p4 merge -b perforce_software-sdp-dev |
||
#1 | 10638 | C. Thomas Tyler | Populate perforce_software-sdp-dev. | ||
//guest/perforce_software/sdp/main/Server/Unix/p4/common/lib/MinJIRA.pm | |||||
#1 | 10148 | C. Thomas Tyler | Promoted the Perforce Server Deployment Package to The Workshop. |