用于PowerShell的Jenkins Git项目URL变量

时间:2017-12-01 13:52:22

标签: powershell github jenkins

我知道这不是一个很好的问题"要问,但我似乎无法在任何地方找到答案。我正在创建NuGet包,我想自动填充的属性之一是项目URL。我碰巧注意到在Jenkins中配置作业并点击' GitHub项目'时,会出现一个框,供您输入项目网址'。我的所有研究都把我带到了Repository URL,这不是我想要的,我尝试了以下(逻辑可能性):

$env:PROJECT_URL
$env:PROJECTURL
$env:GITPROJECTURL
$env:GIT_PROJECT_URL

有谁知道环境变量包含这个值?

1 个答案:

答案 0 :(得分:0)

jit的Jenkins环境URL仅包含以下内容:

GIT_BRANCH
For Git-based projects, this variable contains the Git branch that was checked out for the build (normally origin/master)

GIT_COMMIT
For Git-based projects, this variable contains the Git hash of the commit checked out for the build (like ce9a3c1404e8c91be604088670e93434c4253f03) (all the GIT_* variables require git plugin)    

GIT_URL
For Git-based projects, this variable contains the Git url (like git@github.com:user/repo.git or [https://github.com/user/repo.git])

如果您想添加更多网址,例如Git项目的项目网址,您可以创建自己的环境变量($env:MyCustom_Project_URL = "http://whateverIwantittobe.randomtld")并在脚本中引用它们。