Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,458,298
Community Members
 
Community Events
176
Community Groups

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

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

1 vote

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:

import groovyx.net.http.ContentType
import groovyx.net.http.HTTPBuilder
import groovyx.net.http.Method

def apiUrl = "https://somesitewithapi.com"
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"
}
}

log.info "Data received from $apiUrl: $responseJson"

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events