Reputation: 340
I have the following code:
...
stage('Some stage') {
sh """
#!/bin/bash
CHECK=$(curl -sI https://somegithuburl.com)
echo $CHECK
"""
}
...
And when the Jenkins job is executed it returns:
+ CHECK=
Do you know how can I save the output in a variable in the same way I would do in a Shell script?
Upvotes: 0
Views: 2204
Reputation: 65
try:
export CHECK=`curl -sI https://somegithuburl.com`;
echo $CHECK
Upvotes: 1
Reputation: 6591
Correct way to pull the output and save as a variable:
export CHECK="$(curl -s https://somegithuburl.com)"
then you can use $CHECK
as a variable
Upvotes: 3