本站文章除注明转载/出处外,均为本站原创或翻译,转载前请务必署名原文链接~~~

Jenkinsfile 中获取 Git 代码变更用户名和 Email

微信搜索 zze_coding 或扫描 👉 二维码关注我的微信公众号获取更多资源推送:


// Get checkout output value
def changeLogSets = checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'ec796dd7-3b23-4f68-8475-530f8cb03c9c', url: 'http://git.zze.xyz/jenkinsfile/icloud3.12.git/']]])
GIT_COMMIT = changeLogSets['GIT_COMMIT']
echo "$GIT_COMMIT"
            
// Git committer email
GIT_COMMIT_EMAIL = sh (
    script: "git --no-pager show -s --format='%ae' $GIT_COMMIT",
     returnStdout: true
).trim()
// Git committer name
GIT_COMMIT_NAME = sh (
    script: "git --no-pager show -s --format='%an' $GIT_COMMIT",
    returnStdout: true
).trim()
echo "Git committer name: ${GIT_COMMIT_NAME}"
echo "Git committer email: ${GIT_COMMIT_EMAIL}"

转自:


如果这篇文章对您有帮助,可点击下方链接分享给你的朋友们😋,如果遇到问题欢迎评论、留言~~~😇

评论

公众号:zze_coding

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×