How to export a variable from sh to groovy in a jenkins pipeline? How to export a variable from sh to groovy in a jenkins pipeline? jenkins jenkins

How to export a variable from sh to groovy in a jenkins pipeline?


I hope this will help.

node('master'){    stage('stage1'){    def commit = sh (returnStdout: true, script: '''echo hi    echo bye | grep -o "e"    date    echo lol''').split()    echo "${commit[-1]} "    }}