2 followers Follow

How to use multiple shared config servers in one task

Hello Team,


I want to use jira server from shared config and do a query on tasks, and once i get the output, how to use the smtp server and send a notification with in the same pluggin. 


Use case: I do a jira query and get issues, then send an email to a particular team using same pluggin.




Please sign in to leave a comment.



HI Vasanth, 

thanks for reaching out to XebiaLabs. At this moment its not possible to have multiple shared configs in 1 plugin task, but there is a way you can achieve your use case : 

For your use case you can use XebiaLabs bundled Jira and Notification plugin. 

Follow these steps : 

1. Task 1 : jira Query task -> Use jira query task and retrieve your issues and save the result inside a variable which you can define in an output properties of this task say `jiraIssues`

2. Task 2 : Jython Script task -> *Use this script in case you want to format those issues in some way before sending to the team*

input = wrap(releaseVariables["jiraIssues"])
temp="|Ticket ID|Ticket title|\n|---|---|\n"
for k, v in dict.items(input):
temp="{0}|{1}|{2}|\n".format(temp,k, v)
releaseVariables["jiraIssuesFormatted"] = temp

Where jiraIssuesFormatted is new variable with formatted data in a table 

3. Task 3 : Notification task -> Use the jiraIssuesFormatted variable inside body part 


thats it and this will serve your purpose .

Hope this helps.

Best Regards,

Chitrang Natu



XebiaLabs Support 0 votes

This is good. I was able to narrow it down the issue but just need one last thing.


data = Json.loads(response.response)
            print "#### Issues found"
            issues = {}
            msg2 = "\nBlocker: The below tickets are non-complaint in fortify, please fix them or raise exception in order to move further.\n"
            issue1 = data['issues'][0]['key']
            for item in data['issues']:
                issue = item['key']
                issues[issue] = item['fields']['summary']
                print u"* {0} - {1}".format(self._link(issue), item['fields']['summary'])
                print "\n"
                data = u" {0}  - {1}".format(self._link(issue), item['fields']['summary'])
                msg2 += '\n' + data
            query1 = "\nHere is the JQL query:\n" + "" + str(issue1) + "?jql=issuetype%20=%20\"Application%20Security\"%20AND%20\"Prod%20Due%20Date\"%20<%20now()%20AND%20status%20not%20in%20(Closed,%20Sign-Off,%20Resolved,%20Done)%20AND%20\"Scanning%20Source\"%20=%20Fortify%20AND%20priority%20in%20(Critical)%20AND%20priority%20=%20Critical%20and%20\"app%20portfolio%20ID\"%20~" + str(appid) + "%20ORDER%20BY%20\"Prod%20Due%20Date\"%20DESC\n\n"

            SOCKET_TIMEOUT = 30000 # 30s
            email = SimpleEmail()

            for toAddress in toAddress.split(','):
            email.setSubject('complaince report')
            email.addHeader('X-Priority', '1')
            comment = "TASK FAILED in XLR Due to past due tickets: :( \n"
            email.setMsg(str(comment) + str(query1) + str(msg2))
            raise Exception("Blocker: The above fortify tickets are non-complaint, please fix them or raise exception in order to move further. TASK FAILED in XLR Due to past due tickets: :-( ")
        return issues
        if response.status != 200:
            error(u"Failed to execute search '{0}' in JIRA.".format(query), response)

    def _createRequest(self):
        return HttpRequest(self.jira_server, self.username, self.password)

    def _link(self, issue):
        return '[{0}]({1}/browse/{0})'.format(issue, self.jira_server['url'])

and the email i am receiving is as below.

TASK FAILED in XLR Due to past due tickets: :( 

Here is the JQL query:"Application%20Security"%20AND%20"Prod%20Due%20Date"%20<%20now()%20AND%20status%20not%20in%20(Closed,%20Sign-Off,%20Resolved,%20Done)%20AND%20"Scanning%20Source"%20=%20Fortify%20AND%20priority%20in%20(Critical)%20AND%20priority%20=%20Critical%20and%20"app%20portfolio%20ID"%20~113%20ORDER%20BY%20"Prod%20Due%20Date"%20DESC

Blocker: The below tickets are non-complaint in fortify, please fix them or raise exception in order to move further.

 [MT-433](  - test scripting
 [MT-431](  - testing
 [MT-432](  - trashing

Expected output :

[MT-4353] is hyperlinked to the url


Vasanth 0 votes