用于执行Jenkins shell脚本的Git环境变量 [英] Git environment variables for use in executing Jenkins shell scripts

查看:708
本文介绍了用于执行Jenkins shell脚本的Git环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

希望有人可以帮忙 - 我在我的Jenkins实例中安装了以下插件 - 但我似乎无法获得下面的Git变量。我需要这些来完成我们的CI设置。有没有我失踪的东西?



我将它们传入:

ssh builder @ 10.10.10.10./build-pass.sh $ GIT_BRANCH

  https://wiki.jenkins-ci.org/显示/ JENKINS / Git +插件



环境变量



Git插件设置了几个可用于脚本的环境变量: GIT_COMMIT p>
  • GIT_BRANCH - 当前正在使用的分支的名称,例如master或origin / foo

  • GIT_AUTHOR_EMAIL - 提交者/作者电子邮件


  • GIT_COMMITTER_EMAIL - 提交人/作者电子邮件



  • 解决方案



    要查看所有可用的环境变量,请添加到Execute shell字段中:

      printenv 

    控制台输出会显示所有可用的变量。


    Hope someone can help - I have the following plugin installed in my Jenkins instance - but I don't seem to be able to get hold of the Git variables below. I need these to complete our CI setup. Is there something that I'm missing?

    I'm passing them in like:

    ssh builder@10.10.10.10 "./build-pass.sh $GIT_BRANCH"

    https://wiki.jenkins-ci.org/display/JENKINS/Git+Plugin
    

    Environment variables

    The git plugin sets several environment variables you can use in your scripts:

    • GIT_COMMIT - SHA of the current

    • GIT_BRANCH - Name of the branch currently being used, e.g. "master" or "origin/foo"

    • GIT_AUTHOR_EMAIL - Committer/Author Email

    • GIT_COMMITTER_EMAIL - Committer/Author Email

    解决方案

    Ok I cracked this one myself.

    To see all environment variables available add to the Execute shell field:

    printenv
    

    Console output will then show all the available vars.

    这篇关于用于执行Jenkins shell脚本的Git环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆