Showing posts with label Jira. Show all posts
Showing posts with label Jira. Show all posts

Wednesday, August 12, 2015

Sample perl script to query JIRA

Using the Perl module http://search.cpan.org/~gnustavo/JIRA-REST-0.010/lib/JIRA/REST.pm

#!/usr/bin/perl -w
use strict;
use JIRA::REST;
use Data::Dumper;

my $jira = JIRA::REST->new('https://my.jira.net/jira', 'username', 'password');

# Get issue
my $issue = $jira->GET("/issue/TST-704");
#print Dumper($issue);

print "priority=$issue->{'fields'}->{'priority'}->{'name'}\n";
print "assignee=$issue->{'fields'}->{'assignee'}->{'name'}\n";
print "key=$issue->{'key'}\n";

# Iterate using utility methods
$jira->set_search_iterator({
        jql        => 'project = "TST" and issuetype in (Bug, scope) and fixVersion in (1.1r4, 1.1R4) and status in ( Closed, Resolved )',
        maxResults => -1,
        fields     => [ qw/summary status assignee/ ],
});

print "=================================================\n";
print "ISSUE-ID:STATUS:SUMMARY\n";
print "=================================================\n";
while (my $issue = $jira->next_issue) {
        #print "Found issue $issue->{key}\n";
        print "$issue->{key}: $issue->{fields}->{status}->{name}: $issue->{fields}->{summary}\n";
}

Monday, July 16, 2012

Jira workflows - Dealing with validator

Recently I got a request to make certain fields mandatory while marking a issue as 'Fix' (A step in our workflow'). Initially I made the requested custom fields as 'Required' in Field configuration, but it screwed !!!. After this change it started asking to provide values for fields which are not visible in 'create' page.
Finally I learnt it needs to be configured in Workflows validator.
I'm sharing my learning's here.

Introduction
Workflow is the place where we define business process. A JIRA workflow is the set of steps (or statuses) and transitions that an issue goes through during its lifecycle.
The below picture represents the default Jira workflow.
JIRA workflows consist of steps and transitions:
  A step represents a workflow's current status for an issue.An issue can exist in one step only at any point in time. In the diagram above the rectangular boxes represent steps/statuses.
 A transition is a link between two steps. A transition allows an issue to move from one step to another step. A transition is a one-way link, so if an issue needs to move back and forth between two steps, two transitions need to be created. In the diagram above the arrows represent transitions.

Friday, May 25, 2012

Jira Administration - Custom Fields & Screens

Jira has a complex administration concepts. Performing Jira admin tasks without understanding the complete flow leads to mistakes. In this post, I'm explaining how the Custom Fields are created and how to link it to project screens.

Creating custom fields
Let's assume you get a request to create a custom field "Severity". Check whether this custom field is already existing by

  • Login to Jira -> Administration -> Issue Fields -> Custom Fields
If it is not available, create it straight away

    • Login to Jira -> Administration -> Issue Fields -> Custom Fields -> Add custom Field -> Choose the field type -> Provide field name, search template, etc , applicable issue types, Applicable context.
   Custom Field Context
        The custom field which we created can be associated to all issues by selecting "Global context" or to specific projects. Depending on the usability of the custom field make it either global or project specific.

If the custom field is already exist, then try to reuse it.

Screens
Screens group multiple issue fields. Using Screens, you can control which fields are displayed. You can also split fields on a Screen into multiple tabs.

Wednesday, January 25, 2012

Jira Administration quick reference

1) Configuring the Layout and Design
Customising the Look and Feel
    Administration -> Global Settings -> Look and Feel -> To edit the logo, colours or time format, click the 'Edit Configuration' link at the bottom of the page
Changing the default language
  Administration -> General Configuration -> Edit Configuration > select the appropriate language in the drop-down box next to 'Default language'.
Configuring default issue navigator
  The Issue Navigator is used within JIRA to find and filter issues, and to display the search results in various formats ('views'). It is possible to
select which issue fields will be displayed as columns in the Issue Navigator.
   Administration -> Issue Fields -> Navigator Columns -> Add new column
Configuring the Default Dashboard
  Administration -> Global Settings -> System Dashboard -> Add Gadget
Configuring an Announcement Banner
  Administration -> Options & Settings -> Announcement Banner
Enabling Logout Confirmation
  Global Settings -> General Configuration -> Edit Configuration -> Logout confirmation

Tuesday, June 14, 2011

JIRA FAQ's

How to know the issues assigned to me?
Click your user name at the top-right of the page. Your 'User Profile' will be displayed.
From here click 'View Your Profile' in the left column.
Click the links under 'User Filters' in the right column to view your 'Assigned' issues, 'In Progress' issues and 'Reported' issues
Click the links under 'Assigned Open Issues per project' in the right column to view the unresolved issues (if any) that are assigned to you for each project.

How to see the list of all issues that you have created, which have not yet been resolved?
Go to the Dashboard and click the 'My Unresolved Reported Issues' link

How to change my Jira password?
Click your user name at the top-right of the page. Your 'User Profile' will be displayed.
Click 'Change Password' in the left column to change your JIRA password.
Unless you are not using Active Directory or LDAP username to login to JIRA


To view your watch-list
Click your user name at the top-right of the page. Your 'User Profile' will be displayed.
Click 'Your Watches' in the left column to view the list of issues that you are watching.


To change 'Number of Issues displayed per Issue Navigator page', 'Outgoing email format'
Click your user name at the top-right of the page. Your 'User Profile' will be displayed.
Click 'View Preferences'/'Edit Preferences' in the left column


How to attach a screenshot to an issue?
Open the JIRA issue. Click the 'Attach screenshot to this issue' link in the 'Operations' menu.
The 'Attach Screenshot' page will open in a new browser window.
Ensure that you have captured an image to your operating system's clipboard and click the 'Paste' button to paste the image.
Enter a file name and comment for the screenshot.
Click the 'Attach' button.

How to attach an image inline into a Description field? (editing rich text fields)

To include an image in the field, you would first attach the image to the issue, then type the following into the field: 
inline attachments !screenshot-1.jpg|thumbnail!


How to log work on an issue?
If time-tracking has been enabled, three coloured bars will be displayed for each issue, representing the following amounts of time: Original Estimate (blue), Remaining Estimate (orange), Time Spent (green).
Specifying an original time estimate
Navigate to the issue and edit it. Provide value to 'Original Estimation either in weeks/days/hours/minutes like 3d, 2h, 4w, etc
Logging work on an issue 
Navigate to the issue and select 'Log work done' from the 'Operations' menu on the left-hand side of the screen. 
In the 'Time Spent' field, enter the amount of time to be logged. 
In the 'Start Date' field, select the date/time when you started work. 
The 'Adjust Estimate' field affects the value of the issue's 'Remaining Estimate'.

In the 'Work Description' field, type a description about the work you have done.
Click the 'Log' button.
Editing a work log entry
Navigate to the issue and select the 'Work Log' tab (below the 'Description' field).
Click the 'Edit' link, located at the right of the work log entry. Edit the fields and Click the 'Log' button.
Deleting a work log entry
Navigate to the issue and select the 'Work Log' tab (below the 'Description' field).
Click the 'Delete' link, located at the right of the work log entry.


How to do a search for issues that are due seven days from now?
Choose "Find Issues" in the title bar to bring up the Issues Navigator.
Enter 7d into the "Due Date To" text field of the Issue Navigator.
To find all issues that are due after 1st June 2011, enter 1-6-2011 into the "Due After" field.

How to create a subtask?
Navigate to the issue and select 'Create sub-task' from the 'Operations' menu.
Choose the project and issue type. Enter the details of the issue
Click the 'Create' button

The parent issue's summary and issue key are displayed above the sub-task's summary.
Working with sub-tasks
If an issue has sub-tasks, then the issue screen will show a list of all the issue's sub-tasks.
You can reorder sub-tasks by using the up and down arrows.

You can perform actions on the sub-tasks by clicking the links in the right-most column, e.g. 'Resolve Issue', 'Close Issue', 'Reopen Issue'.
If time-tracking is enabled, colored bars will be displayed showing the aggregate 'Original Estimate', 'Remaining Estimate' and 'Time Spent' for all of the issue's sub-tasks.
Searching for sub-tasks
When sub-tasks are enabled, two extra entries will appear in the 'Issue Type' drop-down list in the
Issue Navigator's search form. These entries are: 'Standard Issue Types' and 'Sub-Task Issue Types'.
Converting a standard issue to a sub-task
Navigate to the issue and select 'Convert to sub-task' from the 'Operations' menu
Select Parent Issue and Sub-Task Type
Update Fields and click the 'Finish' button
The issue will be displayed. You will see that it is now a sub-task, that is, its parent's issue number is now displayed at the top of the screen

Converting a sub-task to a standard issue
Navigate to the sub-task issue and select 'Convert to issue' from the 'Operations' menu.
Select New Status and Update Fields. 
Click the 'Finish' button. The issue will be displayed. You will see that it is no longer a sub-task, that is, there is no longer a parent issue number displayed at the top of the screen.


How to create Voter and Watcher Lists?
JIRA allows a user to cast a vote for a particular issue - "voicing" their preference for that issue to be resolved or completed. JIRA also allows a user to watch a particular issue, signing up for notifications of any updates relating to that issue.
Watcher list
Navigate to issue -> More Actions -> Watchers -> Add users to Watch list -> Add.
Stop watching.
Navigate to issue -> More Actions -> Stop Watching.


How to create a link between issues?
Issue linking allows you to create an association between issues. For example: an issue may duplicate another or an issue may depend on another
Navigate to issue and click the word 'Link' under the Operations menu or "More Actions" (in newer version).

The 'Link Issue' form will be displayed. Select the type of link to be created, and the issue(s) to be linked to.
To delete a link
Inside a linked issue, click on the 'Manage Links' link (*  button in newer version).

In the following screen, click on the small trashcan icon in the bottom-right corner.

How to clone an issue?

Clone Issue allows a user to create a duplicate of an issue within the same project.
The clone issue is a replica of the original issue - containing the same information stored in the original issue - e.g.summary, affects versions, components, etc.

A clone issue is a separate entity from the original issue. Operations on the original issue have no affect on the clone issue and vice versa.

Navigate to issue and click the word 'clone' under the Operations menu or "More Actions" menu (in newer version).
Clone Issue Linking
The clone issue can be linked to the original issue when creating the clone issue.
Cloning and Sub-Tasks
Sub-Tasks can be cloned in the same manner. If the original issue has associated sub-tasks, clone sub-tasks will also be created for the clone issue.

How to move an issue from one project to another?

As there may be significant differences in the configuration of your original project and target project, the 'Move Issue' wizard allows you to change certain attributes of the issue. These include: Issue Type (if any custom type defined), Issue Status, Custom Fields.


Navigate to issue and click the word 'move' under the Operations menu or "More Actions" menu (in newer version).

The first page 'Move Issue' wizard will display. Select the project that you wish to move your issue to, and if required, change the issue type. Click 'Next'.
If you are required to change the status of your issue the 'Select Status' page will display. Select the new status for your issue and click 'Next'.
If you are required to specify the values for any required custom fields the 'Update Fields' page will display. Specify the desired values for each field, and click 'Next'.
The 'Confirmation' page will display with all of your changes.
click 'Move'


How to perform bulk operations?

From the Issue Navigator, perform a search with the required filters to produce an issue result set.
The Bulk Change option in the Issue Navigator menu provides access to the bulk operations. The Bulk Change link is only available to users who have been granted the global Bulk Change permission.
The next screen allows the selection of the issues that the bulk operation is to be performed on.

The next screen allows the bulk operation to be selected - Workflow Transition, Delete, Move or Edit. Select the operations and follow corresponding actions to complete the bulk operation.
It is possible to disable mail notification for a particular bulk operation by de-selecting the "Send Notification" checkbox in the bulk operation wizard.



Monday, June 13, 2011

A look around Jira concepts

Jira is a issue management tool.

What issue means to Jira?
    Bug, Project task, help-desk ticket, a leave request form.

Issue types
  Default
    - Bug
    - Improvement
    - New Feature
    - Task
    - or custom issue defined by admin

Issue statuses
  General: Open  -> Resolved  -> Closed
  Open
  In progress
  Resolved
  Reopened
  Closed

Issue Resolution types
  Fixed
  Won't fix
  Duplicate
  Incomplete
  Cannot Reproduce

Issue Priority types
  Blocker   (Highest)             P0
  Critical                               P1
  Major                                P2
  Minor                                P3
  Trivial

Project
  - S/w development project, marketing campaign, help-desk system, leave request management system
  - It will have a name and a KEY
  - Issue Key = Project Key-###  
     where ### is issue number
               
                 Projects
                      |
         ------------------------                              --------- Released
        |                                    |                 States   |
  Components                 Versions ----- --------- |----------- unreleased
                                            |                              | 
                                                                           ----------- Archived  
                                            |                            
                   -----------------------------------     
                  |                                            |
         Affects version                         Fix version
                                                               | No fix version
                                                        unscheduled

Monday, November 2, 2009

Posting a JIRA bug using Perl Mechanize

Perl provides modules which can be used as command line browser to automate tasks dependent on web pages. Among them LWP and mechanize are important ones. Mechanize is latest module with more features compared to LWP.
Recently I wrote a perl script to integrate a perl tool with JIRA bug tracking tool using mechanize, I just want to document here about mechanize usage with JIRA.
Basically this perl script post a bug in Jira after authentication

#!/usr/bin/perl -w
use WWW::Mechanize;
use HTTP::Cookies;
$mech = WWW::Mechanize->new();

# Authenticate to Jira and get a cookie back for the subsequent post.
$root_uri = "http://your-jira-site.com";

$mech->cookie_jar(HTTP::Cookies->new()); # Don't write cookies to file!
$mech->get($root_uri);
#login to Jira
$mech->form_name('loginform');
$mech->field(os_username => $jira_id);
$mech->field(os_password => $jira_pass);
$mech->click();
my $response = $mech->content();
if ($response !~ m/Dashboard for (\w+) (\w+)/) {
print_error("Failed to add new bug: authentication failed. Below you might find a clue as to what happened.");
print_error("
");
print_error($response);
return;
} else {
$username="$1 $2";
}



print "

creating new Jira bug ...

\n";
my $show_uri = "$root_uri/browse";
# Go to Product page in Jira
$mech->follow_link(text => "$product", n => 1);
#Browse to create new issue form
$mech->follow_link(text => "Create a new issue in project $product", n => 1);
$mech->form_name('jiraform');
$mech->click();

#Create a new bug
$mech->form_name('jiraform');
$mech->field(summary => "$formdata{hotfix}: $formdata{bugtitle}");
$mech->field(components => "$components_map{\"$formdata{component}\"}");
$mech->field(customfield_10044 => "$formdata{platform}"); #OS/Platform
$mech->field(customfield_10054 => "moderate"); #Bug severity
$mech->field(assignee => "$jira_id");
$mech->field(description => "$comment");
$mech->field(customfield_10067 => "$_[0]"); #Found in Version
$mech->field(customfield_10007 => "All"); #Appserver
$mech->field(customfield_10060 => "Support request (CE_Assistance)"); #Type of defect
$mech->field(customfield_10020 => "CS - other"); #Discovered by function
$mech->field(customfield_10019 => "Use in production "); #Discovered by activity
$mech->click();
print "

  posting bug ...\n";
$response = $mech->content();
my $bz_msg;
my $bug_number;
if ($response =~ m/Key:.*?browse\/(\w+)-(\w+)/s) {
$bug_number = "$1-$2";
print "done

\n";
$bz_msg = "

Bug #$bug_number for version $_[0] has been posted to " . "Jira.

\n";
print "$bz_msg";
$bz_donemsg .= $bz_msg;
} else {
$bz_donemsg .= "

No Jira bug was filed for version $_[0]. This will need to be done manually.

\n";
print_error("Failed to add new bug (Jira output follows):\n$response");
}



Reference: http://www.ibm.com/developerworks/linux/library/wa-perlsecure.html