这个完整的管道对您有用吗?使用管道插件2.4为我工作。
pipeline { agent { label 'docker' } stages { stage("test_capture_output_and_print") { steps { script { def commitSha = sh(returnStdout: true, script: 'git rev-parse HEAD').trim() println("commitSha: ${commitSha}") } } } }}


