Позволю себе еще один вопрос. shortCommit = sh(returnStdout: true, script: "git log -n 1 --pretty=format:'%h'").trim() Почему ему не нравится такая конструкция?
The git plugin assigns values to environment variables in several contexts. Environment variables are assigned in Freestyle, Pipeline, Multibranch Pipeline, and Organization Folder projects.