获取git提交作为变量

stage('Clone') {
echo "1.Clone Stage"
git url: "http://gitlab.xxxxx.com/demo/demo.git"
script {
build_tag = sh(returnStdout: true, script: 'git rev-parse --short HEAD').trim()
}
}
stage('Build') {
echo "2.Build Docker Image Stage"
sh "docker build -t demo:${build_tag} ."
}
发表评论

相关文章