0

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?

2 Answers 2

3

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

Sign up to request clarification or add additional context in comments.

Comments

1

try:

export CHECK=`curl -sI https://somegithuburl.com`;
echo $CHECK

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.