I am migrating from Jenkins
to GitHub Actions
. I plan to reuse the script from my Jenkins in the GitHub Actions as mentioned here.
I am struggling to make a curl request
from my script.groovy
file.
Where exactly do I have an issue?
// Products def output = new StringBuffer() def error = new StringBuffer() def createProductResponse = sh(script: "curl -k -s -w '\n%{response_code}' --header 'Authorization:Basic $USER' --header 'Content-Type: application/json' --data-binary '$productBody' --request POST https://${host}/apiproducts").execute().waitForProcessOutput(output, error) println "*** createProductResponse = $createProductResponse ***" println "### createProductResponseoutput = $output ###"
I am making use of .execute()
and .waitForProcessOutput()
functions, but the curl
fails to execute and returns: