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

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Script Runner not working when trying to trigger pipeline from jira through post functions


Hi All,

We have been trying to trigger pipeline in Jenkins from jira through post functions. As the script not executing while making a below grooving script through script runner plugin in the jira workflow

Use case :

In workflow While making transition from pipeline creation approval to pipeline creation

Code used :

import com.atlassian.jira.component.ComponentAccessor

def customFieldManager = ComponentAccessor.getCustomFieldManager()
def repoName = customFieldManager.getCustomFieldObjectByName("Git repositories")
def pipelinename = customFieldManager.getCustomFieldObjectByName("CI BuildJob")
def techstackname = customFieldManager.getCustomFieldObjectByName("Tech Stack")
def repoNameValue = issue.getCustomFieldValue(repoName)?.value
def piplelineNamevalue = issue.getCustomFieldValue(pipelinename)?.value
def techstackNameValue = issue.getCustomFieldValue(techstackname)?.value
def BUILD_TOKEN = "11268982e8e7f9d983d79b37bbeb5e4d1d"
def urlConnection = new URL("${BUILD_TOKEN}&GitRepoName=${repoNameValue}&techstack=${techstackNameValue}&name_job_create=${piplelineNamevalue}").openConnection()
def authString = "admin:11268982e8e7f9d983d79b37bbeb5e4d1d".getBytes().encodeBase64().toString()


urlConnection.setRequestProperty("Authorization", "Basic ${authString}")

urlConnection.setRequestProperty("Content-Type", "application/json")


def postRC = urlConnection.getResponseCode();



Expected output :

Pipeline must be created at jenkins end with the above code 


Please note :We used the script on creating repo in github in validation part of the workflow through script runner it worked

Has anyone come across with the same scenario who could assist with this ?




Arthi Balraj



Log in or Sign up to comment
Community showcase
Published in Jira

Admins, notify your Jira instance of system-wide changes with the new admin announcement banner

Hi All! We’re excited to share the launch of an announcement banner that lets Jira site administrators communicate directly to their users across their  Jira Cloud instance.  ...

694 views 17 19
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you