Can we trigger a azure pipeline release using scrip runner from Jira?

Yendapally February 18, 2022

Hi Team,

We are planning to trigger a azure release pipeline to passing the variables from jira user request, Can we do it using script runner?

1 answer

Suggest an answer

Log in or Sign up to answer
1 vote
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 18, 2022

You can trigger anything that has some web API with Scriptrunner.

But I'm not familiar with azure pipeline releases. There is probably a similar community forum for that project where you can ask how the APIs work.

But from the Scriptrunner's point of view, you will have to identify what you want your jira trigger will be. It could be a workflow, a scheduled job, a listener, or some user action through the UI.

Then, you'll need to consider what type of data the azure API might need and if it's already available within your Jira context or if you need to ask the user to provide additional information somehow.

Then, you can use the appropriate Scriptrunner configuration to gather the data and make an API call. Depending on the API, the data will have to be formatted a certain way. Probably "json" string. But some older APIs prefer xml.

Then, there are multiple libraries with which you can make the api call.

My favorite is HttpBuilder, a sample call would look like this:


def apiUrl = ""
def httpBuilder = new HTTPBuilder(apiUrl)

def payload = [some:'payload structured data']
def responseJson //this will hold the data returned by the api
httpBuilder.request(Method.POST, ContentType.JSON) {
headers."Authorization" = "some token as required by the api"
uri.path = "/path/to/api/endpoint"
body = payload //this will be converted to json automatically
response.success = { response, json ->
if (json) {
responseJson = json
response.failure = { resp, data ->
log.error "httprequest failed: $data"
} "Data received from $apiUrl: $responseJson"
AUG Leaders

Atlassian Community Events