Вы можете определить функцию, которая запускает команду оболочки (или make-файл, или все, что генерирует выходные данные) и возвращает этот вывод.
def getShellScriptResults() {
def bashresult = sh(
script: """
# run here shell script or anything that generates output
echo "bashValue"
""",
returnStdout: true
)
return bashresult.trim()
}
Затем вызовите функцию и присвойте результат Groovy VAR, например:
node('mynode') {
stage('Cloning repositories') {
# call the function and capture the result to a groovy var
res = getShellScriptResults()
println(res)
}
}