Simplest Enterprise Continuous Integration Solutions

Sunday, January 29, 2012

JIRA migration: ClearQuest multi-line description

Migrate ClearQuest defects multi-line description field into JIRA

1. Using ClearQuest client or ClearQuest web to create a ClearQuest query for those ClearQuest defects without desc field
2. From ClearQuest web exporting ClearQuest query results into excel format, and save as a csv file
3. JIRA, Administration -> System -> Import & Export -> Import External projects -> CSV Import
4. Duplicate the above ClearQuest query, and only display id and description fields
5. From ClearQuest Eclispe Client exporting ClearQuest query results as XML format

Use ClearQuest Client the one built on Eclipse

Within Eclipse ClearQuest Client workspace, select a query, which contains the display fields: id and multiline field (such as, Description),right click the query -> select Export Records… -> in Select fields diagram, click Next -> in Export tool settings diagram, select XML as Format, click Next -> in Specify file names diagram, click Finish
6. Run a PERL script (i.e. xmlClearQuestExportIntoJira.pl) through JIRA cli interface updating desc on Linux from where ClearQuest UTF-8 code issue will be eliminated)


NAME

    xmlClearQuestExportIntoJira.pl

SYNOPSIS

  DESCRIPTION

    This script is going to migrate exported XML format ClearQuest id, Description file into Jira.

  VERSION

    Version 1.0

  USAGE

       perl xmlClearQuestExportIntoJira.pl --jira_project_key "[jira_project_key]" --jira_field_for_clearquest_id "[jira_field_for_clearquest_id]" --jira_field_for_clearquest_description "[jira_field_for_clearquest_description]" --exported_xml_format_clearquest_id_description_file "[exported_xml_format_clearquest_id_description_file]" --jira_cli "[jira_cli]"
    *   --jira_project_key "[jira_project_key]" - Jira Project Key. *Required*
    *   --jira_field_for_clearquest_id "[jira_field_for_clearquest_id]" - Jira field maps to ClearQuest id field. *Required*
    *   --jira_field_for_clearquest_description "[jira_field_for_clearquest_description]" - Jira field maps to ClearQuest Description field. *Required*
    *   --exported_xml_format_clearquest_id_description_file "[exported_xml_format_clearquest_id_description_file]" - Full path of exported xml format ClearQuest id, Description file. *Required*
    *   --jira_cli "[jira_cli]" - Full path of atlassian-cli. *Required*

  EXAMPLE

       1. Migrate exported XML format ClearQuest id, Description file into Jira.
       perl /tmp/xmlClearQuestExportIntoJira.pl --jira_project_key "MY_JIRA_PROJECT_KEY" --jira_field_for_clearquest_id "id" --jira_field_for_clearquest_description "description" --exported_xml_format_clearquest_id_description_file /tmp/CQ_desciption_export.xml --jira_cli /opt/atlassian-cli-2.4.0/jira.sh

Saturday, January 21, 2012

JIRA security: JIRA server runs over HTTPS

In order to encrypt JIRA login username & passsword instead of plain text in HTTP, configure JIRA Tomcat server (6.0) to run over HTTPS


1. Generate a private key

# login as root on JIRA Linux server.
[root@linux64-jira-server ~]#  id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
# su to jira running user
[jira@linux64-jira-server ~]$ su - jira
[jira@linux64-jira-server ~]$ $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA
Enter keystore password:
Re-enter new password:
What is your first and last name?
  [Unknown]:  linux64-jira-server.domain.com
What is the name of your organizational unit?
  [Unknown]:  my_unit
What is the name of your organization?
  [Unknown]:  my_org
What is the name of your City or Locality?
  [Unknown]:  my_city
What is the name of your State or Province?
  [Unknown]:  my_state
What is the two-letter country code for this unit?
  [Unknown]:  my_country
Is CN=linux64-jira-server.domain.com, OU=my_unit, O=my_org, L=my_city, ST=my_state, C=my_country correct?
  [no]:  y
Enter key password for <tomcat>
        (RETURN if same as keystore password):
# Make sure .keystore existence under JIRA running user (jira) home
[jira@linux64-jira-server ~]$ id
uid=501(jira) gid=501(jira) groups=501(jira) 
[jira@linux64-jira-server ~]$ ls -al ~/.keystore
-rw-rw-r--  1 jira jira 1362 Jun  5  2012 .keystore


2. Generate a CSR (Certificate Signing Request)

[jira@linux64-jira-server ~]$ $JAVA_HOME/bin/keytool -certreq -keyalg RSA -alias tomcat -file certreq.csr -keystore /home/jira/.keystore


3. Submit certreq.csr to a certificate authority

Submit the generated certreq.csr to Certificate Authority for a certificate chain (DER encoded or Base 64 encoded), save it as certnew.p7b

4. Import the signed certificate into local keystore

[jira@linux64-jira-server ~]$ $JAVA_HOME/bin/keytool -importcert -alias tomcat -keystore /home/jira/.keystore -file /home/jira/certnew.p7b

5. Configure HTTPS in Tomcat

Insert below session into server.xml (Default is /opt/atlassian/jira/conf/server.xml) before </service> tag
<Connector port="8443" maxHttpHeaderSize="8192" SSLEnabled="true"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" disableUploadTimeout="true" useBodyEncodingForURI="true"
acceptCount="100" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />


6. Enable 8443 port from JIRA server firewall

system-config-securitylevel


7. Redirecting certain pages to HTTPS


Insert below session into web.xml (Default is /opt/atlassian/jira/atlassian-jira/WEB-INF/web.xml) before </web-app> tag <security-constraint>
<security-constraint>
   <web-resource-collection>
      <web-resource-name>all-except-attachments</web-resource-name>
      <url-pattern>*.jsp</url-pattern>
      <url-pattern>*.jspa</url-pattern>
      <url-pattern>/browse/*</url-pattern>
   </web-resource-collection>
   <user-data-constraint>
      <transport-guarantee>CONFIDENTIAL</transport-guarantee>
   </user-data-constraint>
</security-constraint>


8. Debug JIRA Tomcat Server runs over HTTPS

[jira@linux64-jira-server ~]$ /opt/atlassian/jira/bin/start-jira.sh -fg


9. Restart JIRA Tomcat Server runs over HTTPS

[jira@linux64-jira-server ~]$  id
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
[jira@linux64-jira-server ~]$ service jira stop
[jira@linux64-jira-server ~]$ service jira start

Saturday, January 14, 2012

JIRA customization: email subject, description

Email notification subject with Status and Priority:

cd /opt/atlassian/jira/atlassian-jira/WEB-INF/classes/templates/email/subject
cat issueassigned.vm
$issue.statusObject.name $issue.priorityObject.name ($issue.key) $issue.summary

Customized Description:

Description field with template as below:

Symptoms :
--------------

Procedures :
--------------
               
Details:
---------


Steps:

cd /opt/atlassian/jira/atlassian-jira/WEB-INF/classes/templates/jira/issue/field
cp description-edit.vm org_bk_description-edit.vm
cat description-edit.vm
#customControlHeader ($action $field.id $i18n.getText($field.nameKey) $fieldLayoutItem.required $displayParameters $auiparams)
## setup some additional parameters
$!rendererParams.put("class", "long-field")
$!rendererParams.put("rows", "12")
$!rendererParams.put("wrap", "virtual")
#macro( setDescription )

Symptoms :
--------------

Procedures :
--------------
               
Details:
---------

#end
## let the renderer display the edit component
#if ($description=="" || !$description)
#set ($description = "#setDescription()")
#end
$rendererDescriptor.getEditVM($!description, $!issue.key, $!fieldLayoutItem.rendererType, $!field.id, $field.name, $rendererParams, false)
#customControlFooter ($action $field.id $fieldLayoutItem.getFieldDescription() $displayParameters $auiparams)

Restart JIRA service

service jira stop; service jira start:


Saturday, January 7, 2012

JIRA: cli interface

Creating JIRA Issue using JIRA cli interface – a minimal effort solution, easy use and maintain

1.       JDK1.6 installed
2.       Download atlassian-cli-2.4.0-distribution.zip from atlassian website
3.       Unzip atlassian-cli-2.4.0-distribution.zip, such as C:\atlassian-cli-2.4.0
4.       Edit C:\atlassian-cli-2.4.0\jira.bat
from
      java -jar "%dirPath%"/lib/jira-cli-2.4.0.jar %*
               to
      java -jar "%dirPath%"/lib/jira-cli-2.4.0.jar --server http://<my_jira_server>:8080 --user <submitter_username> --password <submitter_password> %*

Example creating an issue in JIRA

Under Dos Prompt executing command as below :
C:\atlassian-cli-2.4.0\jira.bat --action createIssue --project "MY_JIRA_PROJECT_KEY" --type "defect" --summary "Created from cli" --priority "Priority 2" --affectsVersions "3.0.1" -–components "application"
Issue JIRATST-17 created with id 10705. URL: http://<my_jira_server>:8080/browse/MY_JIRA_PROJECT_KEY -17

Note:

Priority, affectsVersdions are mandatory fields