Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to trigger Jenkins Job from Jira Cloud Scriptrunner

Roy Powell February 21, 2022

Hi,

I am testing the ability to trigger a parameterized Jenkins Job from Scriptrunner Script Console in Jira Cloud (see script in bold below, with sensitive data marked as "scrubbed"). This type of script has worked for me on Jira Data Center, but based on my research it is now failing due to the removal of Java APIs in Cloud(?)

Is there any guidance on an alternative approach for running a script similar to below? Ultimately I want to be able to trigger a Jenkins Job using a post function within a workflow, passing some field data from Jira into the job.

 

def issueKey = "TEST-1"
def projectKey = "TEST"

def jenkinsInstance = "scrubbed"

def build_job = "scrubbed"
def token = "scrubbed"

def USERPASS = scrubbed:scrubbed

def curl = "/usr/bin/curl -u $USERPASS $jenkinsInstance/job/$build_job/buildWithParameters?token=$token&IssueKey=$issueKey&ProjectKey=$projectKey"

curl.execute()

 

Returned errors:

org.codehaus.groovy.runtime.InvokerInvocationException: java.io.IOException: Cannot run program "/usr/bin/curl": error=2, No such file or directory at ConsoleScriptExecution1_groovyProxy.run(Unknown Source) Caused by: java.io.IOException: Cannot run program "/usr/bin/curl": error=2, No such file or directory

0 answers

Suggest an answer

Log in or Sign up to answer