cbald24 cbald24 - 2 days ago 3
Bash Question

Access info about a different job using curl command

I am currently trying to access build information about jobA in jobB. I was considering using:

$ curl "${JENKINS_URL}/job/${JOB_NAME}/lastSuccessfulBuild/consoleText"


but I have no Idea how I would be saving the console log. How would I be able to assign what I get from the curl statement to a variable that could be accessed by a groovy script?

Answer

Execute it from the Groovy script for example?

def curlProcess = 'curl "${JENKINS_URL}/job/${JOB_NAME}/lastSuccessfulBuild/consoleText"'.execute()
curlProcess.waitFor()
def output = curlProcess.text