Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The Issue Tracking Systems page, which can be accessed through the Administration - Integrations - Issue Tracking Systems menu, allows management of integrations into third-party issue-tracking systems. FlexDeploy currently provides out of box integration with Atlassian Jira. You can define custom implementation using either Java class or Groovy script. FlexDeploy reads ticket SCM commit message comments to associate tickets.  As an example, if you use SVN, when committing a change back to the repository, simply put the issue name in the commit comment(case sensitive).  If using Git as your SCM, make sure that the Git executable is installed on FlexDeploy server and is accessible on the PATH. The Git executable version must be 1.7.9 or higher. Tickets can also be manually associated to an Issue Tracking System on the Build Request Form.

Image Removed

To configure a Jira issue tracking system 


Here is the out of box issue tracking systems. To configure, select Jira and click the Edit button. Issue Tracking System screen allows you to view the details on our of box Jira. Image RemovedFlexDeploy comes up with Java Implementation to integrate with Jira, you are not allowed to change implementation class and change or add new  properties. You can create additional Issue Tracking System as necessary using the Create button.

Image Added

You can provide global customizations for the Jira integration here, or override the settings at the environment, project, or environment/project level. The customizations available are as follows.

...


Anchor
_GoBack
_GoBack


Issue Tracking System statuses identify the statuses within your Jira system, and allows FlexDeploy to update your issues to those values at build or deployment time. You will add the statuses from the Jira workflow(s) associated to your Jira project(s). Click the (plus) and (minus) buttons to add or remove statuses from the list. 


Image RemovedImage Added

To identify the statuses to add, from within your Jira system, view the workflow(s) associated to your Jira project(s). Switching to the Text view of the workflow editor/viewer you can identify the workflow statuses and transition ids.

...

Click the Save button to apply any updates

Tickets can also be manually associated to an Issue Tracking System on the Build Request Form for each project.

Image Added


Tip
titleGetting Started

If you want FlexDeploy to integrate with custom or other third party Issue Tracking System, then you should create a new Issue Tracking System using a custom Java or Groovy implementation

Let's see how to create a custom Issue Tracking System and integrate with Flex Deploy. Please follow the below steps for creating a new Issue Tracking System

  • Provide a unique name and description
  • Define properties for the new issue tracking system. Properties are configuration values used by FlexDeploy to connect to the new system.
    • If you define properties, you can indicate display and validation details. You can also indicate if property is required and/or encrypted.
    • Enter a unique Name before adding any properties
  • Provide either Java Implementation or Groovy API

Let's define an example issue tracking system, so we can easily how to setup in FlexDeploy. You can provide implementation as Java class or just Groovy script. Groovy script would allow for dynamic update but use of Java code will require restart of server.

Here we are creating custom issue tracking system with the properties, you can add more as necessary.


Image Added

API Implementation

Implementation should implement certains API operations to integrate with FlexDeploy


Method Name

ParameterReturn Type

Description

populateTicket

Ticket pTicketvoid

This method should call the issue Tracking System using the ticket number(pTicket.getNumber())  and set the Description and Type

getTicketURL

Ticket pTicketString

This method should constrct the URL to access the ticket. (Ex http://<hostname>:<port>/redmine/issues/<issuenumber>.json)

addCommentToTicket

Ticket pTicket, String pCommentvoid

Adding pComment to the ticket. The ticket number(pTicket.getNumber()) from Ticket object should be used to get the Ticket and add the comment.

changeTicketStatusTo

Ticket pTicket, String pStatusvoid

Change the status of the ticket to pStatus. The ticket number(pTicket.getNumber()) from Ticket object should be used to get the Ticket and change the status.

getTicketStatus

Ticket pTicketStringGet the current status of the ticket. The ticket number(pTicket.getNumber()) from Ticket object should be used to get the Ticket status.

checkConnection


void

This should invoke any status or heath check URL of the issue tracking system to ensure the system is up and running

parseTicketNumberFromChangeLogs

String pProjectName, List<String> pMessagesToParse, List<String> pTicketPatternListCollection<String>

pProjectName - name of the project for which the Issue tracking system is condifured

pMessageToParse - list of string from the SCM commit logs

pTicketPatterList  - pattern configured in the project or for the issues tracking system.

Add a custom rule by project to parse the message log string using single or multiple patterns. You can also use a different pattern list. Should return a unique list of ticket numbers


Java Implementation

Here are high level steps for Java implementation. You can use any IDE to prepare this implementation. 

  • Create java class that extends flexagon.fd.model.integration.its.api.IssueTrackingSystem. See example below.
    • Below example has testConnection method implemented. The method uses the properties map to retrieve the configuration values to connect to the issue tracking system.

Image Added

  • In order to compile your java class, you will need FlexDeployAPI.jar on classpath.
  • Implement all the methods descriped in the table in the API Implementation section
  • For any failure connecting to the system or if any issues with the data, then you can throw exception. For example throw new ApiException("Invalid credentials.", "");
  • Once you are ready with unit testing, you can prepare Jar file for your credential store java class and other utility classes. This jar file can be placed on server classpath now.
    • For Tomcat, put this jar file in apache-tomcat-flexdeploy/lib folder.
    • For WebLogic, put this jar file in Domain lib folder.
    • If you are using any third party libraries from your Java implementation, then those jar files will also need to be added to same lib folder. Keep in mind that this can cause issues with server functioning, so be prepared to remove your additional library files.

Groovy Implementation

Here are high level steps for Groovy implementation. You can use any IDE to prepare this implementation. 

  • Create a groovy class. See example below.
    • Below example has testConnection method implemented.

Image Added

  • Implement all the methods descriped in the table in the API Implementation section
  • For any failure connecting to the system or if any issues with the data, then you can throw exception. For example throw new ApiException("Invalid credentials.", "");


Tip

As groovy is able to access FlexDeploy variables and Java classes, you can take advantage of Java libraries from Groovy script. For example, if there is Java library used to access the issue tracking system, you can places those in lib folder and use those classes from Groovy script. This allows you to keep dynamic part of implementation in Groovy and use Java library.

Using Groovy has the below advantages

  • All the properties defined are available as groovy binding variables. For example, properties can be accessed directly like REDMINE_URL, REDMINE_USER_NMAE or REDMINE_PASSWORD etc
  • log is a FlexDeploy logger variable which should be used to log any information from the groovy class.
  • fdrestutils is a utility object available to use FlexDeploy API to invoke any REST API
    • testConnection(String pHostName, String pUrl, String pUserName, String pPassword)
    • getRequest(String pHostName, String pResourcePath, String pUserName, String pPassword) - Returns javax.json.JsonObject
    • postRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, String pResourceName, String pPayload) - Returns boolean
    • putRequest(String pHostName, String pUserName, String pPassword, String pResourcePath, String pPayload) - Returns boolean

def builder = new groovy.json.JsonBuilder()

def root = builder.issue {

notes "${pComment}"

}

String payload = builder.toString();

String ticketNumber = ticket.getNumber();

String resourcePath = REDMINE_TICKET_REST_PATTERN.replaceAll("\\{REDMINE_ISSUE\\}", ticketNumber)

fdrestutils.putRequest(REDMINE_URL, REDMINE_USER_NMAE, REDMINE_PASSWORD, resourcePath, payload);