侧边栏壁纸
博主头像
张种恩的技术小栈博主等级

行动起来,活在当下

  • 累计撰写 748 篇文章
  • 累计创建 65 个标签
  • 累计收到 39 条评论

目 录CONTENT

文章目录

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

zze
zze
2021-05-08 / 0 评论 / 0 点赞 / 479 阅读 / 1036 字

不定期更新相关视频,抖音点击左上角加号后扫一扫右方侧边栏二维码关注我~正在更新《Shell其实很简单》系列

// 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}"

转自:

0

评论区