The Jira pack provides the ability to create issues, comment on issues and to get info about issues.
To build and run from the command line:
- Clone this repo
- Run
go build
- Run
FLYTE_API_URL=http://.../ JIRA_HOST=https://... JIRA_USER=... JIRA_PASSWORD=... ./flyte-jira
- Fill in this command with the relevant API url, Jira host, Jira user and Jira password environment variables
To build and run from docker
- Run
docker build -t flyte-jira .
- Run
docker run -e FLYTE_API_URL=http://.../ -e JIRA_HOST=https://... -e JIRA_USER=... -e JIRA_PASSWORD=... flyte-jira
- All of these environment variables need to be set
This pack provides the following commands: CommentIssue
, IssueInfo
, CreateIssue
, IssueAssign
, IssueCreateLink
, IssueGetLink
, IssueDeleteLink
This command returns information about a specific issue.
This command's input is the id of the desired issue. The issue can either be a URL with an issueId base or an issueId in string representation. E.g
"input": "TEST-123",
"input": "http://foo.bar/TEST-123"
Because slack automatically places embeded URLs in between < >
tags, then the following is also accepted:
"input": "<http://foo.bar/TEST-123>"
This command can either return an Info
event or an InfoFailure
event.
This is the success event, it contains the Id, Summary, Status, Description and Assignee. It returns them in the form:
"payload": {
"id": "TEST-123",
"summary": "Fix client race condition",
"status": "In Progress",
"description": "The client experiences.....",
"assignee": "jsmith@expediagroup.com",
"reporter": "test@expediagroup.com",
"priority": "Medium",
"components": "Compute Platform",
"labels": "feature-request",
"type": "Support"
}
This contains the id of the issue and the error.
"payload": {
"id" : "TEST-123",
"error": "Could not get info on TEST-123: status code 400",
}
This command creates a Jira issue.
This command inputs are the project that the issue should be created under, the issue type and the summary (title).
"fields": {
"project":
{
"key": "TEST"
},
"issuetype":
{
"name": "Story"
},
"summary": "Fix csetcd bug"
}
This command can return either a CreateIssue
event or a CreateIssueFailure
event.
This is the success event, it contains the id of the issue and the url of the issue along with the input (project, issuetype & summary) It returns them in the form:
"payload": {
"id": "TEST-123",
"url": "https://localhost:8100/browse/TEST-123",
"project": "TEST",
"issuetype": "Story",
"summary": "Fix csetcd bug",
"priority": "Medium",
"reporter": "songupta@expediagroup.com",
"description": "This is issue description"
}
This contains the error if the issue cannot be created along with the input (project, issuetype & summary):
"payload": {
"error": "Cannot create issue: Fix csetcd bug: status code 400",
"project": "TEST",
"issuetype": "Story",
"summary": "Fix csetcd bug"
}
This command creates a Jira issue in a target project (specified in a flow). Required a ServiceNow incident and labels (optional) as an argument
This command inputs are the project that the issue should be created under, the issue type and the summary (title).
"input": {
"incident": "INC1234567",
"issuetype": "Story",
"project": "SRO",
"summary": "Test",
"description": "This JIRA issue was created by Flyte",
"labels": [
"TEST-LABEL"
]
}
This command can return either a CreateIncIssue
event or a CreateIncIssueFailure
event.
This is the success event. It returns them in the form:
"payload": {
"id": "10000",
"key": "FLYTE-1",
"self": "https://jira.expedia.biz/rest/api/2/issue/10000",
}
This contains the error message if the issue cannot be created:
"payload": {
"message": "Cannot create issue: Fix csetcd bug: status code 400",
}
This command comments on an issue.
This commands input is the id of the issue and the comment to be added.
"input": {
"id": "TEST-123",
"comment": "Added to backlog"
}
This command can return either a Comment
event or a CommentFailure
event.
This is the success event, it contains the id of the issue, the comment and the status. Status is the status code returned when a comment is left successfully.
"payload": {
"id": "TEST-123",
"comment": "Added to backlog"
}
This returns the error if a issue cannot be commented on successfully. It contains, the issue id, the comment and the error:
"payload": {
"id": "TEST-123",
"comment": "Added to backlog",
"error": "Could not comment on issue: status code 400"
}
This command searches issues using JQL queries.
This command's inputs are the query string, the index of the first element to be retrieved in the list of results and the number of elements to be retrieved.
"input": {
"query": "project = Flyte", // required
"startIndex": 0, // optional, default: 0
"maxResults": 10 // optional, default: 10
}
This command can return either a SearchSuccess
event or a SearchFailure
event.
This is the success event, it contains the values given as input for the command, the total number of possible results and the issues retrieved.
"payload": {
"query": "project = Flyte",
"startIndex": 0,
"maxResults": 10,
"total": 85,
"issues":[
{
"id": "TEST-123",
"summary": "Fix client race condition",
"status": "In Progress",
"description": "The client experiences.....",
"assignee": "jsmith",
}
...
]
}
This returns the error if the jql query is not valid. It contains the values given as input for the command and the error:
"payload": {
"query": "project = Flyte",
"startIndex": 0,
"maxResults": 10,
"error": "Could not search for issues: statusCode=400"
}
Assign a user to a JIRA issue
The input is a json
object with a username
and an issueId
fields. According to the Jira API docs, the username field can be left empty to unassign the issue, which is why it can be omitted from the input. Likewise, a "-1" string name will auto-assign
the issue.
input JSON object
:
{
"username": "test-123", // optional, nil name == unassign
"issueId": "ISSUE-01" // required
}
The output consists of two events: an AssignEvent
or an AssignFailureEvent
If the assignment is successful, an event will be propagated back with a payload consisting of the initial request paramters.
"payload": {
"username":"test-123",
"issueId": "ISSUE-01"
}
If the assignment is unsuccessful, an assignFailureEvent
will come back with a payload consisting of the initial request and the error message.
"payload": {
"username": "foo",
"issueId": "ISSUE01",
"error": "Unauthorised"
}
Jira offers the possibility to manage links between issues. The commands that are available to do so are IssueGetLink
, IssueDeleteLink
and IssueCreateLink
. While their functionality is self-explanatory, the input/output varies depending on the operation.
The two event types in the case of links are:
Link
--> propagated on successLinkFailure
--> propagated on failure
will return a link object that links two issues.
The input is a json
object with a linkId
field, where the linkId
is id of the respective link object. Generally, those ids can be obtained by looking at a card information (IssueInfo
now supports link information!).
{
"linkId": "12351245"
}
In case of a success, the output will contain the link information:
{
"inwardIssue": "<issue-key>",
"outwardIssue": "<issue-key>",
"linkType": {
"Name": "Depends"
},
"Comment": "Link related issues!"
}
Based on 2 project keys and and a link type, create a link with that type between the 2 issues.
{
"inwardIssue": "<issue-key>",
"outwardIssue": "<issue-key>",
"linkType": "<type>",
}
The output is the initial request or a failure event if unsuccessful.
Based on a linkId
, the link between 2 issues is deleted.
{
"linkId": "12341234"
}
The initial request if successful or a failure event if unsuccessful.