Groovy multiline shell script in Jenkins sh step does not return stdout
1
I am trying to save the output of a groovy shell script in a variable. test = sh(returnStdout: true, script: "#!/bin/bash -l && export VAULT_ADDR=http://ourVault.de:8100 && export VAULT_SKIP_VERIFY=true && vault auth ${VAULT_TOKEN} && vault read -field=value test/${RELEASE2}/ID").trim() But there is no output and I wonder why it does not capture the output? If I do this: def test = "" sh"""#!/bin/bash -l export VAULT_ADDR=http://ourVault.de:8100 export VAULT_SKIP_VERIFY=true vault auth ${VAULT_TOKEN} ${test}="$(vault read -field=value emea/test/hockey/ios/${RELEASE2}/appID)" """ I see the output in the console. However, it doesn't get captured either. Is there any other way of ca...